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 testl $X86_EFLAGS_TF,PT_EFLAGS(%esp) # If tracing set singlestep flag on exit
388 orl $_TIF_SINGLESTEP,TI_flags(%ebp)
390 movl TI_flags(%ebp), %ecx
391 testw $_TIF_ALLWORK_MASK, %cx # current->work
392 jne syscall_exit_work
395 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS
396 # Warning: PT_OLDSS(%esp) contains the wrong/random values if we
397 # are returning to the kernel.
398 # See comments in process.c:copy_thread() for details.
399 movb PT_OLDSS(%esp), %ah
400 movb PT_CS(%esp), %al
401 andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
402 cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
404 je ldt_ss # returning to user-space with LDT SS
407 restore_nocheck_notrace:
409 addl $4, %esp # skip orig_eax/error_code
410 CFI_ADJUST_CFA_OFFSET -4
415 pushl $0 # no error code
419 .section __ex_table,"a"
421 .long irq_return,iret_exc
426 larl PT_OLDSS(%esp), %eax
428 testl $0x00400000, %eax # returning to 32bit stack?
429 jnz restore_nocheck # allright, normal return
431 #ifdef CONFIG_PARAVIRT
433 * The kernel can't run on a non-flat stack if paravirt mode
434 * is active. Rather than try to fixup the high bits of
435 * ESP, bypass this code entirely. This may break DOSemu
436 * and/or Wine support in a paravirt VM, although the option
437 * is still available to implement the setting of the high
438 * 16-bits in the INTERRUPT_RETURN paravirt-op.
440 cmpl $0, pv_info+PARAVIRT_enabled
444 /* If returning to userspace with 16bit stack,
445 * try to fix the higher word of ESP, as the CPU
447 * This is an "official" bug of all the x86-compatible
448 * CPUs, which we can try to work around to make
449 * dosemu and wine happy. */
450 movl PT_OLDESP(%esp), %eax
452 call patch_espfix_desc
454 CFI_ADJUST_CFA_OFFSET 4
456 CFI_ADJUST_CFA_OFFSET 4
457 DISABLE_INTERRUPTS(CLBR_EAX)
460 CFI_ADJUST_CFA_OFFSET -8
465 # perform work that needs to be done immediately before resumption
467 RING0_PTREGS_FRAME # can't unwind into user space anyway
469 testb $_TIF_NEED_RESCHED, %cl
474 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
475 # setting need_resched or sigpending
476 # between sampling and the iret
478 movl TI_flags(%ebp), %ecx
479 andl $_TIF_WORK_MASK, %ecx # is there any work to be done other
480 # than syscall tracing?
482 testb $_TIF_NEED_RESCHED, %cl
485 work_notifysig: # deal with pending signals and
486 # notify-resume requests
488 testl $X86_EFLAGS_VM, PT_EFLAGS(%esp)
490 jne work_notifysig_v86 # returning to kernel-space or
493 call do_notify_resume
494 jmp resume_userspace_sig
498 pushl %ecx # save ti_flags for do_notify_resume
499 CFI_ADJUST_CFA_OFFSET 4
500 call save_v86_state # %eax contains pt_regs pointer
502 CFI_ADJUST_CFA_OFFSET -4
508 call do_notify_resume
509 jmp resume_userspace_sig
512 # perform syscall exit tracing
515 movl $-ENOSYS,PT_EAX(%esp)
518 call do_syscall_trace
520 jne resume_userspace # ret != 0 -> running under PTRACE_SYSEMU,
521 # so must skip actual syscall
522 movl PT_ORIG_EAX(%esp), %eax
523 cmpl $(nr_syscalls), %eax
526 END(syscall_trace_entry)
528 # perform syscall exit tracing
531 testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl
534 ENABLE_INTERRUPTS(CLBR_ANY) # could let do_syscall_trace() call
538 call do_syscall_trace
540 END(syscall_exit_work)
543 RING0_INT_FRAME # can't unwind into user space anyway
545 GET_THREAD_INFO(%ebp)
546 movl $-EFAULT,PT_EAX(%esp)
551 movl $-ENOSYS,PT_EAX(%esp)
556 #define FIXUP_ESPFIX_STACK \
557 /* since we are on a wrong stack, we cant make it a C code :( */ \
558 PER_CPU(gdt_page, %ebx); \
559 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
561 pushl $__KERNEL_DS; \
562 CFI_ADJUST_CFA_OFFSET 4; \
564 CFI_ADJUST_CFA_OFFSET 4; \
566 CFI_ADJUST_CFA_OFFSET -8;
567 #define UNWIND_ESPFIX_STACK \
569 /* see if on espfix stack */ \
570 cmpw $__ESPFIX_SS, %ax; \
572 movl $__KERNEL_DS, %eax; \
575 /* switch to normal stack */ \
576 FIXUP_ESPFIX_STACK; \
580 * Build the entry stubs and pointer table with
581 * some assembler magic.
587 ENTRY(irq_entries_start)
593 CFI_ADJUST_CFA_OFFSET -4
596 CFI_ADJUST_CFA_OFFSET 4
603 END(irq_entries_start)
610 * the CPU automatically disables interrupts when executing an IRQ vector,
611 * so IRQ-flags tracing has to follow that:
620 ENDPROC(common_interrupt)
623 #define BUILD_INTERRUPT(name, nr) \
627 CFI_ADJUST_CFA_OFFSET 4; \
636 /* The include is where all of the SMP etc. interrupts come from */
637 #include "entry_arch.h"
639 KPROBE_ENTRY(page_fault)
642 CFI_ADJUST_CFA_OFFSET 4
645 /* the function address is in %fs's slot on the stack */
647 CFI_ADJUST_CFA_OFFSET 4
648 /*CFI_REL_OFFSET es, 0*/
650 CFI_ADJUST_CFA_OFFSET 4
651 /*CFI_REL_OFFSET ds, 0*/
653 CFI_ADJUST_CFA_OFFSET 4
654 CFI_REL_OFFSET eax, 0
656 CFI_ADJUST_CFA_OFFSET 4
657 CFI_REL_OFFSET ebp, 0
659 CFI_ADJUST_CFA_OFFSET 4
660 CFI_REL_OFFSET edi, 0
662 CFI_ADJUST_CFA_OFFSET 4
663 CFI_REL_OFFSET esi, 0
665 CFI_ADJUST_CFA_OFFSET 4
666 CFI_REL_OFFSET edx, 0
668 CFI_ADJUST_CFA_OFFSET 4
669 CFI_REL_OFFSET ecx, 0
671 CFI_ADJUST_CFA_OFFSET 4
672 CFI_REL_OFFSET ebx, 0
675 CFI_ADJUST_CFA_OFFSET 4
676 /*CFI_REL_OFFSET fs, 0*/
677 movl $(__KERNEL_PERCPU), %ecx
681 CFI_ADJUST_CFA_OFFSET -4
682 /*CFI_REGISTER es, ecx*/
683 movl PT_FS(%esp), %edi # get the function address
684 movl PT_ORIG_EAX(%esp), %edx # get the error code
685 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
686 mov %ecx, PT_FS(%esp)
687 /*CFI_REL_OFFSET fs, ES*/
688 movl $(__USER_DS), %ecx
691 movl %esp,%eax # pt_regs pointer
693 jmp ret_from_exception
695 KPROBE_END(page_fault)
697 ENTRY(coprocessor_error)
700 CFI_ADJUST_CFA_OFFSET 4
701 pushl $do_coprocessor_error
702 CFI_ADJUST_CFA_OFFSET 4
705 END(coprocessor_error)
707 ENTRY(simd_coprocessor_error)
710 CFI_ADJUST_CFA_OFFSET 4
711 pushl $do_simd_coprocessor_error
712 CFI_ADJUST_CFA_OFFSET 4
715 END(simd_coprocessor_error)
717 ENTRY(device_not_available)
719 pushl $-1 # mark this as an int
720 CFI_ADJUST_CFA_OFFSET 4
723 testl $0x4, %eax # EM (math emulation bit)
724 jne device_not_available_emulate
725 preempt_stop(CLBR_ANY)
726 call math_state_restore
727 jmp ret_from_exception
728 device_not_available_emulate:
729 pushl $0 # temporary storage for ORIG_EIP
730 CFI_ADJUST_CFA_OFFSET 4
733 CFI_ADJUST_CFA_OFFSET -4
734 jmp ret_from_exception
736 END(device_not_available)
739 * Debug traps and NMI can happen at the one SYSENTER instruction
740 * that sets up the real kernel stack. Check here, since we can't
741 * allow the wrong stack to be used.
743 * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
744 * already pushed 3 words if it hits on the sysenter instruction:
745 * eflags, cs and eip.
747 * We just load the right stack, and push the three (known) values
748 * by hand onto the new stack - while updating the return eip past
749 * the instruction that would have done it for sysenter.
751 #define FIX_STACK(offset, ok, label) \
752 cmpw $__KERNEL_CS,4(%esp); \
755 movl TSS_sysenter_sp0+offset(%esp),%esp; \
756 CFI_DEF_CFA esp, 0; \
759 CFI_ADJUST_CFA_OFFSET 4; \
760 pushl $__KERNEL_CS; \
761 CFI_ADJUST_CFA_OFFSET 4; \
762 pushl $sysenter_past_esp; \
763 CFI_ADJUST_CFA_OFFSET 4; \
764 CFI_REL_OFFSET eip, 0
768 cmpl $ia32_sysenter_target,(%esp)
769 jne debug_stack_correct
770 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
772 pushl $-1 # mark this as an int
773 CFI_ADJUST_CFA_OFFSET 4
775 xorl %edx,%edx # error code 0
776 movl %esp,%eax # pt_regs pointer
778 jmp ret_from_exception
783 * NMI is doubly nasty. It can happen _while_ we're handling
784 * a debug fault, and the debug fault hasn't yet been able to
785 * clear up the stack. So we first check whether we got an
786 * NMI on the sysenter entry path, but after that we need to
787 * check whether we got an NMI on the debug path where the debug
788 * fault happened on the sysenter path.
793 CFI_ADJUST_CFA_OFFSET 4
795 cmpw $__ESPFIX_SS, %ax
797 CFI_ADJUST_CFA_OFFSET -4
799 cmpl $ia32_sysenter_target,(%esp)
802 CFI_ADJUST_CFA_OFFSET 4
804 /* Do not access memory above the end of our stack page,
805 * it might not exist.
807 andl $(THREAD_SIZE-1),%eax
808 cmpl $(THREAD_SIZE-20),%eax
810 CFI_ADJUST_CFA_OFFSET -4
811 jae nmi_stack_correct
812 cmpl $ia32_sysenter_target,12(%esp)
813 je nmi_debug_stack_check
815 /* We have a RING0_INT_FRAME here */
817 CFI_ADJUST_CFA_OFFSET 4
819 xorl %edx,%edx # zero error code
820 movl %esp,%eax # pt_regs pointer
822 jmp restore_nocheck_notrace
827 FIX_STACK(12,nmi_stack_correct, 1)
828 jmp nmi_stack_correct
830 nmi_debug_stack_check:
831 /* We have a RING0_INT_FRAME here */
832 cmpw $__KERNEL_CS,16(%esp)
833 jne nmi_stack_correct
836 cmpl $debug_esp_fix_insn,(%esp)
838 FIX_STACK(24,nmi_stack_correct, 1)
839 jmp nmi_stack_correct
842 /* We have a RING0_INT_FRAME here.
844 * create the pointer to lss back
847 CFI_ADJUST_CFA_OFFSET 4
849 CFI_ADJUST_CFA_OFFSET 4
851 /* copy the iret frame of 12 bytes */
854 CFI_ADJUST_CFA_OFFSET 4
857 CFI_ADJUST_CFA_OFFSET 4
859 FIXUP_ESPFIX_STACK # %eax == %esp
860 xorl %edx,%edx # zero error code
863 lss 12+4(%esp), %esp # back to espfix stack
864 CFI_ADJUST_CFA_OFFSET -24
869 #ifdef CONFIG_PARAVIRT
872 .section __ex_table,"a"
874 .long native_iret, iret_exc
878 ENTRY(native_irq_enable_sysexit)
881 END(native_irq_enable_sysexit)
886 pushl $-1 # mark this as an int
887 CFI_ADJUST_CFA_OFFSET 4
889 xorl %edx,%edx # zero error code
890 movl %esp,%eax # pt_regs pointer
892 jmp ret_from_exception
899 CFI_ADJUST_CFA_OFFSET 4
901 CFI_ADJUST_CFA_OFFSET 4
909 CFI_ADJUST_CFA_OFFSET 4
911 CFI_ADJUST_CFA_OFFSET 4
919 CFI_ADJUST_CFA_OFFSET 4
921 CFI_ADJUST_CFA_OFFSET 4
926 ENTRY(coprocessor_segment_overrun)
929 CFI_ADJUST_CFA_OFFSET 4
930 pushl $do_coprocessor_segment_overrun
931 CFI_ADJUST_CFA_OFFSET 4
934 END(coprocessor_segment_overrun)
938 pushl $do_invalid_TSS
939 CFI_ADJUST_CFA_OFFSET 4
944 ENTRY(segment_not_present)
946 pushl $do_segment_not_present
947 CFI_ADJUST_CFA_OFFSET 4
950 END(segment_not_present)
954 pushl $do_stack_segment
955 CFI_ADJUST_CFA_OFFSET 4
960 KPROBE_ENTRY(general_protection)
962 pushl $do_general_protection
963 CFI_ADJUST_CFA_OFFSET 4
966 KPROBE_END(general_protection)
968 ENTRY(alignment_check)
970 pushl $do_alignment_check
971 CFI_ADJUST_CFA_OFFSET 4
978 pushl $0 # no error code
979 CFI_ADJUST_CFA_OFFSET 4
980 pushl $do_divide_error
981 CFI_ADJUST_CFA_OFFSET 4
986 #ifdef CONFIG_X86_MCE
990 CFI_ADJUST_CFA_OFFSET 4
991 pushl machine_check_vector
992 CFI_ADJUST_CFA_OFFSET 4
998 ENTRY(spurious_interrupt_bug)
1001 CFI_ADJUST_CFA_OFFSET 4
1002 pushl $do_spurious_interrupt_bug
1003 CFI_ADJUST_CFA_OFFSET 4
1006 END(spurious_interrupt_bug)
1008 ENTRY(kernel_thread_helper)
1009 pushl $0 # fake return address for unwinder
1013 CFI_ADJUST_CFA_OFFSET 4
1016 CFI_ADJUST_CFA_OFFSET 4
1019 ENDPROC(kernel_thread_helper)
1022 /* Xen doesn't set %esp to be precisely what the normal sysenter
1023 entrypoint expects, so fix it up before using the normal path. */
1024 ENTRY(xen_sysenter_target)
1026 addl $5*4, %esp /* remove xen-provided frame */
1027 jmp sysenter_past_esp
1030 ENTRY(xen_hypervisor_callback)
1033 CFI_ADJUST_CFA_OFFSET 4
1037 /* Check to see if we got the event in the critical
1038 region in xen_iret_direct, after we've reenabled
1039 events and checked for pending events. This simulates
1040 iret instruction's behaviour where it delivers a
1041 pending interrupt when enabling interrupts. */
1042 movl PT_EIP(%esp),%eax
1043 cmpl $xen_iret_start_crit,%eax
1045 cmpl $xen_iret_end_crit,%eax
1048 jmp xen_iret_crit_fixup
1050 ENTRY(xen_do_upcall)
1052 call xen_evtchn_do_upcall
1055 ENDPROC(xen_hypervisor_callback)
1057 # Hypervisor uses this for application faults while it executes.
1058 # We get here for two reasons:
1059 # 1. Fault while reloading DS, ES, FS or GS
1060 # 2. Fault while executing IRET
1061 # Category 1 we fix up by reattempting the load, and zeroing the segment
1062 # register if the load fails.
1063 # Category 2 we fix up by jumping to do_iret_error. We cannot use the
1064 # normal Linux return path in this case because if we use the IRET hypercall
1065 # to pop the stack frame we end up in an infinite loop of failsafe callbacks.
1066 # We distinguish between categories by maintaining a status value in EAX.
1067 ENTRY(xen_failsafe_callback)
1070 CFI_ADJUST_CFA_OFFSET 4
1078 CFI_ADJUST_CFA_OFFSET -4
1080 CFI_ADJUST_CFA_OFFSET -16
1083 jmp iret_exc # EAX != 0 => Category 2 (Bad IRET)
1084 5: pushl $0 # EAX == 0 => Category 1 (Bad segment)
1085 CFI_ADJUST_CFA_OFFSET 4
1087 jmp ret_from_exception
1090 .section .fixup,"ax"
1104 .section __ex_table,"a"
1111 ENDPROC(xen_failsafe_callback)
1113 #endif /* CONFIG_XEN */
1115 #ifdef CONFIG_FTRACE
1116 #ifdef CONFIG_DYNAMIC_FTRACE
1122 movl 0xc(%esp), %eax
1123 subl $MCOUNT_INSN_SIZE, %eax
1136 ENTRY(ftrace_caller)
1140 movl 0xc(%esp), %eax
1141 movl 0x4(%ebp), %edx
1142 subl $MCOUNT_INSN_SIZE, %eax
1157 #else /* ! CONFIG_DYNAMIC_FTRACE */
1160 cmpl $ftrace_stub, ftrace_trace_function
1166 /* taken from glibc */
1171 movl 0xc(%esp), %eax
1172 movl 0x4(%ebp), %edx
1173 subl $MCOUNT_INSN_SIZE, %eax
1175 call *ftrace_trace_function
1183 #endif /* CONFIG_DYNAMIC_FTRACE */
1184 #endif /* CONFIG_FTRACE */
1186 .section .rodata,"a"
1187 #include "syscall_table_32.S"
1189 syscall_table_size=(.-sys_call_table)