Lines Matching refs:regs
64 int (*__debugger)(struct pt_regs *regs) __read_mostly;
65 int (*__debugger_ipi)(struct pt_regs *regs) __read_mostly;
66 int (*__debugger_bpt)(struct pt_regs *regs) __read_mostly;
67 int (*__debugger_sstep)(struct pt_regs *regs) __read_mostly;
68 int (*__debugger_iabr_match)(struct pt_regs *regs) __read_mostly;
69 int (*__debugger_dabr_match)(struct pt_regs *regs) __read_mostly;
70 int (*__debugger_fault_handler)(struct pt_regs *regs) __read_mostly;
108 static unsigned __kprobes long oops_begin(struct pt_regs *regs) in oops_begin() argument
113 if (debugger(regs)) in oops_begin()
136 static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, in oops_end() argument
150 crash_fadump(regs, "die oops"); in oops_end()
156 if (kexec_should_crash(current) || (TRAP(regs) == 0x100)) { in oops_end()
157 crash_kexec(regs); in oops_end()
164 crash_kexec_secondary(regs); in oops_end()
188 static int __kprobes __die(const char *str, struct pt_regs *regs, long err) in __die() argument
205 if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) == NOTIFY_STOP) in __die()
209 show_regs(regs); in __die()
214 void die(const char *str, struct pt_regs *regs, long err) in die() argument
216 unsigned long flags = oops_begin(regs); in die()
218 if (__die(str, regs, err)) in die()
220 oops_end(flags, regs, err); in die()
224 struct pt_regs *regs, siginfo_t *info) in user_single_step_siginfo() argument
229 info->si_addr = (void __user *)regs->nip; in user_single_step_siginfo()
232 void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) in _exception() argument
240 if (!user_mode(regs)) { in _exception()
241 die("Exception in kernel mode", regs, signr); in _exception()
246 printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, in _exception()
248 addr, regs->nip, regs->link, code); in _exception()
251 if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) in _exception()
262 void system_reset_exception(struct pt_regs *regs) in system_reset_exception() argument
266 if (ppc_md.system_reset_exception(regs)) in system_reset_exception()
270 die("System Reset", regs, SIGABRT); in system_reset_exception()
273 if (!(regs->msr & MSR_RI)) in system_reset_exception()
290 static inline int check_io_access(struct pt_regs *regs) in check_io_access() argument
293 unsigned long msr = regs->msr; in check_io_access()
295 unsigned int *nip = (unsigned int *)regs->nip; in check_io_access()
298 && (entry = search_exception_tables(regs->nip)) != NULL) { in check_io_access()
319 regs->gpr[rb] - _IO_BASE, nip); in check_io_access()
320 regs->msr |= MSR_RI; in check_io_access()
321 regs->nip = entry->fixup; in check_io_access()
332 #define get_reason(regs) ((regs)->dsisr) argument
334 #define get_mc_reason(regs) ((regs)->dsisr) argument
336 #define get_mc_reason(regs) (mfspr(SPRN_MCSR)) argument
344 #define single_stepping(regs) (current->thread.dbcr0 & DBCR0_IC) argument
345 #define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC) argument
350 #define get_reason(regs) ((regs)->msr) argument
351 #define get_mc_reason(regs) ((regs)->msr) argument
357 #define single_stepping(regs) ((regs)->msr & MSR_SE) argument
358 #define clear_single_step(regs) ((regs)->msr &= ~MSR_SE) argument
362 int machine_check_4xx(struct pt_regs *regs) in machine_check_4xx() argument
364 unsigned long reason = get_mc_reason(regs); in machine_check_4xx()
376 int machine_check_440A(struct pt_regs *regs) in machine_check_440A() argument
378 unsigned long reason = get_mc_reason(regs); in machine_check_440A()
412 int machine_check_47x(struct pt_regs *regs) in machine_check_47x() argument
414 unsigned long reason = get_mc_reason(regs); in machine_check_47x()
452 int machine_check_e500mc(struct pt_regs *regs) in machine_check_e500mc() argument
459 recoverable = fsl_rio_mcheck_exception(regs); in machine_check_e500mc()
551 int machine_check_e500(struct pt_regs *regs) in machine_check_e500() argument
553 unsigned long reason = get_mc_reason(regs); in machine_check_e500()
556 if (fsl_rio_mcheck_exception(regs)) in machine_check_e500()
591 int machine_check_generic(struct pt_regs *regs) in machine_check_generic() argument
596 int machine_check_e200(struct pt_regs *regs) in machine_check_e200() argument
598 unsigned long reason = get_mc_reason(regs); in machine_check_e200()
621 int machine_check_generic(struct pt_regs *regs) in machine_check_generic() argument
623 unsigned long reason = get_mc_reason(regs); in machine_check_generic()
658 void machine_check_exception(struct pt_regs *regs) in machine_check_exception() argument
671 recover = ppc_md.machine_check_exception(regs); in machine_check_exception()
673 recover = cur_cpu_spec->machine_check(regs); in machine_check_exception()
685 bad_page_fault(regs, regs->dar, SIGBUS); in machine_check_exception()
689 if (debugger_fault_handler(regs)) in machine_check_exception()
692 if (check_io_access(regs)) in machine_check_exception()
695 die("Machine check", regs, SIGBUS); in machine_check_exception()
698 if (!(regs->msr & MSR_RI)) in machine_check_exception()
702 void SMIException(struct pt_regs *regs) in SMIException() argument
704 die("System Management Interrupt", regs, SIGABRT); in SMIException()
707 void unknown_exception(struct pt_regs *regs) in unknown_exception() argument
710 regs->nip, regs->msr, regs->trap); in unknown_exception()
712 _exception(SIGTRAP, regs, 0, 0); in unknown_exception()
715 void instruction_breakpoint_exception(struct pt_regs *regs) in instruction_breakpoint_exception() argument
717 if (notify_die(DIE_IABR_MATCH, "iabr_match", regs, 5, in instruction_breakpoint_exception()
720 if (debugger_iabr_match(regs)) in instruction_breakpoint_exception()
722 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); in instruction_breakpoint_exception()
725 void RunModeException(struct pt_regs *regs) in RunModeException() argument
727 _exception(SIGTRAP, regs, 0, 0); in RunModeException()
730 void __kprobes single_step_exception(struct pt_regs *regs) in single_step_exception() argument
732 clear_single_step(regs); in single_step_exception()
734 if (notify_die(DIE_SSTEP, "single_step", regs, 5, in single_step_exception()
737 if (debugger_sstep(regs)) in single_step_exception()
740 _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); in single_step_exception()
749 static void emulate_single_step(struct pt_regs *regs) in emulate_single_step() argument
751 if (single_stepping(regs)) in emulate_single_step()
752 single_step_exception(regs); in emulate_single_step()
782 static void parse_fpe(struct pt_regs *regs) in parse_fpe() argument
790 _exception(SIGFPE, regs, code, regs->nip); in parse_fpe()
804 static int emulate_string_inst(struct pt_regs *regs, u32 instword) in emulate_string_inst() argument
818 EA = (rA == 0) ? 0 : regs->gpr[rA]; in emulate_string_inst()
824 num_bytes = regs->xer & 0x7f; in emulate_string_inst()
847 regs->gpr[rT] = 0; in emulate_string_inst()
848 regs->gpr[rT] |= val << shift; in emulate_string_inst()
852 val = regs->gpr[rT] >> shift; in emulate_string_inst()
872 static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword) in emulate_popcntb_inst() argument
880 tmp = regs->gpr[rs]; in emulate_popcntb_inst()
884 regs->gpr[ra] = tmp; in emulate_popcntb_inst()
889 static int emulate_isel(struct pt_regs *regs, u32 instword) in emulate_isel() argument
898 tmp = (rA == 0) ? 0 : regs->gpr[rA]; in emulate_isel()
899 bit = (regs->ccr >> (31 - BC)) & 0x1; in emulate_isel()
901 regs->gpr[rT] = bit ? tmp : regs->gpr[rB]; in emulate_isel()
906 static int emulate_instruction(struct pt_regs *regs) in emulate_instruction() argument
911 if (!user_mode(regs) || (regs->msr & MSR_LE)) in emulate_instruction()
913 CHECK_FULL_REGS(regs); in emulate_instruction()
915 if (get_user(instword, (u32 __user *)(regs->nip))) in emulate_instruction()
920 PPC_WARN_EMULATED(mfpvr, regs); in emulate_instruction()
922 regs->gpr[rd] = mfspr(SPRN_PVR); in emulate_instruction()
928 PPC_WARN_EMULATED(dcba, regs); in emulate_instruction()
937 PPC_WARN_EMULATED(mcrxr, regs); in emulate_instruction()
938 regs->ccr = (regs->ccr & ~msk) | ((regs->xer >> shift) & msk); in emulate_instruction()
939 regs->xer &= ~0xf0000000UL; in emulate_instruction()
945 PPC_WARN_EMULATED(string, regs); in emulate_instruction()
946 return emulate_string_inst(regs, instword); in emulate_instruction()
951 PPC_WARN_EMULATED(popcntb, regs); in emulate_instruction()
952 return emulate_popcntb_inst(regs, instword); in emulate_instruction()
957 PPC_WARN_EMULATED(isel, regs); in emulate_instruction()
958 return emulate_isel(regs, instword); in emulate_instruction()
968 PPC_WARN_EMULATED(mfdscr, regs); in emulate_instruction()
970 regs->gpr[rd] = mfspr(SPRN_DSCR); in emulate_instruction()
979 PPC_WARN_EMULATED(mtdscr, regs); in emulate_instruction()
981 current->thread.dscr = regs->gpr[rd]; in emulate_instruction()
996 void __kprobes program_check_exception(struct pt_regs *regs) in program_check_exception() argument
998 unsigned int reason = get_reason(regs); in program_check_exception()
999 extern int do_mathemu(struct pt_regs *regs); in program_check_exception()
1006 parse_fpe(regs); in program_check_exception()
1012 if (debugger_bpt(regs)) in program_check_exception()
1016 if (notify_die(DIE_BPT, "breakpoint", regs, 5, 5, SIGTRAP) in program_check_exception()
1020 if (!(regs->msr & MSR_PR) && /* not user-mode */ in program_check_exception()
1021 report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) { in program_check_exception()
1022 regs->nip += 4; in program_check_exception()
1025 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); in program_check_exception()
1030 if (!arch_irq_disabled_regs(regs)) in program_check_exception()
1041 switch (do_mathemu(regs)) { in program_check_exception()
1043 emulate_single_step(regs); in program_check_exception()
1048 _exception(SIGFPE, regs, code, regs->nip); in program_check_exception()
1052 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); in program_check_exception()
1060 switch (emulate_instruction(regs)) { in program_check_exception()
1062 regs->nip += 4; in program_check_exception()
1063 emulate_single_step(regs); in program_check_exception()
1066 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); in program_check_exception()
1072 _exception(SIGILL, regs, ILL_PRVOPC, regs->nip); in program_check_exception()
1074 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in program_check_exception()
1077 void alignment_exception(struct pt_regs *regs) in alignment_exception() argument
1082 if (!arch_irq_disabled_regs(regs)) in alignment_exception()
1087 fixed = fix_alignment(regs); in alignment_exception()
1090 regs->nip += 4; /* skip over emulated instruction */ in alignment_exception()
1091 emulate_single_step(regs); in alignment_exception()
1103 if (user_mode(regs)) in alignment_exception()
1104 _exception(sig, regs, code, regs->dar); in alignment_exception()
1106 bad_page_fault(regs, regs->dar, sig); in alignment_exception()
1109 void StackOverflow(struct pt_regs *regs) in StackOverflow() argument
1112 current, regs->gpr[1]); in StackOverflow()
1113 debugger(regs); in StackOverflow()
1114 show_regs(regs); in StackOverflow()
1118 void nonrecoverable_exception(struct pt_regs *regs) in nonrecoverable_exception() argument
1121 regs->nip, regs->msr); in nonrecoverable_exception()
1122 debugger(regs); in nonrecoverable_exception()
1123 die("nonrecoverable exception", regs, SIGKILL); in nonrecoverable_exception()
1126 void trace_syscall(struct pt_regs *regs) in trace_syscall() argument
1129 current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0], in trace_syscall()
1130 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); in trace_syscall()
1133 void kernel_fp_unavailable_exception(struct pt_regs *regs) in kernel_fp_unavailable_exception() argument
1136 "%lx at %lx\n", regs->trap, regs->nip); in kernel_fp_unavailable_exception()
1137 die("Unrecoverable FP Unavailable Exception", regs, SIGABRT); in kernel_fp_unavailable_exception()
1140 void altivec_unavailable_exception(struct pt_regs *regs) in altivec_unavailable_exception() argument
1142 if (user_mode(regs)) { in altivec_unavailable_exception()
1145 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in altivec_unavailable_exception()
1150 "%lx at %lx\n", regs->trap, regs->nip); in altivec_unavailable_exception()
1151 die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); in altivec_unavailable_exception()
1154 void vsx_unavailable_exception(struct pt_regs *regs) in vsx_unavailable_exception() argument
1156 if (user_mode(regs)) { in vsx_unavailable_exception()
1159 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in vsx_unavailable_exception()
1164 "%lx at %lx\n", regs->trap, regs->nip); in vsx_unavailable_exception()
1165 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); in vsx_unavailable_exception()
1168 void performance_monitor_exception(struct pt_regs *regs) in performance_monitor_exception() argument
1172 perf_irq(regs); in performance_monitor_exception()
1176 void SoftwareEmulation(struct pt_regs *regs) in SoftwareEmulation() argument
1184 CHECK_FULL_REGS(regs); in SoftwareEmulation()
1186 if (!user_mode(regs)) { in SoftwareEmulation()
1187 debugger(regs); in SoftwareEmulation()
1188 die("Kernel Mode Software FPU Emulation", regs, SIGFPE); in SoftwareEmulation()
1192 errcode = do_mathemu(regs); in SoftwareEmulation()
1194 PPC_WARN_EMULATED(math, regs); in SoftwareEmulation()
1198 emulate_single_step(regs); in SoftwareEmulation()
1203 _exception(SIGFPE, regs, code, regs->nip); in SoftwareEmulation()
1207 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); in SoftwareEmulation()
1210 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in SoftwareEmulation()
1215 errcode = Soft_emulate_8xx(regs); in SoftwareEmulation()
1217 PPC_WARN_EMULATED(8xx, regs); in SoftwareEmulation()
1221 emulate_single_step(regs); in SoftwareEmulation()
1224 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in SoftwareEmulation()
1227 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); in SoftwareEmulation()
1231 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in SoftwareEmulation()
1237 static void handle_debug(struct pt_regs *regs, unsigned long debug_status) in handle_debug() argument
1249 do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, in handle_debug()
1254 do_send_trap(regs, mfspr(SPRN_DAC2), debug_status, TRAP_HWBKPT, in handle_debug()
1260 do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, in handle_debug()
1265 do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, in handle_debug()
1271 do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, in handle_debug()
1276 do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, in handle_debug()
1286 regs->msr |= MSR_DE; in handle_debug()
1295 void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) in DebugException() argument
1305 regs->msr &= ~MSR_DE; in DebugException()
1313 if (user_mode(regs)) { in DebugException()
1316 regs->msr |= MSR_DE; in DebugException()
1320 if (notify_die(DIE_SSTEP, "block_step", regs, 5, in DebugException()
1324 if (debugger_sstep(regs)) in DebugException()
1327 regs->msr &= ~MSR_DE; in DebugException()
1334 if (notify_die(DIE_SSTEP, "single_step", regs, 5, in DebugException()
1339 if (debugger_sstep(regs)) in DebugException()
1342 if (user_mode(regs)) { in DebugException()
1346 regs->msr |= MSR_DE; in DebugException()
1352 _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); in DebugException()
1354 handle_debug(regs, debug_status); in DebugException()
1359 void TAUException(struct pt_regs *regs) in TAUException() argument
1362 regs->nip, regs->msr, regs->trap, print_tainted()); in TAUException()
1367 void altivec_assist_exception(struct pt_regs *regs) in altivec_assist_exception() argument
1371 if (!user_mode(regs)) { in altivec_assist_exception()
1373 " at %lx\n", regs->nip); in altivec_assist_exception()
1374 die("Kernel VMX/Altivec assist exception", regs, SIGILL); in altivec_assist_exception()
1379 PPC_WARN_EMULATED(altivec, regs); in altivec_assist_exception()
1380 err = emulate_altivec(regs); in altivec_assist_exception()
1382 regs->nip += 4; /* skip emulated instruction */ in altivec_assist_exception()
1383 emulate_single_step(regs); in altivec_assist_exception()
1389 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip); in altivec_assist_exception()
1394 "in %s at %lx\n", current->comm, regs->nip); in altivec_assist_exception()
1401 void vsx_assist_exception(struct pt_regs *regs) in vsx_assist_exception() argument
1403 if (!user_mode(regs)) { in vsx_assist_exception()
1405 " at %lx\n", regs->nip); in vsx_assist_exception()
1406 die("Kernel VSX assist exception", regs, SIGILL); in vsx_assist_exception()
1410 printk(KERN_INFO "VSX assist not supported at %lx\n", regs->nip); in vsx_assist_exception()
1411 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); in vsx_assist_exception()
1416 void CacheLockingException(struct pt_regs *regs, unsigned long address, in CacheLockingException() argument
1424 _exception(SIGILL, regs, ILL_PRVOPC, regs->nip); in CacheLockingException()
1430 void SPEFloatingPointException(struct pt_regs *regs) in SPEFloatingPointException() argument
1432 extern int do_spe_mathemu(struct pt_regs *regs); in SPEFloatingPointException()
1457 err = do_spe_mathemu(regs); in SPEFloatingPointException()
1459 regs->nip += 4; /* skip emulated instruction */ in SPEFloatingPointException()
1460 emulate_single_step(regs); in SPEFloatingPointException()
1466 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip); in SPEFloatingPointException()
1470 "in %s at %lx\n", current->comm, regs->nip); in SPEFloatingPointException()
1472 _exception(SIGFPE, regs, code, regs->nip); in SPEFloatingPointException()
1478 void SPEFloatingPointRoundException(struct pt_regs *regs) in SPEFloatingPointRoundException() argument
1480 extern int speround_handler(struct pt_regs *regs); in SPEFloatingPointRoundException()
1484 if (regs->msr & MSR_SPE) in SPEFloatingPointRoundException()
1488 regs->nip -= 4; in SPEFloatingPointRoundException()
1489 err = speround_handler(regs); in SPEFloatingPointRoundException()
1491 regs->nip += 4; /* skip emulated instruction */ in SPEFloatingPointRoundException()
1492 emulate_single_step(regs); in SPEFloatingPointRoundException()
1498 _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip); in SPEFloatingPointRoundException()
1502 "in %s at %lx\n", current->comm, regs->nip); in SPEFloatingPointRoundException()
1504 _exception(SIGFPE, regs, 0, regs->nip); in SPEFloatingPointRoundException()
1516 void unrecoverable_exception(struct pt_regs *regs) in unrecoverable_exception() argument
1519 regs->trap, regs->nip); in unrecoverable_exception()
1520 die("Unrecoverable exception", regs, SIGABRT); in unrecoverable_exception()
1528 void __attribute__ ((weak)) WatchdogHandler(struct pt_regs *regs) in WatchdogHandler() argument
1535 void WatchdogException(struct pt_regs *regs) in WatchdogException() argument
1538 WatchdogHandler(regs); in WatchdogException()
1546 void kernel_bad_stack(struct pt_regs *regs) in kernel_bad_stack() argument
1549 regs->gpr[1], regs->nip); in kernel_bad_stack()
1550 die("Bad kernel stack pointer", regs, SIGABRT); in kernel_bad_stack()