Index: head/sys/riscv/riscv/exception.S =================================================================== --- head/sys/riscv/riscv/exception.S +++ head/sys/riscv/riscv/exception.S @@ -40,12 +40,12 @@ #include #include -.macro save_registers el +.macro save_registers mode addi sp, sp, -(TF_SIZE) sd ra, (TF_RA)(sp) -.if \el == 0 /* We came from userspace. */ +.if \mode == 0 /* We came from userspace. */ sd gp, (TF_GP)(sp) .option push .option norelax @@ -88,7 +88,7 @@ sd a6, (TF_A + 6 * 8)(sp) sd a7, (TF_A + 7 * 8)(sp) -.if \el == 1 +.if \mode == 1 /* Store kernel sp */ li t1, TF_SIZE add t0, sp, t1 @@ -110,9 +110,9 @@ sd t0, (TF_SCAUSE)(sp) .endm -.macro load_registers el +.macro load_registers mode ld t0, (TF_SSTATUS)(sp) -.if \el == 0 +.if \mode == 0 /* Ensure user interrupts will be enabled on eret */ li t1, SSTATUS_SPIE or t0, t0, t1 @@ -130,7 +130,7 @@ ld t0, (TF_SEPC)(sp) csrw sepc, t0 -.if \el == 0 +.if \mode == 0 /* We go to userspace. Load user sp */ ld t0, (TF_SP)(sp) csrw sscratch, t0 Index: head/sys/riscv/riscv/trap.c =================================================================== --- head/sys/riscv/riscv/trap.c +++ head/sys/riscv/riscv/trap.c @@ -158,7 +158,7 @@ } static void -svc_handler(struct trapframe *frame) +ecall_handler(struct trapframe *frame) { struct thread *td; @@ -172,7 +172,7 @@ } static void -data_abort(struct trapframe *frame, int usermode) +page_fault_handler(struct trapframe *frame, int usermode) { struct vm_map *map; uint64_t stval; @@ -290,7 +290,7 @@ break; case EXCP_STORE_PAGE_FAULT: case EXCP_LOAD_PAGE_FAULT: - data_abort(frame, 0); + page_fault_handler(frame, 0); break; case EXCP_BREAKPOINT: #ifdef KDTRACE_HOOKS @@ -353,11 +353,11 @@ case EXCP_STORE_PAGE_FAULT: case EXCP_LOAD_PAGE_FAULT: case EXCP_INST_PAGE_FAULT: - data_abort(frame, 1); + page_fault_handler(frame, 1); break; case EXCP_USER_ECALL: frame->tf_sepc += 4; /* Next instruction */ - svc_handler(frame); + ecall_handler(frame); break; case EXCP_ILLEGAL_INSTRUCTION: #ifdef FPE