Message ID | 20230718162940.226118-1-CoelacanthusHex@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] riscv: entry: set a0 prior to syscall_enter_from_user_mode | expand |
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index f910dfccbf5d2..ccadb5ffd063c 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -301,6 +301,7 @@ asmlinkage __visible __trap_section void do_trap_ecall_u(struct pt_regs *regs) regs->epc += 4; regs->orig_a0 = regs->a0; + regs->a0 = -ENOSYS; riscv_v_vstate_discard(regs); @@ -308,8 +309,6 @@ asmlinkage __visible __trap_section void do_trap_ecall_u(struct pt_regs *regs) if (syscall < NR_syscalls) syscall_handler(regs, syscall); - else - regs->a0 = -ENOSYS; syscall_exit_to_user_mode(regs); } else {