2 * Copyright (C) 1991,1992 Linus Torvalds
4 * entry_32.S contains the system-call and low-level fault and trap handling routines.
6 * Stack layout while running C code:
7 * ptrace needs to have all registers on the stack.
8 * If the order here is changed, it needs to be
9 * updated in fork.c:copy_process(), signal.c:do_signal(),
10 * ptrace.c and ptrace.h
22 * 28(%esp) - %gs saved iff !CONFIG_X86_32_LAZY_GS
31 #include <linux/linkage.h>
32 #include <linux/err.h>
33 #include <asm/thread_info.h>
34 #include <asm/irqflags.h>
35 #include <asm/errno.h>
36 #include <asm/segment.h>
38 #include <asm/percpu.h>
39 #include <asm/processor-flags.h>
40 #include <asm/irq_vectors.h>
41 #include <asm/cpufeatures.h>
42 #include <asm/alternative-asm.h>
45 #include <asm/frame.h>
47 .section .entry.text, "ax"
50 * We use macros for low-level operations which need to be overridden
51 * for paravirtualization. The following will never clobber any registers:
52 * INTERRUPT_RETURN (aka. "iret")
53 * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
54 * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
56 * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
57 * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
58 * Allowing a register to be clobbered can shrink the paravirt replacement
59 * enough to patch inline, increasing performance.
63 # define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
65 # define preempt_stop(clobbers)
66 # define resume_kernel restore_all
69 .macro TRACE_IRQS_IRET
70 #ifdef CONFIG_TRACE_IRQFLAGS
71 testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off?
79 * User gs save/restore
81 * %gs is used for userland TLS and kernel only uses it for stack
82 * canary which is required to be at %gs:20 by gcc. Read the comment
83 * at the top of stackprotector.h for more info.
85 * Local labels 98 and 99 are used.
87 #ifdef CONFIG_X86_32_LAZY_GS
89 /* unfortunately push/pop can't be no-op */
94 addl $(4 + \pop), %esp
99 /* all the rest are no-op */
106 .macro REG_TO_PTGS reg
108 .macro SET_KERNEL_GS reg
111 #else /* CONFIG_X86_32_LAZY_GS */
124 .pushsection .fixup, "ax"
128 _ASM_EXTABLE(98b, 99b)
132 98: mov PT_GS(%esp), %gs
135 .pushsection .fixup, "ax"
136 99: movl $0, PT_GS(%esp)
139 _ASM_EXTABLE(98b, 99b)
145 .macro REG_TO_PTGS reg
146 movl \reg, PT_GS(%esp)
148 .macro SET_KERNEL_GS reg
149 movl $(__KERNEL_STACK_CANARY), \reg
153 #endif /* CONFIG_X86_32_LAZY_GS */
155 .macro SAVE_ALL pt_regs_ax=%eax
168 movl $(__USER_DS), %edx
171 movl $(__KERNEL_PERCPU), %edx
177 * This is a sneaky trick to help the unwinder find pt_regs on the stack. The
178 * frame pointer is replaced with an encoded pointer to pt_regs. The encoding
179 * is just setting the LSB, which makes it an invalid stack address and is also
180 * a signal to the unwinder that it's a pt_regs pointer in disguise.
182 * NOTE: This macro must be used *after* SAVE_ALL because it corrupts the
185 .macro ENCODE_FRAME_POINTER
186 #ifdef CONFIG_FRAME_POINTER
192 .macro RESTORE_INT_REGS
202 .macro RESTORE_REGS pop=0
208 .pushsection .fixup, "ax"
226 ENTRY(__switch_to_asm)
228 * Save callee-saved registers
229 * This must match the order in struct inactive_task_frame
237 movl %esp, TASK_threadsp(%eax)
238 movl TASK_threadsp(%edx), %esp
240 #ifdef CONFIG_CC_STACKPROTECTOR
241 movl TASK_stack_canary(%edx), %ebx
242 movl %ebx, PER_CPU_VAR(stack_canary)+stack_canary_offset
245 /* restore callee-saved registers */
255 * The unwinder expects the last frame on the stack to always be at the same
256 * offset from the end of the page, which allows it to validate the stack.
257 * Calling schedule_tail() directly would break that convention because its an
258 * asmlinkage function so its argument has to be pushed on the stack. This
259 * wrapper creates a proper "end of stack" frame header before the call.
261 ENTRY(schedule_tail_wrapper)
270 ENDPROC(schedule_tail_wrapper)
272 * A newly forked process directly context switches into this address.
274 * eax: prev task we switched from
275 * ebx: kernel thread func (NULL for user thread)
276 * edi: kernel thread arg
279 call schedule_tail_wrapper
282 jnz 1f /* kernel threads are uncommon */
285 /* When we fork, we trace the syscall return in the child, too. */
287 call syscall_return_slowpath
294 * A kernel thread is allowed to return here after successfully
295 * calling do_execve(). Exit to userspace to complete the execve()
298 movl $0, PT_EAX(%esp)
303 * Return to user mode is not as complex as all this looks,
304 * but we want the default path for a system call return to
305 * go as quickly as possible which is why some of this is
306 * less clear than it otherwise should be.
309 # userspace resumption stub bypassing syscall exit tracing
312 preempt_stop(CLBR_ANY)
315 movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS
316 movb PT_CS(%esp), %al
317 andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
320 * We can be coming here from child spawned by kernel_thread().
322 movl PT_CS(%esp), %eax
323 andl $SEGMENT_RPL_MASK, %eax
326 jb resume_kernel # not returning to v8086 or userspace
328 ENTRY(resume_userspace)
329 DISABLE_INTERRUPTS(CLBR_ANY)
332 call prepare_exit_to_usermode
334 END(ret_from_exception)
336 #ifdef CONFIG_PREEMPT
338 DISABLE_INTERRUPTS(CLBR_ANY)
340 cmpl $0, PER_CPU_VAR(__preempt_count)
342 testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ?
344 call preempt_schedule_irq
349 GLOBAL(__begin_SYSENTER_singlestep_region)
351 * All code from here through __end_SYSENTER_singlestep_region is subject
352 * to being single-stepped if a user program sets TF and executes SYSENTER.
353 * There is absolutely nothing that we can do to prevent this from happening
354 * (thanks Intel!). To keep our handling of this situation as simple as
355 * possible, we handle TF just like AC and NT, except that our #DB handler
356 * will ignore all of the single-step traps generated in this range.
361 * Xen doesn't set %esp to be precisely what the normal SYSENTER
362 * entry point expects, so fix it up before using the normal path.
364 ENTRY(xen_sysenter_target)
365 addl $5*4, %esp /* remove xen-provided frame */
366 jmp .Lsysenter_past_esp
370 * 32-bit SYSENTER entry.
372 * 32-bit system calls through the vDSO's __kernel_vsyscall enter here
373 * if X86_FEATURE_SEP is available. This is the preferred system call
374 * entry on 32-bit systems.
376 * The SYSENTER instruction, in principle, should *only* occur in the
377 * vDSO. In practice, a small number of Android devices were shipped
378 * with a copy of Bionic that inlined a SYSENTER instruction. This
379 * never happened in any of Google's Bionic versions -- it only happened
380 * in a narrow range of Intel-provided versions.
382 * SYSENTER loads SS, ESP, CS, and EIP from previously programmed MSRs.
383 * IF and VM in RFLAGS are cleared (IOW: interrupts are off).
384 * SYSENTER does not save anything on the stack,
385 * and does not save old EIP (!!!), ESP, or EFLAGS.
387 * To avoid losing track of EFLAGS.VM (and thus potentially corrupting
388 * user and/or vm86 state), we explicitly disable the SYSENTER
389 * instruction in vm86 mode by reprogramming the MSRs.
392 * eax system call number
401 ENTRY(entry_SYSENTER_32)
402 movl TSS_sysenter_sp0(%esp), %esp
404 pushl $__USER_DS /* pt_regs->ss */
405 pushl %ebp /* pt_regs->sp (stashed in bp) */
406 pushfl /* pt_regs->flags (except IF = 0) */
407 orl $X86_EFLAGS_IF, (%esp) /* Fix IF */
408 pushl $__USER_CS /* pt_regs->cs */
409 pushl $0 /* pt_regs->ip = 0 (placeholder) */
410 pushl %eax /* pt_regs->orig_ax */
411 SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest */
414 * SYSENTER doesn't filter flags, so we need to clear NT, AC
415 * and TF ourselves. To save a few cycles, we can check whether
416 * either was set instead of doing an unconditional popfq.
417 * This needs to happen before enabling interrupts so that
418 * we don't get preempted with NT set.
420 * If TF is set, we will single-step all the way to here -- do_debug
421 * will ignore all the traps. (Yes, this is slow, but so is
422 * single-stepping in general. This allows us to avoid having
423 * a more complicated code to handle the case where a user program
424 * forces us to single-step through the SYSENTER entry code.)
426 * NB.: .Lsysenter_fix_flags is a label with the code under it moved
427 * out-of-line as an optimization: NT is unlikely to be set in the
428 * majority of the cases and instead of polluting the I$ unnecessarily,
429 * we're keeping that code behind a branch which will predict as
430 * not-taken and therefore its instructions won't be fetched.
432 testl $X86_EFLAGS_NT|X86_EFLAGS_AC|X86_EFLAGS_TF, PT_EFLAGS(%esp)
433 jnz .Lsysenter_fix_flags
434 .Lsysenter_flags_fixed:
437 * User mode is traced as though IRQs are on, and SYSENTER
443 call do_fast_syscall_32
444 /* XEN PV guests always use IRET path */
445 ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
446 "jmp .Lsyscall_32_done", X86_FEATURE_XENPV
448 /* Opportunistic SYSEXIT */
449 TRACE_IRQS_ON /* User mode traces as IRQs on. */
450 movl PT_EIP(%esp), %edx /* pt_regs->ip */
451 movl PT_OLDESP(%esp), %ecx /* pt_regs->sp */
452 1: mov PT_FS(%esp), %fs
454 popl %ebx /* pt_regs->bx */
455 addl $2*4, %esp /* skip pt_regs->cx and pt_regs->dx */
456 popl %esi /* pt_regs->si */
457 popl %edi /* pt_regs->di */
458 popl %ebp /* pt_regs->bp */
459 popl %eax /* pt_regs->ax */
462 * Restore all flags except IF. (We restore IF separately because
463 * STI gives a one-instruction window in which we won't be interrupted,
464 * whereas POPF does not.)
466 addl $PT_EFLAGS-PT_DS, %esp /* point esp at pt_regs->flags */
467 btr $X86_EFLAGS_IF_BIT, (%esp)
471 * Return back to the vDSO, which will pop ecx and edx.
472 * Don't bother with DS and ES (they already contain __USER_DS).
477 .pushsection .fixup, "ax"
478 2: movl $0, PT_FS(%esp)
484 .Lsysenter_fix_flags:
485 pushl $X86_EFLAGS_FIXED
487 jmp .Lsysenter_flags_fixed
488 GLOBAL(__end_SYSENTER_singlestep_region)
489 ENDPROC(entry_SYSENTER_32)
492 * 32-bit legacy system call entry.
494 * 32-bit x86 Linux system calls traditionally used the INT $0x80
495 * instruction. INT $0x80 lands here.
497 * This entry point can be used by any 32-bit perform system calls.
498 * Instances of INT $0x80 can be found inline in various programs and
499 * libraries. It is also used by the vDSO's __kernel_vsyscall
500 * fallback for hardware that doesn't support a faster entry method.
501 * Restarted 32-bit system calls also fall back to INT $0x80
502 * regardless of what instruction was originally used to do the system
503 * call. (64-bit programs can use INT $0x80 as well, but they can
504 * only run on 64-bit kernels and therefore land in
505 * entry_INT80_compat.)
507 * This is considered a slow path. It is not used by most libc
508 * implementations on modern hardware except during process startup.
511 * eax system call number
519 ENTRY(entry_INT80_32)
521 pushl %eax /* pt_regs->orig_ax */
522 SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest */
525 * User mode is traced as though IRQs are on, and the interrupt gate
531 call do_int80_syscall_32
536 .Lrestore_all_notrace:
537 #ifdef CONFIG_X86_ESPFIX32
538 ALTERNATIVE "jmp .Lrestore_nocheck", "", X86_BUG_ESPFIX
540 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS
542 * Warning: PT_OLDSS(%esp) contains the wrong/random values if we
543 * are returning to the kernel.
544 * See comments in process.c:copy_thread() for details.
546 movb PT_OLDSS(%esp), %ah
547 movb PT_CS(%esp), %al
548 andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
549 cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
550 je .Lldt_ss # returning to user-space with LDT SS
553 RESTORE_REGS 4 # skip orig_eax/error_code
557 .section .fixup, "ax"
559 pushl $0 # no error code
563 _ASM_EXTABLE(.Lirq_return, iret_exc)
565 #ifdef CONFIG_X86_ESPFIX32
568 * Setup and switch to ESPFIX stack
570 * We're returning to userspace with a 16 bit stack. The CPU will not
571 * restore the high word of ESP for us on executing iret... This is an
572 * "official" bug of all the x86-compatible CPUs, which we can work
573 * around to make dosemu and wine happy. We do this by preloading the
574 * high word of ESP with the high word of the userspace ESP while
575 * compensating for the offset by changing to the ESPFIX segment with
576 * a base address that matches for the difference.
578 #define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8)
579 mov %esp, %edx /* load kernel esp */
580 mov PT_OLDESP(%esp), %eax /* load userspace esp */
581 mov %dx, %ax /* eax: new kernel esp */
582 sub %eax, %edx /* offset (low word is 0) */
584 mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */
585 mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */
587 pushl %eax /* new kernel esp */
589 * Disable interrupts, but do not irqtrace this section: we
590 * will soon execute iret and the tracer was already set to
591 * the irqstate after the IRET:
593 DISABLE_INTERRUPTS(CLBR_ANY)
594 lss (%esp), %esp /* switch to espfix segment */
595 jmp .Lrestore_nocheck
597 ENDPROC(entry_INT80_32)
599 .macro FIXUP_ESPFIX_STACK
601 * Switch back for ESPFIX stack to the normal zerobased stack
603 * We can't call C functions using the ESPFIX stack. This code reads
604 * the high word of the segment base from the GDT and swiches to the
605 * normal stack and adjusts ESP with the matching offset.
607 #ifdef CONFIG_X86_ESPFIX32
608 /* fixup the stack */
609 mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */
610 mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
612 addl %esp, %eax /* the adjusted stack pointer */
615 lss (%esp), %esp /* switch to the normal stack segment */
618 .macro UNWIND_ESPFIX_STACK
619 #ifdef CONFIG_X86_ESPFIX32
621 /* see if on espfix stack */
622 cmpw $__ESPFIX_SS, %ax
624 movl $__KERNEL_DS, %eax
627 /* switch to normal stack */
634 * Build the entry stubs with some assembler magic.
635 * We pack 1 stub into every 8-byte block.
638 ENTRY(irq_entries_start)
639 vector=FIRST_EXTERNAL_VECTOR
640 .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
641 pushl $(~vector+0x80) /* Note: always in signed byte range */
646 END(irq_entries_start)
649 * the CPU automatically disables interrupts when executing an IRQ vector,
650 * so IRQ-flags tracing has to follow that:
652 .p2align CONFIG_X86_L1_CACHE_SHIFT
655 addl $-0x80, (%esp) /* Adjust vector into the [-256, -1] range */
662 ENDPROC(common_interrupt)
664 #define BUILD_INTERRUPT3(name, nr, fn) \
669 ENCODE_FRAME_POINTER; \
677 #ifdef CONFIG_TRACING
678 # define TRACE_BUILD_INTERRUPT(name, nr) BUILD_INTERRUPT3(trace_##name, nr, smp_trace_##name)
680 # define TRACE_BUILD_INTERRUPT(name, nr)
683 #define BUILD_INTERRUPT(name, nr) \
684 BUILD_INTERRUPT3(name, nr, smp_##name); \
685 TRACE_BUILD_INTERRUPT(name, nr)
687 /* The include is where all of the SMP etc. interrupts come from */
688 #include <asm/entry_arch.h>
690 ENTRY(coprocessor_error)
693 pushl $do_coprocessor_error
695 END(coprocessor_error)
697 ENTRY(simd_coprocessor_error)
700 #ifdef CONFIG_X86_INVD_BUG
701 /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */
702 ALTERNATIVE "pushl $do_general_protection", \
703 "pushl $do_simd_coprocessor_error", \
706 pushl $do_simd_coprocessor_error
709 END(simd_coprocessor_error)
711 ENTRY(device_not_available)
713 pushl $-1 # mark this as an int
714 pushl $do_device_not_available
716 END(device_not_available)
718 #ifdef CONFIG_PARAVIRT
721 _ASM_EXTABLE(native_iret, iret_exc)
746 ENTRY(coprocessor_segment_overrun)
749 pushl $do_coprocessor_segment_overrun
751 END(coprocessor_segment_overrun)
755 pushl $do_invalid_TSS
759 ENTRY(segment_not_present)
761 pushl $do_segment_not_present
763 END(segment_not_present)
767 pushl $do_stack_segment
771 ENTRY(alignment_check)
773 pushl $do_alignment_check
779 pushl $0 # no error code
780 pushl $do_divide_error
784 #ifdef CONFIG_X86_MCE
788 pushl machine_check_vector
793 ENTRY(spurious_interrupt_bug)
796 pushl $do_spurious_interrupt_bug
798 END(spurious_interrupt_bug)
801 ENTRY(xen_hypervisor_callback)
802 pushl $-1 /* orig_ax = -1 => not a system call */
808 * Check to see if we got the event in the critical
809 * region in xen_iret_direct, after we've reenabled
810 * events and checked for pending events. This simulates
811 * iret instruction's behaviour where it delivers a
812 * pending interrupt when enabling interrupts:
814 movl PT_EIP(%esp), %eax
815 cmpl $xen_iret_start_crit, %eax
817 cmpl $xen_iret_end_crit, %eax
820 jmp xen_iret_crit_fixup
824 call xen_evtchn_do_upcall
825 #ifndef CONFIG_PREEMPT
826 call xen_maybe_preempt_hcall
829 ENDPROC(xen_hypervisor_callback)
832 * Hypervisor uses this for application faults while it executes.
833 * We get here for two reasons:
834 * 1. Fault while reloading DS, ES, FS or GS
835 * 2. Fault while executing IRET
836 * Category 1 we fix up by reattempting the load, and zeroing the segment
837 * register if the load fails.
838 * Category 2 we fix up by jumping to do_iret_error. We cannot use the
839 * normal Linux return path in this case because if we use the IRET hypercall
840 * to pop the stack frame we end up in an infinite loop of failsafe callbacks.
841 * We distinguish between categories by maintaining a status value in EAX.
843 ENTRY(xen_failsafe_callback)
850 /* EAX == 0 => Category 1 (Bad segment)
851 EAX != 0 => Category 2 (Bad IRET) */
857 5: pushl $-1 /* orig_ax = -1 => not a system call */
860 jmp ret_from_exception
862 .section .fixup, "ax"
880 ENDPROC(xen_failsafe_callback)
882 BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
883 xen_evtchn_do_upcall)
885 #endif /* CONFIG_XEN */
887 #if IS_ENABLED(CONFIG_HYPERV)
889 BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
890 hyperv_vector_handler)
892 #endif /* CONFIG_HYPERV */
894 #ifdef CONFIG_TRACING
895 ENTRY(trace_page_fault)
897 pushl $trace_do_page_fault
899 END(trace_page_fault)
910 /* the function address is in %gs's slot on the stack */
923 movl $(__KERNEL_PERCPU), %ecx
927 movl PT_GS(%esp), %edi # get the function address
928 movl PT_ORIG_EAX(%esp), %edx # get the error code
929 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
932 movl $(__USER_DS), %ecx
936 movl %esp, %eax # pt_regs pointer
938 jmp ret_from_exception
939 END(common_exception)
943 * #DB can happen at the first instruction of
944 * entry_SYSENTER_32 or in Xen's SYSENTER prologue. If this
945 * happens, then we will be running on a very small stack. We
946 * need to detect this condition and switch to the thread
947 * stack before calling any C code at all.
949 * If you edit this code, keep in mind that NMIs can happen in here.
952 pushl $-1 # mark this as an int
955 xorl %edx, %edx # error code 0
956 movl %esp, %eax # pt_regs pointer
958 /* Are we currently on the SYSENTER stack? */
959 PER_CPU(cpu_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx)
960 subl %eax, %ecx /* ecx = (end of SYSENTER_stack) - esp */
961 cmpl $SIZEOF_SYSENTER_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 PER_CPU(cpu_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx)
1003 subl %eax, %ecx /* ecx = (end of SYSENTER_stack) - esp */
1004 cmpl $SIZEOF_SYSENTER_stack, %ecx
1005 jb .Lnmi_from_sysenter_stack
1007 /* Not on SYSENTER stack. */
1009 jmp .Lrestore_all_notrace
1011 .Lnmi_from_sysenter_stack:
1013 * We're on the SYSENTER stack. Switch off. No one (not even debug)
1014 * is using the thread stack right now, so it's safe for us to use it.
1017 movl PER_CPU_VAR(cpu_current_top_of_stack), %esp
1020 jmp .Lrestore_all_notrace
1022 #ifdef CONFIG_X86_ESPFIX32
1025 * create the pointer to lss back
1030 /* copy the iret frame of 12 bytes */
1036 ENCODE_FRAME_POINTER
1037 FIXUP_ESPFIX_STACK # %eax == %esp
1038 xorl %edx, %edx # zero error code
1041 lss 12+4(%esp), %esp # back to espfix stack
1048 pushl $-1 # mark this as an int
1050 ENCODE_FRAME_POINTER
1052 xorl %edx, %edx # zero error code
1053 movl %esp, %eax # pt_regs pointer
1055 jmp ret_from_exception
1058 ENTRY(general_protection)
1059 pushl $do_general_protection
1060 jmp common_exception
1061 END(general_protection)
1063 #ifdef CONFIG_KVM_GUEST
1064 ENTRY(async_page_fault)
1066 pushl $do_async_page_fault
1067 jmp common_exception
1068 END(async_page_fault)
1071 ENTRY(rewind_stack_do_exit)
1072 /* Prevent any naive code from trying to unwind to our caller. */
1075 movl PER_CPU_VAR(cpu_current_top_of_stack), %esi
1076 leal -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%esi), %esp
1080 END(rewind_stack_do_exit)