Lines Matching refs:regs

152 static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
154 unsigned long addr = instruction_pointer(regs);
158 if (user_mode(regs))
185 static int __die(const char *str, long err, struct pt_regs *regs)
194 ret = notify_die(DIE_OOPS, str, regs, err, 0, SIGSEGV);
199 show_regs(regs);
201 dump_kernel_instr(KERN_EMERG, regs);
211 void die(const char *str, struct pt_regs *regs, long err)
222 ret = __die(str, err, regs);
224 if (regs && kexec_should_crash(current))
225 crash_kexec(regs);
248 struct pt_regs *regs = task_pt_regs(tsk);
261 print_vma_addr(KERN_CONT " in ", regs->pc);
263 __show_regs(regs);
290 void arm64_notify_die(const char *str, struct pt_regs *regs,
294 if (user_mode(regs)) {
295 WARN_ON(regs != current_pt_regs());
301 die(str, regs, err);
311 static u32 compat_get_it_state(struct pt_regs *regs)
313 u32 it, pstate = regs->pstate;
321 static void compat_set_it_state(struct pt_regs *regs, u32 it)
328 regs->pstate &= ~PSR_AA32_IT_MASK;
329 regs->pstate |= pstate_it;
332 static void advance_itstate(struct pt_regs *regs)
337 if (!(regs->pstate & PSR_AA32_T_BIT) ||
338 !(regs->pstate & PSR_AA32_IT_MASK))
341 it = compat_get_it_state(regs);
352 compat_set_it_state(regs, it);
355 static void advance_itstate(struct pt_regs *regs)
360 void arm64_skip_faulting_instruction(struct pt_regs *regs, unsigned long size)
362 regs->pc += size;
368 if (user_mode(regs))
371 if (compat_user_mode(regs))
372 advance_itstate(regs);
374 regs->pstate &= ~PSR_BTYPE_MASK;
377 static int user_insn_read(struct pt_regs *regs, u32 *insnp)
380 unsigned long pc = instruction_pointer(regs);
382 if (compat_thumb_mode(regs)) {
411 struct pt_regs *regs = current_pt_regs();
413 if (WARN_ON(!user_mode(regs)))
434 arm64_notify_die(desc, regs, signal, code, address, err);
454 void do_el0_undef(struct pt_regs *regs, unsigned long esr)
459 if (!aarch32_break_handler(regs))
462 if (user_insn_read(regs, &insn))
465 if (try_emulate_mrs(regs, insn))
468 if (try_emulate_armv8_deprecated(regs, insn))
472 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
475 void do_el1_undef(struct pt_regs *regs, unsigned long esr)
479 if (aarch64_insn_read((void *)regs->pc, &insn))
482 if (try_emulate_el1_ssbs(regs, insn))
486 die("Oops - Undefined instruction", regs, esr);
489 void do_el0_bti(struct pt_regs *regs)
491 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
494 void do_el1_bti(struct pt_regs *regs, unsigned long esr)
496 if (efi_runtime_fixup_exception(regs, "BTI violation")) {
497 regs->pstate &= ~PSR_BTYPE_MASK;
500 die("Oops - BTI", regs, esr);
503 void do_el0_fpac(struct pt_regs *regs, unsigned long esr)
505 force_signal_inject(SIGILL, ILL_ILLOPN, regs->pc, esr);
508 void do_el1_fpac(struct pt_regs *regs, unsigned long esr)
514 die("Oops - FPAC", regs, esr);
517 void do_el0_mops(struct pt_regs *regs, unsigned long esr)
519 arm64_mops_reset_regs(&regs->user_regs, esr);
543 static void user_cache_maint_handler(unsigned long esr, struct pt_regs *regs)
550 tagged_address = pt_regs_read_reg(regs, rt);
573 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
580 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
583 static void ctr_read_handler(unsigned long esr, struct pt_regs *regs)
597 pt_regs_write_reg(regs, rt, val);
599 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
602 static void cntvct_read_handler(unsigned long esr, struct pt_regs *regs)
606 pt_regs_write_reg(regs, rt, arch_timer_read_counter());
607 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
610 static void cntfrq_read_handler(unsigned long esr, struct pt_regs *regs)
614 pt_regs_write_reg(regs, rt, arch_timer_get_rate());
615 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
618 static void mrs_handler(unsigned long esr, struct pt_regs *regs)
625 if (do_emulate_mrs(regs, sysreg, rt) != 0)
626 force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
629 static void wfi_handler(unsigned long esr, struct pt_regs *regs)
631 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
637 void (*handler)(unsigned long esr, struct pt_regs *regs);
686 static bool cp15_cond_valid(unsigned long esr, struct pt_regs *regs)
694 it = compat_get_it_state(regs);
703 return aarch32_opcode_cond_checks[cond](regs->pstate);
706 static void compat_cntfrq_read_handler(unsigned long esr, struct pt_regs *regs)
710 pt_regs_write_reg(regs, reg, arch_timer_get_rate());
711 arm64_skip_faulting_instruction(regs, 4);
723 static void compat_cntvct_read_handler(unsigned long esr, struct pt_regs *regs)
729 pt_regs_write_reg(regs, rt, lower_32_bits(val));
730 pt_regs_write_reg(regs, rt2, upper_32_bits(val));
731 arm64_skip_faulting_instruction(regs, 4);
748 void do_el0_cp15(unsigned long esr, struct pt_regs *regs)
752 if (!cp15_cond_valid(esr, regs)) {
757 arm64_skip_faulting_instruction(regs, 4);
769 do_el0_undef(regs, esr);
775 hook->handler(esr, regs);
784 do_el0_undef(regs, esr);
788 void do_el0_sys(unsigned long esr, struct pt_regs *regs)
794 hook->handler(esr, regs);
803 do_el0_undef(regs, esr);
862 void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr)
864 unsigned long pc = instruction_pointer(regs);
878 void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
897 __show_regs(regs);
908 void __noreturn arm64_serror_panic(struct pt_regs *regs, unsigned long esr)
914 if (regs)
915 __show_regs(regs);
917 nmi_panic(regs, "Asynchronous SError Interrupt");
922 bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr)
950 arm64_serror_panic(regs, esr);
954 void do_serror(struct pt_regs *regs, unsigned long esr)
957 if (!arm64_is_ras_serror(esr) || arm64_is_fatal_ras_serror(regs, esr))
958 arm64_serror_panic(regs, esr);
976 static int bug_handler(struct pt_regs *regs, unsigned long esr)
978 switch (report_bug(regs->pc, regs)) {
980 die("Oops - BUG", regs, esr);
992 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
1002 static int cfi_handler(struct pt_regs *regs, unsigned long esr)
1007 target = pt_regs_read_reg(regs, FIELD_GET(CFI_BRK_IMM_TARGET, esr));
1008 type = (u32)pt_regs_read_reg(regs, FIELD_GET(CFI_BRK_IMM_TYPE, esr));
1010 switch (report_cfi_failure(regs, regs->pc, &target, type)) {
1012 die("Oops - CFI", regs, esr);
1022 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
1033 static int reserved_fault_handler(struct pt_regs *regs, unsigned long esr)
1037 (void *)instruction_pointer(regs));
1055 static int kasan_handler(struct pt_regs *regs, unsigned long esr)
1060 void *addr = (void *)regs->regs[0];
1061 u64 pc = regs->pc;
1080 die("Oops - KASAN", regs, esr);
1083 arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
1095 static int ubsan_handler(struct pt_regs *regs, unsigned long esr)
1097 die(report_ubsan_failure(regs, esr & UBSAN_BRK_MASK), regs, esr);
1115 struct pt_regs *regs)
1119 return cfi_handler(regs, esr) != DBG_HOOK_HANDLED;
1123 return kasan_handler(regs, esr) != DBG_HOOK_HANDLED;
1127 return ubsan_handler(regs, esr) != DBG_HOOK_HANDLED;
1129 return bug_handler(regs, esr) != DBG_HOOK_HANDLED;