Lines Matching full:regs

39 static void dump_kernel_instr(const char *loglvl, struct pt_regs *regs)  in dump_kernel_instr()  argument
42 const u16 *insns = (u16 *)instruction_pointer(regs); in dump_kernel_instr()
60 void die(struct pt_regs *regs, const char *str) in die() argument
75 if (regs) { in die()
76 show_regs(regs); in die()
77 dump_kernel_instr(KERN_EMERG, regs); in die()
80 cause = regs ? regs->cause : -1; in die()
81 ret = notify_die(DIE_OOPS, str, regs, 0, cause, SIGSEGV); in die()
84 crash_kexec(regs); in die()
99 void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr) in do_trap() argument
107 print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); in do_trap()
109 __show_regs(regs); in do_trap()
115 static void do_trap_error(struct pt_regs *regs, int signo, int code, in do_trap_error() argument
118 current->thread.bad_cause = regs->cause; in do_trap_error()
120 if (user_mode(regs)) { in do_trap_error()
121 do_trap(regs, signo, code, addr); in do_trap_error()
123 if (!fixup_exception(regs)) in do_trap_error()
124 die(regs, str); in do_trap_error()
134 asmlinkage __visible __trap_section void name(struct pt_regs *regs) \
136 if (user_mode(regs)) { \
137 irqentry_enter_from_user_mode(regs); \
138 do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
139 irqentry_exit_to_user_mode(regs); \
141 irqentry_state_t state = irqentry_nmi_enter(regs); \
142 do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
143 irqentry_nmi_exit(regs, state); \
154 asmlinkage __visible __trap_section void do_trap_insn_illegal(struct pt_regs *regs) in do_trap_insn_illegal() argument
158 if (user_mode(regs)) { in do_trap_insn_illegal()
159 irqentry_enter_from_user_mode(regs); in do_trap_insn_illegal()
163 handled = riscv_v_first_use_handler(regs); in do_trap_insn_illegal()
168 do_trap_error(regs, SIGILL, ILL_ILLOPC, regs->epc, in do_trap_insn_illegal()
171 irqentry_exit_to_user_mode(regs); in do_trap_insn_illegal()
173 irqentry_state_t state = irqentry_nmi_enter(regs); in do_trap_insn_illegal()
175 do_trap_error(regs, SIGILL, ILL_ILLOPC, regs->epc, in do_trap_insn_illegal()
178 irqentry_nmi_exit(regs, state); in do_trap_insn_illegal()
190 int handle_misaligned_load(struct pt_regs *regs);
191 int handle_misaligned_store(struct pt_regs *regs);
193 asmlinkage __visible __trap_section void do_trap_load_misaligned(struct pt_regs *regs) in do_trap_load_misaligned() argument
195 if (user_mode(regs)) { in do_trap_load_misaligned()
196 irqentry_enter_from_user_mode(regs); in do_trap_load_misaligned()
198 if (handle_misaligned_load(regs)) in do_trap_load_misaligned()
199 do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc, in do_trap_load_misaligned()
202 irqentry_exit_to_user_mode(regs); in do_trap_load_misaligned()
204 irqentry_state_t state = irqentry_nmi_enter(regs); in do_trap_load_misaligned()
206 if (handle_misaligned_load(regs)) in do_trap_load_misaligned()
207 do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc, in do_trap_load_misaligned()
210 irqentry_nmi_exit(regs, state); in do_trap_load_misaligned()
214 asmlinkage __visible __trap_section void do_trap_store_misaligned(struct pt_regs *regs) in do_trap_store_misaligned() argument
216 if (user_mode(regs)) { in do_trap_store_misaligned()
217 irqentry_enter_from_user_mode(regs); in do_trap_store_misaligned()
219 if (handle_misaligned_store(regs)) in do_trap_store_misaligned()
220 do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc, in do_trap_store_misaligned()
223 irqentry_exit_to_user_mode(regs); in do_trap_store_misaligned()
225 irqentry_state_t state = irqentry_nmi_enter(regs); in do_trap_store_misaligned()
227 if (handle_misaligned_store(regs)) in do_trap_store_misaligned()
228 do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc, in do_trap_store_misaligned()
231 irqentry_nmi_exit(regs, state); in do_trap_store_misaligned()
252 static bool probe_single_step_handler(struct pt_regs *regs) in probe_single_step_handler() argument
254 bool user = user_mode(regs); in probe_single_step_handler()
256 return user ? uprobe_single_step_handler(regs) : kprobe_single_step_handler(regs); in probe_single_step_handler()
259 static bool probe_breakpoint_handler(struct pt_regs *regs) in probe_breakpoint_handler() argument
261 bool user = user_mode(regs); in probe_breakpoint_handler()
263 return user ? uprobe_breakpoint_handler(regs) : kprobe_breakpoint_handler(regs); in probe_breakpoint_handler()
266 void handle_break(struct pt_regs *regs) in handle_break() argument
268 if (probe_single_step_handler(regs)) in handle_break()
271 if (probe_breakpoint_handler(regs)) in handle_break()
274 current->thread.bad_cause = regs->cause; in handle_break()
276 if (user_mode(regs)) in handle_break()
277 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->epc); in handle_break()
279 else if (notify_die(DIE_TRAP, "EBREAK", regs, 0, regs->cause, SIGTRAP) in handle_break()
283 else if (report_bug(regs->epc, regs) == BUG_TRAP_TYPE_WARN || in handle_break()
284 handle_cfi_failure(regs) == BUG_TRAP_TYPE_WARN) in handle_break()
285 regs->epc += get_break_insn_length(regs->epc); in handle_break()
287 die(regs, "Kernel BUG"); in handle_break()
290 asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs) in do_trap_break() argument
292 if (user_mode(regs)) { in do_trap_break()
293 irqentry_enter_from_user_mode(regs); in do_trap_break()
295 handle_break(regs); in do_trap_break()
297 irqentry_exit_to_user_mode(regs); in do_trap_break()
299 irqentry_state_t state = irqentry_nmi_enter(regs); in do_trap_break()
301 handle_break(regs); in do_trap_break()
303 irqentry_nmi_exit(regs, state); in do_trap_break()
307 asmlinkage __visible __trap_section void do_trap_ecall_u(struct pt_regs *regs) in do_trap_ecall_u() argument
309 if (user_mode(regs)) { in do_trap_ecall_u()
310 long syscall = regs->a7; in do_trap_ecall_u()
312 regs->epc += 4; in do_trap_ecall_u()
313 regs->orig_a0 = regs->a0; in do_trap_ecall_u()
314 regs->a0 = -ENOSYS; in do_trap_ecall_u()
316 riscv_v_vstate_discard(regs); in do_trap_ecall_u()
318 syscall = syscall_enter_from_user_mode(regs, syscall); in do_trap_ecall_u()
321 syscall_handler(regs, syscall); in do_trap_ecall_u()
323 syscall_exit_to_user_mode(regs); in do_trap_ecall_u()
325 irqentry_state_t state = irqentry_nmi_enter(regs); in do_trap_ecall_u()
327 do_trap_error(regs, SIGILL, ILL_ILLTRP, regs->epc, in do_trap_ecall_u()
330 irqentry_nmi_exit(regs, state); in do_trap_ecall_u()
336 asmlinkage __visible noinstr void do_page_fault(struct pt_regs *regs) in do_page_fault() argument
338 irqentry_state_t state = irqentry_enter(regs); in do_page_fault()
340 handle_page_fault(regs); in do_page_fault()
344 irqentry_exit(regs, state); in do_page_fault()
348 static void noinstr handle_riscv_irq(struct pt_regs *regs) in handle_riscv_irq() argument
353 old_regs = set_irq_regs(regs); in handle_riscv_irq()
354 handle_arch_irq(regs); in handle_riscv_irq()
359 asmlinkage void noinstr do_irq(struct pt_regs *regs) in do_irq() argument
361 irqentry_state_t state = irqentry_enter(regs); in do_irq()
373 "move a0, %[regs] \n" in do_irq()
381 : [sp] "r" (sp), [regs] "r" (regs) in do_irq()
390 handle_riscv_irq(regs); in do_irq()
392 irqentry_exit(regs, state); in do_irq()
415 asmlinkage void handle_bad_stack(struct pt_regs *regs) in handle_bad_stack() argument
428 __show_regs(regs); in handle_bad_stack()