1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 1991,1992 Linus Torvalds
5 * entry_32.S contains the system-call and low-level fault and trap handling routines.
7 * Stack layout while running C code:
8 * ptrace needs to have all registers on the stack.
9 * If the order here is changed, it needs to be
10 * updated in fork.c:copy_process(), signal.c:do_signal(),
11 * ptrace.c and ptrace.h
23 * 28(%esp) - %gs saved iff !CONFIG_X86_32_LAZY_GS
32 #include <linux/linkage.h>
33 #include <linux/err.h>
34 #include <asm/thread_info.h>
35 #include <asm/irqflags.h>
36 #include <asm/errno.h>
37 #include <asm/segment.h>
39 #include <asm/percpu.h>
40 #include <asm/processor-flags.h>
41 #include <asm/irq_vectors.h>
42 #include <asm/cpufeatures.h>
43 #include <asm/alternative-asm.h>
46 #include <asm/frame.h>
47 #include <asm/nospec-branch.h>
49 .section .entry.text, "ax"
52 * We use macros for low-level operations which need to be overridden
53 * for paravirtualization. The following will never clobber any registers:
54 * INTERRUPT_RETURN (aka. "iret")
55 * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
56 * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
58 * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
59 * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
60 * Allowing a register to be clobbered can shrink the paravirt replacement
61 * enough to patch inline, increasing performance.
65 # define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
67 # define preempt_stop(clobbers)
68 # define resume_kernel restore_all
71 .macro TRACE_IRQS_IRET
72 #ifdef CONFIG_TRACE_IRQFLAGS
73 testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off?
81 * User gs save/restore
83 * %gs is used for userland TLS and kernel only uses it for stack
84 * canary which is required to be at %gs:20 by gcc. Read the comment
85 * at the top of stackprotector.h for more info.
87 * Local labels 98 and 99 are used.
89 #ifdef CONFIG_X86_32_LAZY_GS
91 /* unfortunately push/pop can't be no-op */
96 addl $(4 + \pop), %esp
101 /* all the rest are no-op */
108 .macro REG_TO_PTGS reg
110 .macro SET_KERNEL_GS reg
113 #else /* CONFIG_X86_32_LAZY_GS */
126 .pushsection .fixup, "ax"
130 _ASM_EXTABLE(98b, 99b)
134 98: mov PT_GS(%esp), %gs
137 .pushsection .fixup, "ax"
138 99: movl $0, PT_GS(%esp)
141 _ASM_EXTABLE(98b, 99b)
147 .macro REG_TO_PTGS reg
148 movl \reg, PT_GS(%esp)
150 .macro SET_KERNEL_GS reg
151 movl $(__KERNEL_STACK_CANARY), \reg
155 #endif /* CONFIG_X86_32_LAZY_GS */
157 .macro SAVE_ALL pt_regs_ax=%eax
170 movl $(__USER_DS), %edx
173 movl $(__KERNEL_PERCPU), %edx
179 * This is a sneaky trick to help the unwinder find pt_regs on the stack. The
180 * frame pointer is replaced with an encoded pointer to pt_regs. The encoding
181 * is just clearing the MSB, which makes it an invalid stack address and is also
182 * a signal to the unwinder that it's a pt_regs pointer in disguise.
184 * NOTE: This macro must be used *after* SAVE_ALL because it corrupts the
187 .macro ENCODE_FRAME_POINTER
188 #ifdef CONFIG_FRAME_POINTER
190 andl $0x7fffffff, %ebp
194 .macro RESTORE_INT_REGS
204 .macro RESTORE_REGS pop=0
210 .pushsection .fixup, "ax"
228 ENTRY(__switch_to_asm)
230 * Save callee-saved registers
231 * This must match the order in struct inactive_task_frame
240 movl %esp, TASK_threadsp(%eax)
241 movl TASK_threadsp(%edx), %esp
243 #ifdef CONFIG_CC_STACKPROTECTOR
244 movl TASK_stack_canary(%edx), %ebx
245 movl %ebx, PER_CPU_VAR(stack_canary)+stack_canary_offset
248 #ifdef CONFIG_RETPOLINE
250 * When switching from a shallower to a deeper call stack
251 * the RSB may either underflow or use entries populated
252 * with userspace addresses. On CPUs where those concerns
253 * exist, overwrite the RSB with entries which capture
254 * speculative execution to prevent attack.
256 FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
259 /* restore callee-saved registers */
270 * The unwinder expects the last frame on the stack to always be at the same
271 * offset from the end of the page, which allows it to validate the stack.
272 * Calling schedule_tail() directly would break that convention because its an
273 * asmlinkage function so its argument has to be pushed on the stack. This
274 * wrapper creates a proper "end of stack" frame header before the call.
276 ENTRY(schedule_tail_wrapper)
285 ENDPROC(schedule_tail_wrapper)
287 * A newly forked process directly context switches into this address.
289 * eax: prev task we switched from
290 * ebx: kernel thread func (NULL for user thread)
291 * edi: kernel thread arg
294 call schedule_tail_wrapper
297 jnz 1f /* kernel threads are uncommon */
300 /* When we fork, we trace the syscall return in the child, too. */
302 call syscall_return_slowpath
309 * A kernel thread is allowed to return here after successfully
310 * calling do_execve(). Exit to userspace to complete the execve()
313 movl $0, PT_EAX(%esp)
318 * Return to user mode is not as complex as all this looks,
319 * but we want the default path for a system call return to
320 * go as quickly as possible which is why some of this is
321 * less clear than it otherwise should be.
324 # userspace resumption stub bypassing syscall exit tracing
327 preempt_stop(CLBR_ANY)
330 movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS
331 movb PT_CS(%esp), %al
332 andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
335 * We can be coming here from child spawned by kernel_thread().
337 movl PT_CS(%esp), %eax
338 andl $SEGMENT_RPL_MASK, %eax
341 jb resume_kernel # not returning to v8086 or userspace
343 ENTRY(resume_userspace)
344 DISABLE_INTERRUPTS(CLBR_ANY)
347 call prepare_exit_to_usermode
349 END(ret_from_exception)
351 #ifdef CONFIG_PREEMPT
353 DISABLE_INTERRUPTS(CLBR_ANY)
355 cmpl $0, PER_CPU_VAR(__preempt_count)
357 testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ?
359 call preempt_schedule_irq
364 GLOBAL(__begin_SYSENTER_singlestep_region)
366 * All code from here through __end_SYSENTER_singlestep_region is subject
367 * to being single-stepped if a user program sets TF and executes SYSENTER.
368 * There is absolutely nothing that we can do to prevent this from happening
369 * (thanks Intel!). To keep our handling of this situation as simple as
370 * possible, we handle TF just like AC and NT, except that our #DB handler
371 * will ignore all of the single-step traps generated in this range.
376 * Xen doesn't set %esp to be precisely what the normal SYSENTER
377 * entry point expects, so fix it up before using the normal path.
379 ENTRY(xen_sysenter_target)
380 addl $5*4, %esp /* remove xen-provided frame */
381 jmp .Lsysenter_past_esp
385 * 32-bit SYSENTER entry.
387 * 32-bit system calls through the vDSO's __kernel_vsyscall enter here
388 * if X86_FEATURE_SEP is available. This is the preferred system call
389 * entry on 32-bit systems.
391 * The SYSENTER instruction, in principle, should *only* occur in the
392 * vDSO. In practice, a small number of Android devices were shipped
393 * with a copy of Bionic that inlined a SYSENTER instruction. This
394 * never happened in any of Google's Bionic versions -- it only happened
395 * in a narrow range of Intel-provided versions.
397 * SYSENTER loads SS, ESP, CS, and EIP from previously programmed MSRs.
398 * IF and VM in RFLAGS are cleared (IOW: interrupts are off).
399 * SYSENTER does not save anything on the stack,
400 * and does not save old EIP (!!!), ESP, or EFLAGS.
402 * To avoid losing track of EFLAGS.VM (and thus potentially corrupting
403 * user and/or vm86 state), we explicitly disable the SYSENTER
404 * instruction in vm86 mode by reprogramming the MSRs.
407 * eax system call number
416 ENTRY(entry_SYSENTER_32)
417 movl TSS_sysenter_sp0(%esp), %esp
419 pushl $__USER_DS /* pt_regs->ss */
420 pushl %ebp /* pt_regs->sp (stashed in bp) */
421 pushfl /* pt_regs->flags (except IF = 0) */
422 orl $X86_EFLAGS_IF, (%esp) /* Fix IF */
423 pushl $__USER_CS /* pt_regs->cs */
424 pushl $0 /* pt_regs->ip = 0 (placeholder) */
425 pushl %eax /* pt_regs->orig_ax */
426 SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest */
429 * SYSENTER doesn't filter flags, so we need to clear NT, AC
430 * and TF ourselves. To save a few cycles, we can check whether
431 * either was set instead of doing an unconditional popfq.
432 * This needs to happen before enabling interrupts so that
433 * we don't get preempted with NT set.
435 * If TF is set, we will single-step all the way to here -- do_debug
436 * will ignore all the traps. (Yes, this is slow, but so is
437 * single-stepping in general. This allows us to avoid having
438 * a more complicated code to handle the case where a user program
439 * forces us to single-step through the SYSENTER entry code.)
441 * NB.: .Lsysenter_fix_flags is a label with the code under it moved
442 * out-of-line as an optimization: NT is unlikely to be set in the
443 * majority of the cases and instead of polluting the I$ unnecessarily,
444 * we're keeping that code behind a branch which will predict as
445 * not-taken and therefore its instructions won't be fetched.
447 testl $X86_EFLAGS_NT|X86_EFLAGS_AC|X86_EFLAGS_TF, PT_EFLAGS(%esp)
448 jnz .Lsysenter_fix_flags
449 .Lsysenter_flags_fixed:
452 * User mode is traced as though IRQs are on, and SYSENTER
458 call do_fast_syscall_32
459 /* XEN PV guests always use IRET path */
460 ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
461 "jmp .Lsyscall_32_done", X86_FEATURE_XENPV
463 /* Opportunistic SYSEXIT */
464 TRACE_IRQS_ON /* User mode traces as IRQs on. */
465 movl PT_EIP(%esp), %edx /* pt_regs->ip */
466 movl PT_OLDESP(%esp), %ecx /* pt_regs->sp */
467 1: mov PT_FS(%esp), %fs
469 popl %ebx /* pt_regs->bx */
470 addl $2*4, %esp /* skip pt_regs->cx and pt_regs->dx */
471 popl %esi /* pt_regs->si */
472 popl %edi /* pt_regs->di */
473 popl %ebp /* pt_regs->bp */
474 popl %eax /* pt_regs->ax */
477 * Restore all flags except IF. (We restore IF separately because
478 * STI gives a one-instruction window in which we won't be interrupted,
479 * whereas POPF does not.)
481 addl $PT_EFLAGS-PT_DS, %esp /* point esp at pt_regs->flags */
482 btr $X86_EFLAGS_IF_BIT, (%esp)
486 * Return back to the vDSO, which will pop ecx and edx.
487 * Don't bother with DS and ES (they already contain __USER_DS).
492 .pushsection .fixup, "ax"
493 2: movl $0, PT_FS(%esp)
499 .Lsysenter_fix_flags:
500 pushl $X86_EFLAGS_FIXED
502 jmp .Lsysenter_flags_fixed
503 GLOBAL(__end_SYSENTER_singlestep_region)
504 ENDPROC(entry_SYSENTER_32)
507 * 32-bit legacy system call entry.
509 * 32-bit x86 Linux system calls traditionally used the INT $0x80
510 * instruction. INT $0x80 lands here.
512 * This entry point can be used by any 32-bit perform system calls.
513 * Instances of INT $0x80 can be found inline in various programs and
514 * libraries. It is also used by the vDSO's __kernel_vsyscall
515 * fallback for hardware that doesn't support a faster entry method.
516 * Restarted 32-bit system calls also fall back to INT $0x80
517 * regardless of what instruction was originally used to do the system
518 * call. (64-bit programs can use INT $0x80 as well, but they can
519 * only run on 64-bit kernels and therefore land in
520 * entry_INT80_compat.)
522 * This is considered a slow path. It is not used by most libc
523 * implementations on modern hardware except during process startup.
526 * eax system call number
534 ENTRY(entry_INT80_32)
536 pushl %eax /* pt_regs->orig_ax */
537 SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest */
540 * User mode is traced as though IRQs are on, and the interrupt gate
546 call do_int80_syscall_32
551 .Lrestore_all_notrace:
552 #ifdef CONFIG_X86_ESPFIX32
553 ALTERNATIVE "jmp .Lrestore_nocheck", "", X86_BUG_ESPFIX
555 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS
557 * Warning: PT_OLDSS(%esp) contains the wrong/random values if we
558 * are returning to the kernel.
559 * See comments in process.c:copy_thread() for details.
561 movb PT_OLDSS(%esp), %ah
562 movb PT_CS(%esp), %al
563 andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
564 cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
565 je .Lldt_ss # returning to user-space with LDT SS
568 RESTORE_REGS 4 # skip orig_eax/error_code
572 .section .fixup, "ax"
574 pushl $0 # no error code
578 _ASM_EXTABLE(.Lirq_return, iret_exc)
580 #ifdef CONFIG_X86_ESPFIX32
583 * Setup and switch to ESPFIX stack
585 * We're returning to userspace with a 16 bit stack. The CPU will not
586 * restore the high word of ESP for us on executing iret... This is an
587 * "official" bug of all the x86-compatible CPUs, which we can work
588 * around to make dosemu and wine happy. We do this by preloading the
589 * high word of ESP with the high word of the userspace ESP while
590 * compensating for the offset by changing to the ESPFIX segment with
591 * a base address that matches for the difference.
593 #define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8)
594 mov %esp, %edx /* load kernel esp */
595 mov PT_OLDESP(%esp), %eax /* load userspace esp */
596 mov %dx, %ax /* eax: new kernel esp */
597 sub %eax, %edx /* offset (low word is 0) */
599 mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */
600 mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */
602 pushl %eax /* new kernel esp */
604 * Disable interrupts, but do not irqtrace this section: we
605 * will soon execute iret and the tracer was already set to
606 * the irqstate after the IRET:
608 DISABLE_INTERRUPTS(CLBR_ANY)
609 lss (%esp), %esp /* switch to espfix segment */
610 jmp .Lrestore_nocheck
612 ENDPROC(entry_INT80_32)
614 .macro FIXUP_ESPFIX_STACK
616 * Switch back for ESPFIX stack to the normal zerobased stack
618 * We can't call C functions using the ESPFIX stack. This code reads
619 * the high word of the segment base from the GDT and swiches to the
620 * normal stack and adjusts ESP with the matching offset.
622 #ifdef CONFIG_X86_ESPFIX32
623 /* fixup the stack */
624 mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */
625 mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
627 addl %esp, %eax /* the adjusted stack pointer */
630 lss (%esp), %esp /* switch to the normal stack segment */
633 .macro UNWIND_ESPFIX_STACK
634 #ifdef CONFIG_X86_ESPFIX32
636 /* see if on espfix stack */
637 cmpw $__ESPFIX_SS, %ax
639 movl $__KERNEL_DS, %eax
642 /* switch to normal stack */
649 * Build the entry stubs with some assembler magic.
650 * We pack 1 stub into every 8-byte block.
653 ENTRY(irq_entries_start)
654 vector=FIRST_EXTERNAL_VECTOR
655 .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
656 pushl $(~vector+0x80) /* Note: always in signed byte range */
661 END(irq_entries_start)
664 * the CPU automatically disables interrupts when executing an IRQ vector,
665 * so IRQ-flags tracing has to follow that:
667 .p2align CONFIG_X86_L1_CACHE_SHIFT
670 addl $-0x80, (%esp) /* Adjust vector into the [-256, -1] range */
677 ENDPROC(common_interrupt)
679 #define BUILD_INTERRUPT3(name, nr, fn) \
684 ENCODE_FRAME_POINTER; \
691 #define BUILD_INTERRUPT(name, nr) \
692 BUILD_INTERRUPT3(name, nr, smp_##name); \
694 /* The include is where all of the SMP etc. interrupts come from */
695 #include <asm/entry_arch.h>
697 ENTRY(coprocessor_error)
700 pushl $do_coprocessor_error
702 END(coprocessor_error)
704 ENTRY(simd_coprocessor_error)
707 #ifdef CONFIG_X86_INVD_BUG
708 /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */
709 ALTERNATIVE "pushl $do_general_protection", \
710 "pushl $do_simd_coprocessor_error", \
713 pushl $do_simd_coprocessor_error
716 END(simd_coprocessor_error)
718 ENTRY(device_not_available)
720 pushl $-1 # mark this as an int
721 pushl $do_device_not_available
723 END(device_not_available)
725 #ifdef CONFIG_PARAVIRT
728 _ASM_EXTABLE(native_iret, iret_exc)
753 ENTRY(coprocessor_segment_overrun)
756 pushl $do_coprocessor_segment_overrun
758 END(coprocessor_segment_overrun)
762 pushl $do_invalid_TSS
766 ENTRY(segment_not_present)
768 pushl $do_segment_not_present
770 END(segment_not_present)
774 pushl $do_stack_segment
778 ENTRY(alignment_check)
780 pushl $do_alignment_check
786 pushl $0 # no error code
787 pushl $do_divide_error
791 #ifdef CONFIG_X86_MCE
795 pushl machine_check_vector
800 ENTRY(spurious_interrupt_bug)
803 pushl $do_spurious_interrupt_bug
805 END(spurious_interrupt_bug)
808 ENTRY(xen_hypervisor_callback)
809 pushl $-1 /* orig_ax = -1 => not a system call */
815 * Check to see if we got the event in the critical
816 * region in xen_iret_direct, after we've reenabled
817 * events and checked for pending events. This simulates
818 * iret instruction's behaviour where it delivers a
819 * pending interrupt when enabling interrupts:
821 movl PT_EIP(%esp), %eax
822 cmpl $xen_iret_start_crit, %eax
824 cmpl $xen_iret_end_crit, %eax
827 jmp xen_iret_crit_fixup
831 call xen_evtchn_do_upcall
832 #ifndef CONFIG_PREEMPT
833 call xen_maybe_preempt_hcall
836 ENDPROC(xen_hypervisor_callback)
839 * Hypervisor uses this for application faults while it executes.
840 * We get here for two reasons:
841 * 1. Fault while reloading DS, ES, FS or GS
842 * 2. Fault while executing IRET
843 * Category 1 we fix up by reattempting the load, and zeroing the segment
844 * register if the load fails.
845 * Category 2 we fix up by jumping to do_iret_error. We cannot use the
846 * normal Linux return path in this case because if we use the IRET hypercall
847 * to pop the stack frame we end up in an infinite loop of failsafe callbacks.
848 * We distinguish between categories by maintaining a status value in EAX.
850 ENTRY(xen_failsafe_callback)
857 /* EAX == 0 => Category 1 (Bad segment)
858 EAX != 0 => Category 2 (Bad IRET) */
864 5: pushl $-1 /* orig_ax = -1 => not a system call */
867 jmp ret_from_exception
869 .section .fixup, "ax"
887 ENDPROC(xen_failsafe_callback)
889 BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
890 xen_evtchn_do_upcall)
892 #endif /* CONFIG_XEN */
894 #if IS_ENABLED(CONFIG_HYPERV)
896 BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
897 hyperv_vector_handler)
899 #endif /* CONFIG_HYPERV */
909 /* the function address is in %gs's slot on the stack */
922 movl $(__KERNEL_PERCPU), %ecx
926 movl PT_GS(%esp), %edi # get the function address
927 movl PT_ORIG_EAX(%esp), %edx # get the error code
928 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
931 movl $(__USER_DS), %ecx
935 movl %esp, %eax # pt_regs pointer
937 jmp ret_from_exception
938 END(common_exception)
942 * #DB can happen at the first instruction of
943 * entry_SYSENTER_32 or in Xen's SYSENTER prologue. If this
944 * happens, then we will be running on a very small stack. We
945 * need to detect this condition and switch to the thread
946 * stack before calling any C code at all.
948 * If you edit this code, keep in mind that NMIs can happen in here.
951 pushl $-1 # mark this as an int
954 xorl %edx, %edx # error code 0
955 movl %esp, %eax # pt_regs pointer
957 /* Are we currently on the SYSENTER stack? */
958 movl PER_CPU_VAR(cpu_entry_area), %ecx
959 addl $CPU_ENTRY_AREA_entry_stack + SIZEOF_entry_stack, %ecx
960 subl %eax, %ecx /* ecx = (end of entry_stack) - esp */
961 cmpl $SIZEOF_entry_stack, %ecx
962 jb .Ldebug_from_sysenter_stack
966 jmp ret_from_exception
968 .Ldebug_from_sysenter_stack:
969 /* We're on the SYSENTER stack. Switch off. */
971 movl PER_CPU_VAR(cpu_current_top_of_stack), %esp
975 jmp ret_from_exception
979 * NMI is doubly nasty. It can happen on the first instruction of
980 * entry_SYSENTER_32 (just like #DB), but it can also interrupt the beginning
981 * of the #DB handler even if that #DB in turn hit before entry_SYSENTER_32
982 * switched stacks. We handle both conditions by simply checking whether we
983 * interrupted kernel code running on the SYSENTER stack.
987 #ifdef CONFIG_X86_ESPFIX32
990 cmpw $__ESPFIX_SS, %ax
992 je .Lnmi_espfix_stack
995 pushl %eax # pt_regs->orig_ax
998 xorl %edx, %edx # zero error code
999 movl %esp, %eax # pt_regs pointer
1001 /* Are we currently on the SYSENTER stack? */
1002 movl PER_CPU_VAR(cpu_entry_area), %ecx
1003 addl $CPU_ENTRY_AREA_entry_stack + SIZEOF_entry_stack, %ecx
1004 subl %eax, %ecx /* ecx = (end of entry_stack) - esp */
1005 cmpl $SIZEOF_entry_stack, %ecx
1006 jb .Lnmi_from_sysenter_stack
1008 /* Not on SYSENTER stack. */
1010 jmp .Lrestore_all_notrace
1012 .Lnmi_from_sysenter_stack:
1014 * We're on the SYSENTER stack. Switch off. No one (not even debug)
1015 * is using the thread stack right now, so it's safe for us to use it.
1018 movl PER_CPU_VAR(cpu_current_top_of_stack), %esp
1021 jmp .Lrestore_all_notrace
1023 #ifdef CONFIG_X86_ESPFIX32
1026 * create the pointer to lss back
1031 /* copy the iret frame of 12 bytes */
1037 ENCODE_FRAME_POINTER
1038 FIXUP_ESPFIX_STACK # %eax == %esp
1039 xorl %edx, %edx # zero error code
1042 lss 12+4(%esp), %esp # back to espfix stack
1049 pushl $-1 # mark this as an int
1051 ENCODE_FRAME_POINTER
1053 xorl %edx, %edx # zero error code
1054 movl %esp, %eax # pt_regs pointer
1056 jmp ret_from_exception
1059 ENTRY(general_protection)
1061 pushl $do_general_protection
1062 jmp common_exception
1063 END(general_protection)
1065 #ifdef CONFIG_KVM_GUEST
1066 ENTRY(async_page_fault)
1068 pushl $do_async_page_fault
1069 jmp common_exception
1070 END(async_page_fault)
1073 ENTRY(rewind_stack_do_exit)
1074 /* Prevent any naive code from trying to unwind to our caller. */
1077 movl PER_CPU_VAR(cpu_current_top_of_stack), %esi
1078 leal -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%esi), %esp
1082 END(rewind_stack_do_exit)