Lines Matching refs:regs

76 static inline void cond_local_irq_enable(struct pt_regs *regs)  in cond_local_irq_enable()  argument
78 if (regs->flags & X86_EFLAGS_IF) in cond_local_irq_enable()
82 static inline void cond_local_irq_disable(struct pt_regs *regs) in cond_local_irq_disable() argument
84 if (regs->flags & X86_EFLAGS_IF) in cond_local_irq_disable()
102 struct pt_regs *regs, long error_code) in do_trap_no_signal() argument
104 if (v8086_mode(regs)) { in do_trap_no_signal()
110 if (!handle_vm86_trap((struct kernel_vm86_regs *) regs, in do_trap_no_signal()
114 } else if (!user_mode(regs)) { in do_trap_no_signal()
115 if (fixup_exception(regs, trapnr, error_code, 0)) in do_trap_no_signal()
120 die(str, regs, error_code); in do_trap_no_signal()
122 if (fixup_vdso_exception(regs, trapnr, error_code, 0)) in do_trap_no_signal()
143 struct pt_regs *regs, long error_code) in show_signal() argument
149 regs->ip, regs->sp, error_code); in show_signal()
150 print_vma_addr(KERN_CONT " in ", regs->ip); in show_signal()
156 do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, in do_trap() argument
161 if (!do_trap_no_signal(tsk, trapnr, str, regs, error_code)) in do_trap()
164 show_signal(tsk, signr, "trap ", str, regs, error_code); in do_trap()
173 static void do_error_trap(struct pt_regs *regs, long error_code, char *str, in do_error_trap() argument
178 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) != in do_error_trap()
180 cond_local_irq_enable(regs); in do_error_trap()
181 do_trap(trapnr, signr, str, regs, error_code, sicode, addr); in do_error_trap()
182 cond_local_irq_disable(regs); in do_error_trap()
196 static __always_inline void __user *error_get_trap_addr(struct pt_regs *regs) in error_get_trap_addr() argument
198 return (void __user *)uprobe_get_trap_addr(regs); in error_get_trap_addr()
203 do_error_trap(regs, 0, "divide error", X86_TRAP_DE, SIGFPE, in DEFINE_IDTENTRY()
204 FPE_INTDIV, error_get_trap_addr(regs)); in DEFINE_IDTENTRY()
209 do_error_trap(regs, 0, "overflow", X86_TRAP_OF, SIGSEGV, 0, NULL); in DEFINE_IDTENTRY()
213 void handle_invalid_op(struct pt_regs *regs) in handle_invalid_op() argument
215 static inline void handle_invalid_op(struct pt_regs *regs) in handle_invalid_op()
218 do_error_trap(regs, 0, "invalid opcode", X86_TRAP_UD, SIGILL, in handle_invalid_op()
219 ILL_ILLOPN, error_get_trap_addr(regs)); in handle_invalid_op()
222 static noinstr bool handle_bug(struct pt_regs *regs) in handle_bug() argument
226 if (!is_valid_bugaddr(regs->ip)) in handle_bug()
237 if (regs->flags & X86_EFLAGS_IF) in handle_bug()
239 if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN) { in handle_bug()
240 regs->ip += LEN_UD2; in handle_bug()
243 if (regs->flags & X86_EFLAGS_IF) in handle_bug()
259 if (!user_mode(regs) && handle_bug(regs)) in DEFINE_IDTENTRY_RAW()
262 state = irqentry_enter(regs); in DEFINE_IDTENTRY_RAW()
264 handle_invalid_op(regs); in DEFINE_IDTENTRY_RAW()
266 irqentry_exit(regs, state); in DEFINE_IDTENTRY_RAW()
271 do_error_trap(regs, 0, "coprocessor segment overrun", in DEFINE_IDTENTRY()
277 do_error_trap(regs, error_code, "invalid TSS", X86_TRAP_TS, SIGSEGV, in DEFINE_IDTENTRY_ERRORCODE()
283 do_error_trap(regs, error_code, "segment not present", X86_TRAP_NP, in DEFINE_IDTENTRY_ERRORCODE()
289 do_error_trap(regs, error_code, "stack segment", X86_TRAP_SS, SIGBUS, in DEFINE_IDTENTRY_ERRORCODE()
297 if (notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_AC, SIGBUS) == NOTIFY_STOP) in DEFINE_IDTENTRY_ERRORCODE()
300 if (!user_mode(regs)) in DEFINE_IDTENTRY_ERRORCODE()
301 die("Split lock detected\n", regs, error_code); in DEFINE_IDTENTRY_ERRORCODE()
305 if (handle_user_split_lock(regs, error_code)) in DEFINE_IDTENTRY_ERRORCODE()
308 do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs, in DEFINE_IDTENTRY_ERRORCODE()
316 __visible void __noreturn handle_stack_overflow(struct pt_regs *regs, in handle_stack_overflow() argument
325 die("stack guard page", regs, 0); in handle_stack_overflow()
378 if (((long)regs->sp >> P4D_SHIFT) == ESPFIX_PGD_ENTRY && in DEFINE_IDTENTRY_DF()
379 regs->cs == __KERNEL_CS && in DEFINE_IDTENTRY_DF()
380 regs->ip == (unsigned long)native_irq_return_iret) in DEFINE_IDTENTRY_DF()
383 unsigned long *p = (unsigned long *)regs->sp; in DEFINE_IDTENTRY_DF()
409 regs->ip = (unsigned long)asm_exc_general_protection; in DEFINE_IDTENTRY_DF()
410 regs->sp = (unsigned long)&gpregs->orig_ax; in DEFINE_IDTENTRY_DF()
416 irqentry_nmi_enter(regs); in DEFINE_IDTENTRY_DF()
418 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); in DEFINE_IDTENTRY_DF()
462 handle_stack_overflow(regs, address, &info); in DEFINE_IDTENTRY_DF()
466 die("double fault", regs, error_code); in DEFINE_IDTENTRY_DF()
473 if (notify_die(DIE_TRAP, "bounds", regs, 0, in DEFINE_IDTENTRY()
476 cond_local_irq_enable(regs); in DEFINE_IDTENTRY()
478 if (!user_mode(regs)) in DEFINE_IDTENTRY()
479 die("bounds", regs, 0); in DEFINE_IDTENTRY()
481 do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, 0, 0, NULL); in DEFINE_IDTENTRY()
483 cond_local_irq_disable(regs); in DEFINE_IDTENTRY()
497 static enum kernel_gp_hint get_kernel_gp_address(struct pt_regs *regs, in get_kernel_gp_address() argument
504 if (copy_from_kernel_nofault(insn_buf, (void *)regs->ip, in get_kernel_gp_address()
512 *addr = (unsigned long)insn_get_addr_ref(&insn, regs); in get_kernel_gp_address()
532 static bool fixup_iopl_exception(struct pt_regs *regs) in fixup_iopl_exception() argument
541 if (insn_get_effective_ip(regs, &ip)) in fixup_iopl_exception()
558 regs->ip += 1; in fixup_iopl_exception()
570 cond_local_irq_enable(regs); in DEFINE_IDTENTRY_ERRORCODE()
573 if (user_mode(regs) && fixup_umip_exception(regs)) in DEFINE_IDTENTRY_ERRORCODE()
577 if (v8086_mode(regs)) { in DEFINE_IDTENTRY_ERRORCODE()
579 handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code); in DEFINE_IDTENTRY_ERRORCODE()
586 if (user_mode(regs)) { in DEFINE_IDTENTRY_ERRORCODE()
587 if (fixup_iopl_exception(regs)) in DEFINE_IDTENTRY_ERRORCODE()
593 if (fixup_vdso_exception(regs, X86_TRAP_GP, error_code, 0)) in DEFINE_IDTENTRY_ERRORCODE()
596 show_signal(tsk, SIGSEGV, "", desc, regs, error_code); in DEFINE_IDTENTRY_ERRORCODE()
601 if (fixup_exception(regs, X86_TRAP_GP, error_code, 0)) in DEFINE_IDTENTRY_ERRORCODE()
613 kprobe_fault_handler(regs, X86_TRAP_GP)) in DEFINE_IDTENTRY_ERRORCODE()
616 ret = notify_die(DIE_GPF, desc, regs, error_code, X86_TRAP_GP, SIGSEGV); in DEFINE_IDTENTRY_ERRORCODE()
623 hint = get_kernel_gp_address(regs, &gp_addr); in DEFINE_IDTENTRY_ERRORCODE()
638 die_addr(desc, regs, error_code, gp_addr); in DEFINE_IDTENTRY_ERRORCODE()
641 cond_local_irq_disable(regs); in DEFINE_IDTENTRY_ERRORCODE()
644 static bool do_int3(struct pt_regs *regs) in do_int3() argument
649 if (kgdb_ll_trap(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, in do_int3()
655 if (kprobe_int3_handler(regs)) in do_int3()
658 res = notify_die(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, SIGTRAP); in do_int3()
663 static void do_int3_user(struct pt_regs *regs) in do_int3_user() argument
665 if (do_int3(regs)) in do_int3_user()
668 cond_local_irq_enable(regs); in do_int3_user()
669 do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, 0, 0, NULL); in do_int3_user()
670 cond_local_irq_disable(regs); in do_int3_user()
680 if (poke_int3_handler(regs)) in DEFINE_IDTENTRY_RAW()
690 if (user_mode(regs)) { in DEFINE_IDTENTRY_RAW()
691 irqentry_enter_from_user_mode(regs); in DEFINE_IDTENTRY_RAW()
693 do_int3_user(regs); in DEFINE_IDTENTRY_RAW()
695 irqentry_exit_to_user_mode(regs); in DEFINE_IDTENTRY_RAW()
697 irqentry_state_t irq_state = irqentry_nmi_enter(regs); in DEFINE_IDTENTRY_RAW()
700 if (!do_int3(regs)) in DEFINE_IDTENTRY_RAW()
701 die("int3", regs, 0); in DEFINE_IDTENTRY_RAW()
703 irqentry_nmi_exit(regs, irq_state); in DEFINE_IDTENTRY_RAW()
715 struct pt_regs *regs = (struct pt_regs *)this_cpu_read(cpu_current_top_of_stack) - 1; in sync_regs() local
716 if (regs != eregs) in sync_regs()
717 *regs = *eregs; in sync_regs()
718 return regs; in sync_regs()
722 asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *regs) in vc_switch_off_ist() argument
732 if (ip_within_syscall_gap(regs)) { in vc_switch_off_ist()
742 sp = regs->sp; in vc_switch_off_ist()
758 *regs_ret = *regs; in vc_switch_off_ist()
766 struct pt_regs regs; member
784 __memcpy(&tmp.regs.ip, (void *)s->regs.sp, 5*8); in fixup_bad_iret()
787 __memcpy(&tmp, s, offsetof(struct bad_iret_stack, regs.ip)); in fixup_bad_iret()
792 BUG_ON(!user_mode(&new_stack->regs)); in fixup_bad_iret()
797 static bool is_sysenter_singlestep(struct pt_regs *regs) in is_sysenter_singlestep() argument
808 return (regs->ip - (unsigned long)__begin_SYSENTER_singlestep_region) < in is_sysenter_singlestep()
812 return (regs->ip - (unsigned long)entry_SYSENTER_compat) < in is_sysenter_singlestep()
867 static bool notify_debug(struct pt_regs *regs, unsigned long *dr6) in notify_debug() argument
876 if (notify_die(DIE_DEBUG, "debug", regs, (long)dr6, 0, SIGTRAP) == NOTIFY_STOP) in notify_debug()
882 static __always_inline void exc_debug_kernel(struct pt_regs *regs, in exc_debug_kernel() argument
897 irqentry_state_t irq_state = irqentry_nmi_enter(regs); in exc_debug_kernel()
904 WARN_ON_ONCE(user_mode(regs)); in exc_debug_kernel()
924 if ((dr6 & DR_STEP) && is_sysenter_singlestep(regs)) in exc_debug_kernel()
933 if (notify_debug(regs, &dr6)) in exc_debug_kernel()
948 regs->flags &= ~X86_EFLAGS_TF; in exc_debug_kernel()
951 irqentry_nmi_exit(regs, irq_state); in exc_debug_kernel()
956 static __always_inline void exc_debug_user(struct pt_regs *regs, in exc_debug_user() argument
965 WARN_ON_ONCE(!user_mode(regs)); in exc_debug_user()
976 irqentry_enter_from_user_mode(regs); in exc_debug_user()
1002 if (notify_debug(regs, &dr6)) in exc_debug_user()
1008 if (v8086_mode(regs)) { in exc_debug_user()
1009 handle_vm86_trap((struct kernel_vm86_regs *)regs, 0, X86_TRAP_DB); in exc_debug_user()
1015 handle_bus_lock(regs); in exc_debug_user()
1020 send_sigtrap(regs, 0, get_si_code(dr6)); in exc_debug_user()
1026 irqentry_exit_to_user_mode(regs); in exc_debug_user()
1033 exc_debug_kernel(regs, debug_read_clear_dr6()); in DEFINE_IDTENTRY_DEBUG()
1039 exc_debug_user(regs, debug_read_clear_dr6()); in DEFINE_IDTENTRY_DEBUG_USER()
1047 if (user_mode(regs)) in DEFINE_IDTENTRY_RAW()
1048 exc_debug_user(regs, dr6); in DEFINE_IDTENTRY_RAW()
1050 exc_debug_kernel(regs, dr6); in DEFINE_IDTENTRY_RAW()
1059 static void math_error(struct pt_regs *regs, int trapnr) in math_error() argument
1067 cond_local_irq_enable(regs); in math_error()
1069 if (!user_mode(regs)) { in math_error()
1070 if (fixup_exception(regs, trapnr, 0, 0)) in math_error()
1076 if (notify_die(DIE_TRAP, str, regs, 0, trapnr, in math_error()
1078 die(str, regs, 0); in math_error()
1096 if (fixup_vdso_exception(regs, trapnr, 0, 0)) in math_error()
1100 (void __user *)uprobe_get_trap_addr(regs)); in math_error()
1102 cond_local_irq_disable(regs); in math_error()
1107 math_error(regs, X86_TRAP_MF); in DEFINE_IDTENTRY()
1115 __exc_general_protection(regs, 0); in DEFINE_IDTENTRY()
1119 math_error(regs, X86_TRAP_XF); in DEFINE_IDTENTRY()
1145 static bool handle_xfd_event(struct pt_regs *regs) in handle_xfd_event() argument
1160 if (WARN_ON(!user_mode(regs))) in handle_xfd_event()
1169 force_sig_fault(SIGILL, ILL_ILLOPC, error_get_trap_addr(regs)); in handle_xfd_event()
1184 if (handle_xfd_event(regs)) in DEFINE_IDTENTRY()
1191 cond_local_irq_enable(regs); in DEFINE_IDTENTRY()
1193 info.regs = regs; in DEFINE_IDTENTRY()
1196 cond_local_irq_disable(regs); in DEFINE_IDTENTRY()
1211 die("unexpected #NM exception", regs, 0); in DEFINE_IDTENTRY()
1219 if (notify_die(DIE_TRAP, "iret exception", regs, 0, in DEFINE_IDTENTRY_SW()
1221 do_trap(X86_TRAP_IRET, SIGILL, "iret exception", regs, 0, in DEFINE_IDTENTRY_SW()