Index: sys/riscv/riscv/exception.S =================================================================== --- sys/riscv/riscv/exception.S +++ sys/riscv/riscv/exception.S @@ -225,7 +225,6 @@ ENTRY(cpu_exception_handler_user) save_registers 0 - mv a0, sp call _C_LABEL(do_trap_user) do_ast load_registers 0 Index: sys/riscv/riscv/trap.c =================================================================== --- sys/riscv/riscv/trap.c +++ sys/riscv/riscv/trap.c @@ -77,7 +77,7 @@ /* Called from exception.S */ void do_trap_supervisor(struct trapframe *); -void do_trap_user(struct trapframe *); +void do_trap_user(void); static __inline void call_trapsignal(struct thread *td, int sig, int code, void *addr, int trapno) @@ -314,17 +314,16 @@ } void -do_trap_user(struct trapframe *frame) +do_trap_user(void) { uint64_t exception; struct thread *td; + struct trapframe *frame; struct pcb *pcb; td = curthread; pcb = td->td_pcb; - - KASSERT(td->td_frame == frame, - ("%s: td_frame %p != frame %p", __func__, td->td_frame, frame)); + frame = td->td_frame; /* Ensure we came from usermode, interrupts disabled */ KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,