3 * Copyright (C) 1991, 1992 Linus Torvalds
7 * entry.S contains the system-call and fault low-level handling routines.
8 * This also contains the timer-interrupt handler, as well as all interrupts
9 * and faults that can result in a task-switch.
11 * NOTE: This code handles signal-recognition, which happens every time
12 * after a timer-interrupt and after each system call.
14 * I changed all the .align's to 4 (16 byte alignment), as that's faster
17 * Stack layout in 'syscall_exit':
18 * ptrace needs to have all regs on the stack.
19 * if the order here is changed, it needs to be
20 * updated in fork.c:copy_process, signal.c:do_signal,
21 * ptrace.c and ptrace.h
40 * "current" is in register %ebx during any slow entries.
43 #include <linux/linkage.h>
44 #include <asm/thread_info.h>
45 #include <asm/irqflags.h>
46 #include <asm/errno.h>
47 #include <asm/segment.h>
51 #include <asm/percpu.h>
52 #include <asm/dwarf2.h>
53 #include <asm/processor-flags.h>
54 #include <asm/ftrace.h>
55 #include <asm/irq_vectors.h>
58 * We use macros for low-level operations which need to be overridden
59 * for paravirtualization. The following will never clobber any registers:
60 * INTERRUPT_RETURN (aka. "iret")
61 * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
62 * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
64 * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
65 * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
66 * Allowing a register to be clobbered can shrink the paravirt replacement
67 * enough to patch inline, increasing performance.
70 #define nr_syscalls ((syscall_table_size)/4)
73 #define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
75 #define preempt_stop(clobbers)
76 #define resume_kernel restore_nocheck
79 .macro TRACE_IRQS_IRET
80 #ifdef CONFIG_TRACE_IRQFLAGS
81 testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off?
89 #define resume_userspace_sig check_userspace
91 #define resume_userspace_sig resume_userspace
97 CFI_ADJUST_CFA_OFFSET 4;\
98 /*CFI_REL_OFFSET fs, 0;*/\
100 CFI_ADJUST_CFA_OFFSET 4;\
101 /*CFI_REL_OFFSET es, 0;*/\
103 CFI_ADJUST_CFA_OFFSET 4;\
104 /*CFI_REL_OFFSET ds, 0;*/\
106 CFI_ADJUST_CFA_OFFSET 4;\
107 CFI_REL_OFFSET eax, 0;\
109 CFI_ADJUST_CFA_OFFSET 4;\
110 CFI_REL_OFFSET ebp, 0;\
112 CFI_ADJUST_CFA_OFFSET 4;\
113 CFI_REL_OFFSET edi, 0;\
115 CFI_ADJUST_CFA_OFFSET 4;\
116 CFI_REL_OFFSET esi, 0;\
118 CFI_ADJUST_CFA_OFFSET 4;\
119 CFI_REL_OFFSET edx, 0;\
121 CFI_ADJUST_CFA_OFFSET 4;\
122 CFI_REL_OFFSET ecx, 0;\
124 CFI_ADJUST_CFA_OFFSET 4;\
125 CFI_REL_OFFSET ebx, 0;\
126 movl $(__USER_DS), %edx; \
129 movl $(__KERNEL_PERCPU), %edx; \
132 #define RESTORE_INT_REGS \
134 CFI_ADJUST_CFA_OFFSET -4;\
137 CFI_ADJUST_CFA_OFFSET -4;\
140 CFI_ADJUST_CFA_OFFSET -4;\
143 CFI_ADJUST_CFA_OFFSET -4;\
146 CFI_ADJUST_CFA_OFFSET -4;\
149 CFI_ADJUST_CFA_OFFSET -4;\
152 CFI_ADJUST_CFA_OFFSET -4;\
155 #define RESTORE_REGS \
158 CFI_ADJUST_CFA_OFFSET -4;\
161 CFI_ADJUST_CFA_OFFSET -4;\
164 CFI_ADJUST_CFA_OFFSET -4;\
166 .pushsection .fixup,"ax"; \
173 .section __ex_table,"a";\
180 #define RING0_INT_FRAME \
181 CFI_STARTPROC simple;\
183 CFI_DEF_CFA esp, 3*4;\
184 /*CFI_OFFSET cs, -2*4;*/\
187 #define RING0_EC_FRAME \
188 CFI_STARTPROC simple;\
190 CFI_DEF_CFA esp, 4*4;\
191 /*CFI_OFFSET cs, -2*4;*/\
194 #define RING0_PTREGS_FRAME \
195 CFI_STARTPROC simple;\
197 CFI_DEF_CFA esp, PT_OLDESP-PT_EBX;\
198 /*CFI_OFFSET cs, PT_CS-PT_OLDESP;*/\
199 CFI_OFFSET eip, PT_EIP-PT_OLDESP;\
200 /*CFI_OFFSET es, PT_ES-PT_OLDESP;*/\
201 /*CFI_OFFSET ds, PT_DS-PT_OLDESP;*/\
202 CFI_OFFSET eax, PT_EAX-PT_OLDESP;\
203 CFI_OFFSET ebp, PT_EBP-PT_OLDESP;\
204 CFI_OFFSET edi, PT_EDI-PT_OLDESP;\
205 CFI_OFFSET esi, PT_ESI-PT_OLDESP;\
206 CFI_OFFSET edx, PT_EDX-PT_OLDESP;\
207 CFI_OFFSET ecx, PT_ECX-PT_OLDESP;\
208 CFI_OFFSET ebx, PT_EBX-PT_OLDESP
213 CFI_ADJUST_CFA_OFFSET 4
215 GET_THREAD_INFO(%ebp)
217 CFI_ADJUST_CFA_OFFSET -4
218 pushl $0x0202 # Reset kernel eflags
219 CFI_ADJUST_CFA_OFFSET 4
221 CFI_ADJUST_CFA_OFFSET -4
227 * Return to user mode is not as complex as all this looks,
228 * but we want the default path for a system call return to
229 * go as quickly as possible which is why some of this is
230 * less clear than it otherwise should be.
233 # userspace resumption stub bypassing syscall exit tracing
237 preempt_stop(CLBR_ANY)
239 GET_THREAD_INFO(%ebp)
241 movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS
242 movb PT_CS(%esp), %al
243 andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
245 jb resume_kernel # not returning to v8086 or userspace
247 ENTRY(resume_userspace)
249 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
250 # setting need_resched or sigpending
251 # between sampling and the iret
253 movl TI_flags(%ebp), %ecx
254 andl $_TIF_WORK_MASK, %ecx # is there any work to be done on
255 # int/exception return?
258 END(ret_from_exception)
260 #ifdef CONFIG_PREEMPT
262 DISABLE_INTERRUPTS(CLBR_ANY)
263 cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ?
266 movl TI_flags(%ebp), %ecx # need_resched set ?
267 testb $_TIF_NEED_RESCHED, %cl
269 testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ?
271 call preempt_schedule_irq
277 /* SYSENTER_RETURN points to after the "sysenter" instruction in
278 the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */
280 # sysenter call handler stub
281 ENTRY(ia32_sysenter_target)
285 CFI_REGISTER esp, ebp
286 movl TSS_sysenter_sp0(%esp),%esp
289 * Interrupts are disabled here, but we can't trace it until
290 * enough kernel state to call TRACE_IRQS_OFF can be called - but
291 * we immediately enable interrupts at that point anyway.
294 CFI_ADJUST_CFA_OFFSET 4
295 /*CFI_REL_OFFSET ss, 0*/
297 CFI_ADJUST_CFA_OFFSET 4
298 CFI_REL_OFFSET esp, 0
300 orl $X86_EFLAGS_IF, (%esp)
301 CFI_ADJUST_CFA_OFFSET 4
303 CFI_ADJUST_CFA_OFFSET 4
304 /*CFI_REL_OFFSET cs, 0*/
306 * Push current_thread_info()->sysenter_return to the stack.
307 * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
308 * pushed above; +8 corresponds to copy_thread's esp0 setting.
310 pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
311 CFI_ADJUST_CFA_OFFSET 4
312 CFI_REL_OFFSET eip, 0
315 CFI_ADJUST_CFA_OFFSET 4
317 ENABLE_INTERRUPTS(CLBR_NONE)
320 * Load the potential sixth argument from user stack.
321 * Careful about security.
323 cmpl $__PAGE_OFFSET-3,%ebp
326 movl %ebp,PT_EBP(%esp)
327 .section __ex_table,"a"
329 .long 1b,syscall_fault
332 GET_THREAD_INFO(%ebp)
334 /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
335 testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
336 jnz syscall_trace_entry
337 cmpl $(nr_syscalls), %eax
339 call *sys_call_table(,%eax,4)
340 movl %eax,PT_EAX(%esp)
342 DISABLE_INTERRUPTS(CLBR_ANY)
344 movl TI_flags(%ebp), %ecx
345 testw $_TIF_ALLWORK_MASK, %cx
346 jne syscall_exit_work
347 /* if something modifies registers it must also disable sysexit */
348 movl PT_EIP(%esp), %edx
349 movl PT_OLDESP(%esp), %ecx
352 1: mov PT_FS(%esp), %fs
353 ENABLE_INTERRUPTS_SYSEXIT
355 .pushsection .fixup,"ax"
356 2: movl $0,PT_FS(%esp)
358 .section __ex_table,"a"
362 ENDPROC(ia32_sysenter_target)
364 # system call handler stub
366 RING0_INT_FRAME # can't unwind into user space anyway
367 pushl %eax # save orig_eax
368 CFI_ADJUST_CFA_OFFSET 4
370 GET_THREAD_INFO(%ebp)
371 # system call tracing in operation / emulation
372 /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
373 testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
374 jnz syscall_trace_entry
375 cmpl $(nr_syscalls), %eax
378 call *sys_call_table(,%eax,4)
379 movl %eax,PT_EAX(%esp) # store the return value
382 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
383 # setting need_resched or sigpending
384 # between sampling and the iret
386 movl TI_flags(%ebp), %ecx
387 testw $_TIF_ALLWORK_MASK, %cx # current->work
388 jne syscall_exit_work
391 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS
392 # Warning: PT_OLDSS(%esp) contains the wrong/random values if we
393 # are returning to the kernel.
394 # See comments in process.c:copy_thread() for details.
395 movb PT_OLDSS(%esp), %ah
396 movb PT_CS(%esp), %al
397 andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
398 cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
400 je ldt_ss # returning to user-space with LDT SS
403 restore_nocheck_notrace:
405 addl $4, %esp # skip orig_eax/error_code
406 CFI_ADJUST_CFA_OFFSET -4
411 pushl $0 # no error code
415 .section __ex_table,"a"
417 .long irq_return,iret_exc
422 larl PT_OLDSS(%esp), %eax
424 testl $0x00400000, %eax # returning to 32bit stack?
425 jnz restore_nocheck # allright, normal return
427 #ifdef CONFIG_PARAVIRT
429 * The kernel can't run on a non-flat stack if paravirt mode
430 * is active. Rather than try to fixup the high bits of
431 * ESP, bypass this code entirely. This may break DOSemu
432 * and/or Wine support in a paravirt VM, although the option
433 * is still available to implement the setting of the high
434 * 16-bits in the INTERRUPT_RETURN paravirt-op.
436 cmpl $0, pv_info+PARAVIRT_enabled
440 /* If returning to userspace with 16bit stack,
441 * try to fix the higher word of ESP, as the CPU
443 * This is an "official" bug of all the x86-compatible
444 * CPUs, which we can try to work around to make
445 * dosemu and wine happy. */
446 movl PT_OLDESP(%esp), %eax
448 call patch_espfix_desc
450 CFI_ADJUST_CFA_OFFSET 4
452 CFI_ADJUST_CFA_OFFSET 4
453 DISABLE_INTERRUPTS(CLBR_EAX)
456 CFI_ADJUST_CFA_OFFSET -8
461 # perform work that needs to be done immediately before resumption
463 RING0_PTREGS_FRAME # can't unwind into user space anyway
465 testb $_TIF_NEED_RESCHED, %cl
470 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
471 # setting need_resched or sigpending
472 # between sampling and the iret
474 movl TI_flags(%ebp), %ecx
475 andl $_TIF_WORK_MASK, %ecx # is there any work to be done other
476 # than syscall tracing?
478 testb $_TIF_NEED_RESCHED, %cl
481 work_notifysig: # deal with pending signals and
482 # notify-resume requests
484 testl $X86_EFLAGS_VM, PT_EFLAGS(%esp)
486 jne work_notifysig_v86 # returning to kernel-space or
489 call do_notify_resume
490 jmp resume_userspace_sig
494 pushl %ecx # save ti_flags for do_notify_resume
495 CFI_ADJUST_CFA_OFFSET 4
496 call save_v86_state # %eax contains pt_regs pointer
498 CFI_ADJUST_CFA_OFFSET -4
504 call do_notify_resume
505 jmp resume_userspace_sig
508 # perform syscall exit tracing
511 movl $-ENOSYS,PT_EAX(%esp)
514 call do_syscall_trace
516 jne resume_userspace # ret != 0 -> running under PTRACE_SYSEMU,
517 # so must skip actual syscall
518 movl PT_ORIG_EAX(%esp), %eax
519 cmpl $(nr_syscalls), %eax
522 END(syscall_trace_entry)
524 # perform syscall exit tracing
527 testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl
530 ENABLE_INTERRUPTS(CLBR_ANY) # could let do_syscall_trace() call
534 call do_syscall_trace
536 END(syscall_exit_work)
539 RING0_INT_FRAME # can't unwind into user space anyway
541 GET_THREAD_INFO(%ebp)
542 movl $-EFAULT,PT_EAX(%esp)
547 movl $-ENOSYS,PT_EAX(%esp)
552 #define FIXUP_ESPFIX_STACK \
553 /* since we are on a wrong stack, we cant make it a C code :( */ \
554 PER_CPU(gdt_page, %ebx); \
555 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
557 pushl $__KERNEL_DS; \
558 CFI_ADJUST_CFA_OFFSET 4; \
560 CFI_ADJUST_CFA_OFFSET 4; \
562 CFI_ADJUST_CFA_OFFSET -8;
563 #define UNWIND_ESPFIX_STACK \
565 /* see if on espfix stack */ \
566 cmpw $__ESPFIX_SS, %ax; \
568 movl $__KERNEL_DS, %eax; \
571 /* switch to normal stack */ \
572 FIXUP_ESPFIX_STACK; \
576 * Build the entry stubs and pointer table with
577 * some assembler magic.
583 ENTRY(irq_entries_start)
589 CFI_ADJUST_CFA_OFFSET -4
592 CFI_ADJUST_CFA_OFFSET 4
599 END(irq_entries_start)
606 * the CPU automatically disables interrupts when executing an IRQ vector,
607 * so IRQ-flags tracing has to follow that:
616 ENDPROC(common_interrupt)
619 #define BUILD_INTERRUPT(name, nr) \
623 CFI_ADJUST_CFA_OFFSET 4; \
632 /* The include is where all of the SMP etc. interrupts come from */
633 #include "entry_arch.h"
635 KPROBE_ENTRY(page_fault)
638 CFI_ADJUST_CFA_OFFSET 4
641 /* the function address is in %fs's slot on the stack */
643 CFI_ADJUST_CFA_OFFSET 4
644 /*CFI_REL_OFFSET es, 0*/
646 CFI_ADJUST_CFA_OFFSET 4
647 /*CFI_REL_OFFSET ds, 0*/
649 CFI_ADJUST_CFA_OFFSET 4
650 CFI_REL_OFFSET eax, 0
652 CFI_ADJUST_CFA_OFFSET 4
653 CFI_REL_OFFSET ebp, 0
655 CFI_ADJUST_CFA_OFFSET 4
656 CFI_REL_OFFSET edi, 0
658 CFI_ADJUST_CFA_OFFSET 4
659 CFI_REL_OFFSET esi, 0
661 CFI_ADJUST_CFA_OFFSET 4
662 CFI_REL_OFFSET edx, 0
664 CFI_ADJUST_CFA_OFFSET 4
665 CFI_REL_OFFSET ecx, 0
667 CFI_ADJUST_CFA_OFFSET 4
668 CFI_REL_OFFSET ebx, 0
671 CFI_ADJUST_CFA_OFFSET 4
672 /*CFI_REL_OFFSET fs, 0*/
673 movl $(__KERNEL_PERCPU), %ecx
677 CFI_ADJUST_CFA_OFFSET -4
678 /*CFI_REGISTER es, ecx*/
679 movl PT_FS(%esp), %edi # get the function address
680 movl PT_ORIG_EAX(%esp), %edx # get the error code
681 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
682 mov %ecx, PT_FS(%esp)
683 /*CFI_REL_OFFSET fs, ES*/
684 movl $(__USER_DS), %ecx
687 movl %esp,%eax # pt_regs pointer
689 jmp ret_from_exception
691 KPROBE_END(page_fault)
693 ENTRY(coprocessor_error)
696 CFI_ADJUST_CFA_OFFSET 4
697 pushl $do_coprocessor_error
698 CFI_ADJUST_CFA_OFFSET 4
701 END(coprocessor_error)
703 ENTRY(simd_coprocessor_error)
706 CFI_ADJUST_CFA_OFFSET 4
707 pushl $do_simd_coprocessor_error
708 CFI_ADJUST_CFA_OFFSET 4
711 END(simd_coprocessor_error)
713 ENTRY(device_not_available)
715 pushl $-1 # mark this as an int
716 CFI_ADJUST_CFA_OFFSET 4
719 testl $0x4, %eax # EM (math emulation bit)
720 jne device_not_available_emulate
721 preempt_stop(CLBR_ANY)
722 call math_state_restore
723 jmp ret_from_exception
724 device_not_available_emulate:
725 pushl $0 # temporary storage for ORIG_EIP
726 CFI_ADJUST_CFA_OFFSET 4
729 CFI_ADJUST_CFA_OFFSET -4
730 jmp ret_from_exception
732 END(device_not_available)
735 * Debug traps and NMI can happen at the one SYSENTER instruction
736 * that sets up the real kernel stack. Check here, since we can't
737 * allow the wrong stack to be used.
739 * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
740 * already pushed 3 words if it hits on the sysenter instruction:
741 * eflags, cs and eip.
743 * We just load the right stack, and push the three (known) values
744 * by hand onto the new stack - while updating the return eip past
745 * the instruction that would have done it for sysenter.
747 #define FIX_STACK(offset, ok, label) \
748 cmpw $__KERNEL_CS,4(%esp); \
751 movl TSS_sysenter_sp0+offset(%esp),%esp; \
752 CFI_DEF_CFA esp, 0; \
755 CFI_ADJUST_CFA_OFFSET 4; \
756 pushl $__KERNEL_CS; \
757 CFI_ADJUST_CFA_OFFSET 4; \
758 pushl $sysenter_past_esp; \
759 CFI_ADJUST_CFA_OFFSET 4; \
760 CFI_REL_OFFSET eip, 0
764 cmpl $ia32_sysenter_target,(%esp)
765 jne debug_stack_correct
766 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
768 pushl $-1 # mark this as an int
769 CFI_ADJUST_CFA_OFFSET 4
771 xorl %edx,%edx # error code 0
772 movl %esp,%eax # pt_regs pointer
774 jmp ret_from_exception
779 * NMI is doubly nasty. It can happen _while_ we're handling
780 * a debug fault, and the debug fault hasn't yet been able to
781 * clear up the stack. So we first check whether we got an
782 * NMI on the sysenter entry path, but after that we need to
783 * check whether we got an NMI on the debug path where the debug
784 * fault happened on the sysenter path.
789 CFI_ADJUST_CFA_OFFSET 4
791 cmpw $__ESPFIX_SS, %ax
793 CFI_ADJUST_CFA_OFFSET -4
795 cmpl $ia32_sysenter_target,(%esp)
798 CFI_ADJUST_CFA_OFFSET 4
800 /* Do not access memory above the end of our stack page,
801 * it might not exist.
803 andl $(THREAD_SIZE-1),%eax
804 cmpl $(THREAD_SIZE-20),%eax
806 CFI_ADJUST_CFA_OFFSET -4
807 jae nmi_stack_correct
808 cmpl $ia32_sysenter_target,12(%esp)
809 je nmi_debug_stack_check
811 /* We have a RING0_INT_FRAME here */
813 CFI_ADJUST_CFA_OFFSET 4
815 xorl %edx,%edx # zero error code
816 movl %esp,%eax # pt_regs pointer
818 jmp restore_nocheck_notrace
823 FIX_STACK(12,nmi_stack_correct, 1)
824 jmp nmi_stack_correct
826 nmi_debug_stack_check:
827 /* We have a RING0_INT_FRAME here */
828 cmpw $__KERNEL_CS,16(%esp)
829 jne nmi_stack_correct
832 cmpl $debug_esp_fix_insn,(%esp)
834 FIX_STACK(24,nmi_stack_correct, 1)
835 jmp nmi_stack_correct
838 /* We have a RING0_INT_FRAME here.
840 * create the pointer to lss back
843 CFI_ADJUST_CFA_OFFSET 4
845 CFI_ADJUST_CFA_OFFSET 4
847 /* copy the iret frame of 12 bytes */
850 CFI_ADJUST_CFA_OFFSET 4
853 CFI_ADJUST_CFA_OFFSET 4
855 FIXUP_ESPFIX_STACK # %eax == %esp
856 xorl %edx,%edx # zero error code
859 lss 12+4(%esp), %esp # back to espfix stack
860 CFI_ADJUST_CFA_OFFSET -24
865 #ifdef CONFIG_PARAVIRT
868 .section __ex_table,"a"
870 .long native_iret, iret_exc
874 ENTRY(native_irq_enable_sysexit)
877 END(native_irq_enable_sysexit)
882 pushl $-1 # mark this as an int
883 CFI_ADJUST_CFA_OFFSET 4
885 xorl %edx,%edx # zero error code
886 movl %esp,%eax # pt_regs pointer
888 jmp ret_from_exception
895 CFI_ADJUST_CFA_OFFSET 4
897 CFI_ADJUST_CFA_OFFSET 4
905 CFI_ADJUST_CFA_OFFSET 4
907 CFI_ADJUST_CFA_OFFSET 4
915 CFI_ADJUST_CFA_OFFSET 4
917 CFI_ADJUST_CFA_OFFSET 4
922 ENTRY(coprocessor_segment_overrun)
925 CFI_ADJUST_CFA_OFFSET 4
926 pushl $do_coprocessor_segment_overrun
927 CFI_ADJUST_CFA_OFFSET 4
930 END(coprocessor_segment_overrun)
934 pushl $do_invalid_TSS
935 CFI_ADJUST_CFA_OFFSET 4
940 ENTRY(segment_not_present)
942 pushl $do_segment_not_present
943 CFI_ADJUST_CFA_OFFSET 4
946 END(segment_not_present)
950 pushl $do_stack_segment
951 CFI_ADJUST_CFA_OFFSET 4
956 KPROBE_ENTRY(general_protection)
958 pushl $do_general_protection
959 CFI_ADJUST_CFA_OFFSET 4
962 KPROBE_END(general_protection)
964 ENTRY(alignment_check)
966 pushl $do_alignment_check
967 CFI_ADJUST_CFA_OFFSET 4
974 pushl $0 # no error code
975 CFI_ADJUST_CFA_OFFSET 4
976 pushl $do_divide_error
977 CFI_ADJUST_CFA_OFFSET 4
982 #ifdef CONFIG_X86_MCE
986 CFI_ADJUST_CFA_OFFSET 4
987 pushl machine_check_vector
988 CFI_ADJUST_CFA_OFFSET 4
994 ENTRY(spurious_interrupt_bug)
997 CFI_ADJUST_CFA_OFFSET 4
998 pushl $do_spurious_interrupt_bug
999 CFI_ADJUST_CFA_OFFSET 4
1002 END(spurious_interrupt_bug)
1004 ENTRY(kernel_thread_helper)
1005 pushl $0 # fake return address for unwinder
1009 CFI_ADJUST_CFA_OFFSET 4
1012 CFI_ADJUST_CFA_OFFSET 4
1015 ENDPROC(kernel_thread_helper)
1018 /* Xen doesn't set %esp to be precisely what the normal sysenter
1019 entrypoint expects, so fix it up before using the normal path. */
1020 ENTRY(xen_sysenter_target)
1022 addl $5*4, %esp /* remove xen-provided frame */
1023 jmp sysenter_past_esp
1026 ENTRY(xen_hypervisor_callback)
1029 CFI_ADJUST_CFA_OFFSET 4
1033 /* Check to see if we got the event in the critical
1034 region in xen_iret_direct, after we've reenabled
1035 events and checked for pending events. This simulates
1036 iret instruction's behaviour where it delivers a
1037 pending interrupt when enabling interrupts. */
1038 movl PT_EIP(%esp),%eax
1039 cmpl $xen_iret_start_crit,%eax
1041 cmpl $xen_iret_end_crit,%eax
1044 jmp xen_iret_crit_fixup
1046 ENTRY(xen_do_upcall)
1048 call xen_evtchn_do_upcall
1051 ENDPROC(xen_hypervisor_callback)
1053 # Hypervisor uses this for application faults while it executes.
1054 # We get here for two reasons:
1055 # 1. Fault while reloading DS, ES, FS or GS
1056 # 2. Fault while executing IRET
1057 # Category 1 we fix up by reattempting the load, and zeroing the segment
1058 # register if the load fails.
1059 # Category 2 we fix up by jumping to do_iret_error. We cannot use the
1060 # normal Linux return path in this case because if we use the IRET hypercall
1061 # to pop the stack frame we end up in an infinite loop of failsafe callbacks.
1062 # We distinguish between categories by maintaining a status value in EAX.
1063 ENTRY(xen_failsafe_callback)
1066 CFI_ADJUST_CFA_OFFSET 4
1074 CFI_ADJUST_CFA_OFFSET -4
1076 CFI_ADJUST_CFA_OFFSET -16
1079 jmp iret_exc # EAX != 0 => Category 2 (Bad IRET)
1080 5: pushl $0 # EAX == 0 => Category 1 (Bad segment)
1081 CFI_ADJUST_CFA_OFFSET 4
1083 jmp ret_from_exception
1086 .section .fixup,"ax"
1100 .section __ex_table,"a"
1107 ENDPROC(xen_failsafe_callback)
1109 #endif /* CONFIG_XEN */
1111 #ifdef CONFIG_FTRACE
1112 #ifdef CONFIG_DYNAMIC_FTRACE
1118 movl 0xc(%esp), %eax
1119 subl $MCOUNT_INSN_SIZE, %eax
1132 ENTRY(ftrace_caller)
1136 movl 0xc(%esp), %eax
1137 movl 0x4(%ebp), %edx
1138 subl $MCOUNT_INSN_SIZE, %eax
1153 #else /* ! CONFIG_DYNAMIC_FTRACE */
1156 cmpl $ftrace_stub, ftrace_trace_function
1162 /* taken from glibc */
1167 movl 0xc(%esp), %eax
1168 movl 0x4(%ebp), %edx
1169 subl $MCOUNT_INSN_SIZE, %eax
1171 call *ftrace_trace_function
1179 #endif /* CONFIG_DYNAMIC_FTRACE */
1180 #endif /* CONFIG_FTRACE */
1182 .section .rodata,"a"
1183 #include "syscall_table_32.S"
1185 syscall_table_size=(.-sys_call_table)