Lines Matching refs:regs
58 static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
60 unsigned long addr = instruction_pointer(regs);
64 if (user_mode(regs))
93 static int __die(const char *str, long err, struct pt_regs *regs)
102 ret = notify_die(DIE_OOPS, str, regs, err, 0, SIGSEGV);
107 show_regs(regs);
109 dump_kernel_instr(KERN_EMERG, regs);
119 void die(const char *str, struct pt_regs *regs, long err)
130 ret = __die(str, err, regs);
132 if (regs && kexec_should_crash(current))
133 crash_kexec(regs);
156 struct pt_regs *regs = task_pt_regs(tsk);
169 print_vma_addr(KERN_CONT " in ", regs->pc);
171 __show_regs(regs);
198 void arm64_notify_die(const char *str, struct pt_regs *regs,
202 if (user_mode(regs)) {
203 WARN_ON(regs != current_pt_regs());
209 die(str, regs, err);
219 static u32 compat_get_it_state(struct pt_regs *regs)
221 u32 it, pstate = regs->pstate;
229 static void compat_set_it_state(struct pt_regs *regs, u32 it)
236 regs->pstate &= ~PSR_AA32_IT_MASK;
237 regs->pstate |= pstate_it;
240 static void advance_itstate(struct pt_regs *regs)
245 if (!(regs->pstate & PSR_AA32_T_BIT) ||
246 !(regs->pstate & PSR_AA32_IT_MASK))
249 it = compat_get_it_state(regs);
260 compat_set_it_state(regs, it);
263 static void advance_itstate(struct pt_regs *regs)
268 void arm64_skip_faulting_instruction(struct pt_regs *regs, unsigned long size)
270 regs->pc += size;
276 if (user_mode(regs))
279 if (compat_user_mode(regs))
280 advance_itstate(regs);
282 regs->pstate &= ~PSR_BTYPE_MASK;
285 static int user_insn_read(struct pt_regs *regs, u32 *insnp)
288 void __user *pc = (void __user *)instruction_pointer(regs);
290 if (compat_thumb_mode(regs)) {
319 struct pt_regs *regs = current_pt_regs();
321 if (WARN_ON(!user_mode(regs)))
342 arm64_notify_die(desc, regs, signal, code, (void __user *)address, err);
362 void do_el0_undef(struct pt_regs *regs, unsigned long esr)
367 if (!aarch32_break_handler(regs))
370 if (user_insn_read(regs, &insn))
373 if (try_emulate_mrs(regs, insn))
376 if (try_emulate_armv8_deprecated(regs, insn))
380 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
383 void do_el1_undef(struct pt_regs *regs, unsigned long esr)
387 if (aarch64_insn_read((void *)regs->pc, &insn))
390 if (try_emulate_el1_ssbs(regs, insn))
394 die("Oops - Undefined instruction", regs, esr);
397 void do_el0_bti(struct pt_regs *regs)
399 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
402 void do_el1_bti(struct pt_regs *regs, unsigned long esr)
404 die("Oops - BTI", regs, esr);
407 void do_el0_fpac(struct pt_regs *regs, unsigned long esr)
409 force_signal_inject(SIGILL, ILL_ILLOPN, regs->pc, esr);
412 void do_el1_fpac(struct pt_regs *regs, unsigned long esr)
418 die("Oops - FPAC", regs, esr);
441 static void user_cache_maint_handler(unsigned int esr, struct pt_regs *regs)
448 address = untagged_addr(pt_regs_read_reg(regs, rt));
470 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
477 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
480 static void ctr_read_handler(unsigned int esr, struct pt_regs *regs)
494 pt_regs_write_reg(regs, rt, val);
496 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
499 static void cntvct_read_handler(unsigned int esr, struct pt_regs *regs)
503 pt_regs_write_reg(regs, rt, arch_timer_read_counter());
504 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
507 static void cntfrq_read_handler(unsigned int esr, struct pt_regs *regs)
511 pt_regs_write_reg(regs, rt, arch_timer_get_rate());
512 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
515 static void mrs_handler(unsigned int esr, struct pt_regs *regs)
522 if (do_emulate_mrs(regs, sysreg, rt) != 0)
523 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
526 static void wfi_handler(unsigned int esr, struct pt_regs *regs)
528 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
534 void (*handler)(unsigned int esr, struct pt_regs *regs);
577 static bool cp15_cond_valid(unsigned int esr, struct pt_regs *regs)
585 it = compat_get_it_state(regs);
594 return aarch32_opcode_cond_checks[cond](regs->pstate);
597 static void compat_cntfrq_read_handler(unsigned int esr, struct pt_regs *regs)
601 pt_regs_write_reg(regs, reg, arch_timer_get_rate());
602 arm64_skip_faulting_instruction(regs, 4);
614 static void compat_cntvct_read_handler(unsigned int esr, struct pt_regs *regs)
620 pt_regs_write_reg(regs, rt, lower_32_bits(val));
621 pt_regs_write_reg(regs, rt2, upper_32_bits(val));
622 arm64_skip_faulting_instruction(regs, 4);
634 void do_el0_cp15(unsigned long esr, struct pt_regs *regs)
638 if (!cp15_cond_valid(esr, regs)) {
643 arm64_skip_faulting_instruction(regs, 4);
655 do_el0_undef(regs, esr);
661 hook->handler(esr, regs);
670 do_el0_undef(regs, esr);
674 void do_el0_sys(unsigned long esr, struct pt_regs *regs)
680 hook->handler(esr, regs);
689 do_el0_undef(regs, esr);
746 asmlinkage void notrace bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
748 arm64_enter_nmi(regs);
756 __show_regs(regs);
765 void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr)
767 void __user *pc = (void __user *)instruction_pointer(regs);
781 asmlinkage void noinstr handle_bad_stack(struct pt_regs *regs)
789 arm64_enter_nmi(regs);
804 __show_regs(regs);
815 void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)
821 if (regs)
822 __show_regs(regs);
824 nmi_panic(regs, "Asynchronous SError Interrupt");
830 bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr)
858 arm64_serror_panic(regs, esr);
862 asmlinkage void noinstr do_serror(struct pt_regs *regs, unsigned int esr)
864 arm64_enter_nmi(regs);
867 if (!arm64_is_ras_serror(esr) || arm64_is_fatal_ras_serror(regs, esr))
868 arm64_serror_panic(regs, esr);
870 arm64_exit_nmi(regs);
887 static int bug_handler(struct pt_regs *regs, unsigned int esr)
889 switch (report_bug(regs->pc, regs)) {
891 die("Oops - BUG", regs, esr);
903 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
912 static int reserved_fault_handler(struct pt_regs *regs, unsigned int esr)
915 in_bpf_jit(regs) ? "BPF JIT" : "Kernel text patching",
916 (void *)instruction_pointer(regs));
934 static int kasan_handler(struct pt_regs *regs, unsigned int esr)
939 u64 addr = regs->regs[0];
940 u64 pc = regs->pc;
959 die("Oops - KASAN", regs, esr);
962 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
978 struct pt_regs *regs)
984 return kasan_handler(regs, esr) != DBG_HOOK_HANDLED;
986 return bug_handler(regs, esr) != DBG_HOOK_HANDLED;