2 * linux/arch/x86_64/entry.S
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
6 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz>
10 * entry.S contains the system-call and fault low-level handling routines.
12 * NOTE: This code handles signal-recognition, which happens every time
13 * after an interrupt and after each system call.
15 * Normal syscalls and interrupts don't save a full stack frame, this is
16 * only done for syscall tracing, signals or fork/exec et.al.
18 * A note on terminology:
19 * - top of stack: Architecture defined interrupt frame from SS to RIP
20 * at the top of the kernel process stack.
21 * - partial stack frame: partially saved registers upto R11.
22 * - full stack frame: Like partial stack frame, but all register saved.
25 * - CFI macros are used to generate dwarf2 unwind information for better
26 * backtraces. They don't change any code.
27 * - SAVE_ALL/RESTORE_ALL - Save/restore all registers
28 * - SAVE_ARGS/RESTORE_ARGS - Save/restore registers that C functions modify.
29 * There are unfortunately lots of special cases where some registers
30 * not touched. The macro is a big mess that should be cleaned up.
31 * - SAVE_REST/RESTORE_REST - Handle the registers not saved by SAVE_ARGS.
32 * Gives a full stack frame.
33 * - ENTRY/END Define functions in the symbol table.
34 * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack
35 * frame that is otherwise undefined after a SYSCALL
36 * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging.
37 * - errorentry/paranoidentry/zeroentry - Define exception entry points.
40 #include <linux/linkage.h>
41 #include <asm/segment.h>
42 #include <asm/cache.h>
43 #include <asm/errno.h>
44 #include <asm/dwarf2.h>
45 #include <asm/calling.h>
46 #include <asm/asm-offsets.h>
48 #include <asm/unistd.h>
49 #include <asm/thread_info.h>
50 #include <asm/hw_irq.h>
52 #include <asm/irqflags.h>
56 #ifndef CONFIG_PREEMPT
57 #define retint_kernel retint_restore_args
61 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET
62 #ifdef CONFIG_TRACE_IRQFLAGS
63 bt $9,EFLAGS-\offset(%rsp) /* interrupts off? */
71 * C code is not supposed to know about undefined top of stack. Every time
72 * a C function with an pt_regs argument is called from the SYSCALL based
73 * fast path FIXUP_TOP_OF_STACK is needed.
74 * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
78 /* %rsp:at FRAMEEND */
79 .macro FIXUP_TOP_OF_STACK tmp
80 movq %gs:pda_oldrsp,\tmp
82 movq $__USER_DS,SS(%rsp)
83 movq $__USER_CS,CS(%rsp)
85 movq R11(%rsp),\tmp /* get eflags */
86 movq \tmp,EFLAGS(%rsp)
89 .macro RESTORE_TOP_OF_STACK tmp,offset=0
90 movq RSP-\offset(%rsp),\tmp
91 movq \tmp,%gs:pda_oldrsp
92 movq EFLAGS-\offset(%rsp),\tmp
93 movq \tmp,R11-\offset(%rsp)
96 .macro FAKE_STACK_FRAME child_rip
97 /* push in order ss, rsp, eflags, cs, rip */
100 CFI_ADJUST_CFA_OFFSET 8
101 /*CFI_REL_OFFSET ss,0*/
103 CFI_ADJUST_CFA_OFFSET 8
105 pushq $(1<<9) /* eflags - interrupts on */
106 CFI_ADJUST_CFA_OFFSET 8
107 /*CFI_REL_OFFSET rflags,0*/
108 pushq $__KERNEL_CS /* cs */
109 CFI_ADJUST_CFA_OFFSET 8
110 /*CFI_REL_OFFSET cs,0*/
111 pushq \child_rip /* rip */
112 CFI_ADJUST_CFA_OFFSET 8
114 pushq %rax /* orig rax */
115 CFI_ADJUST_CFA_OFFSET 8
118 .macro UNFAKE_STACK_FRAME
120 CFI_ADJUST_CFA_OFFSET -(6*8)
123 .macro CFI_DEFAULT_STACK start=1
129 CFI_DEF_CFA_OFFSET SS+8
131 CFI_REL_OFFSET r15,R15
132 CFI_REL_OFFSET r14,R14
133 CFI_REL_OFFSET r13,R13
134 CFI_REL_OFFSET r12,R12
135 CFI_REL_OFFSET rbp,RBP
136 CFI_REL_OFFSET rbx,RBX
137 CFI_REL_OFFSET r11,R11
138 CFI_REL_OFFSET r10,R10
141 CFI_REL_OFFSET rax,RAX
142 CFI_REL_OFFSET rcx,RCX
143 CFI_REL_OFFSET rdx,RDX
144 CFI_REL_OFFSET rsi,RSI
145 CFI_REL_OFFSET rdi,RDI
146 CFI_REL_OFFSET rip,RIP
147 /*CFI_REL_OFFSET cs,CS*/
148 /*CFI_REL_OFFSET rflags,EFLAGS*/
149 CFI_REL_OFFSET rsp,RSP
150 /*CFI_REL_OFFSET ss,SS*/
153 * A newly forked process directly context switches into this.
158 push kernel_eflags(%rip)
159 CFI_ADJUST_CFA_OFFSET 4
160 popf # reset kernel eflags
161 CFI_ADJUST_CFA_OFFSET -4
163 GET_THREAD_INFO(%rcx)
164 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx)
168 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread?
169 je int_ret_from_sys_call
170 testl $_TIF_IA32,threadinfo_flags(%rcx)
171 jnz int_ret_from_sys_call
172 RESTORE_TOP_OF_STACK %rdi,ARGOFFSET
173 jmp ret_from_sys_call
176 call syscall_trace_leave
177 GET_THREAD_INFO(%rcx)
183 * System call entry. Upto 6 arguments in registers are supported.
185 * SYSCALL does not save anything on the stack and does not change the
191 * rax system call number
193 * rcx return address for syscall/sysret, C arg3
196 * r10 arg3 (--> moved to rcx for C)
199 * r11 eflags for syscall/sysret, temporary for C
200 * r12-r15,rbp,rbx saved by C code, not touched.
202 * Interrupts are off on entry.
203 * Only called from user space.
205 * XXX if we had a free scratch register we could save the RSP into the stack frame
206 * and report it properly in ps. Unfortunately we haven't.
208 * When user can change the frames always force IRET. That is because
209 * it deals with uncanonical addresses better. SYSRET has trouble
210 * with them due to bugs in both AMD and Intel CPUs.
216 CFI_DEF_CFA rsp,PDA_STACKOFFSET
218 /*CFI_REGISTER rflags,r11*/
220 movq %rsp,%gs:pda_oldrsp
221 movq %gs:pda_kernelstack,%rsp
223 * No need to follow this irqs off/on section - it's straight
228 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
229 movq %rcx,RIP-ARGOFFSET(%rsp)
230 CFI_REL_OFFSET rip,RIP-ARGOFFSET
231 GET_THREAD_INFO(%rcx)
232 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
234 cmpq $__NR_syscall_max,%rax
237 call *sys_call_table(,%rax,8) # XXX: rip relative
238 movq %rax,RAX-ARGOFFSET(%rsp)
240 * Syscall return path ending with SYSRET (fast path)
241 * Has incomplete stack frame and undefined top of stack.
244 movl $_TIF_ALLWORK_MASK,%edi
247 GET_THREAD_INFO(%rcx)
250 movl threadinfo_flags(%rcx),%edx
255 * sysretq will re-enable interrupts:
258 movq RIP-ARGOFFSET(%rsp),%rcx
260 RESTORE_ARGS 0,-ARG_SKIP,1
261 /*CFI_REGISTER rflags,r11*/
262 movq %gs:pda_oldrsp,%rsp
267 /* Handle reschedules */
268 /* edx: work, edi: workmask */
270 bt $TIF_NEED_RESCHED,%edx
275 CFI_ADJUST_CFA_OFFSET 8
278 CFI_ADJUST_CFA_OFFSET -8
281 /* Handle a signal */
285 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
288 /* Really a signal */
289 /* edx: work flags (arg3) */
290 leaq do_notify_resume(%rip),%rax
291 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
292 xorl %esi,%esi # oldset -> arg2
293 call ptregscall_common
294 1: movl $_TIF_NEED_RESCHED,%edi
295 /* Use IRET because user could have changed frame. This
296 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
302 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
303 jmp ret_from_sys_call
305 /* Do syscall tracing */
308 movq $-ENOSYS,RAX(%rsp)
309 FIXUP_TOP_OF_STACK %rdi
311 call syscall_trace_enter
312 LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */
314 cmpq $__NR_syscall_max,%rax
318 movq %r10,%rcx /* fixup for C */
319 call *sys_call_table(,%rax,8)
320 1: movq %rax,RAX-ARGOFFSET(%rsp)
321 /* Use IRET because user could have changed frame */
324 * Syscall return path ending with IRET.
325 * Has correct top of stack, but partial stack frame.
327 .globl int_ret_from_sys_call
328 int_ret_from_sys_call:
331 testl $3,CS-ARGOFFSET(%rsp)
332 je retint_restore_args
333 movl $_TIF_ALLWORK_MASK,%edi
334 /* edi: mask to check */
336 GET_THREAD_INFO(%rcx)
337 movl threadinfo_flags(%rcx),%edx
340 andl $~TS_COMPAT,threadinfo_status(%rcx)
343 /* Either reschedule or signal or syscall exit tracking needed. */
344 /* First do a reschedule test. */
345 /* edx: work, edi: workmask */
347 bt $TIF_NEED_RESCHED,%edx
352 CFI_ADJUST_CFA_OFFSET 8
355 CFI_ADJUST_CFA_OFFSET -8
360 /* handle signals and tracing -- both require a full stack frame */
365 /* Check for syscall exit trace */
366 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx
369 CFI_ADJUST_CFA_OFFSET 8
370 leaq 8(%rsp),%rdi # &ptregs -> arg1
371 call syscall_trace_leave
373 CFI_ADJUST_CFA_OFFSET -8
374 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
378 testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx
380 movq %rsp,%rdi # &ptregs -> arg1
381 xorl %esi,%esi # oldset -> arg2
382 call do_notify_resume
383 1: movl $_TIF_NEED_RESCHED,%edi
393 * Certain special system calls that need to save a complete full stack frame.
396 .macro PTREGSCALL label,func,arg
399 leaq \func(%rip),%rax
400 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
401 jmp ptregscall_common
407 PTREGSCALL stub_clone, sys_clone, %r8
408 PTREGSCALL stub_fork, sys_fork, %rdi
409 PTREGSCALL stub_vfork, sys_vfork, %rdi
410 PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend, %rdx
411 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
412 PTREGSCALL stub_iopl, sys_iopl, %rsi
414 ENTRY(ptregscall_common)
416 CFI_ADJUST_CFA_OFFSET -8
417 CFI_REGISTER rip, r11
420 CFI_REGISTER rip, r15
421 FIXUP_TOP_OF_STACK %r11
423 RESTORE_TOP_OF_STACK %r11
425 CFI_REGISTER rip, r11
428 CFI_ADJUST_CFA_OFFSET 8
429 CFI_REL_OFFSET rip, 0
432 END(ptregscall_common)
437 CFI_ADJUST_CFA_OFFSET -8
438 CFI_REGISTER rip, r11
440 FIXUP_TOP_OF_STACK %r11
442 RESTORE_TOP_OF_STACK %r11
445 jmp int_ret_from_sys_call
450 * sigreturn is special because it needs to restore all registers on return.
451 * This cannot be done with SYSRET, so use the IRET return path instead.
453 ENTRY(stub_rt_sigreturn)
456 CFI_ADJUST_CFA_OFFSET -8
459 FIXUP_TOP_OF_STACK %r11
460 call sys_rt_sigreturn
461 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
463 jmp int_ret_from_sys_call
465 END(stub_rt_sigreturn)
468 * initial frame state for interrupts and exceptions
473 CFI_DEF_CFA rsp,SS+8-\ref
474 /*CFI_REL_OFFSET ss,SS-\ref*/
475 CFI_REL_OFFSET rsp,RSP-\ref
476 /*CFI_REL_OFFSET rflags,EFLAGS-\ref*/
477 /*CFI_REL_OFFSET cs,CS-\ref*/
478 CFI_REL_OFFSET rip,RIP-\ref
481 /* initial frame state for interrupts (and exceptions without error code) */
482 #define INTR_FRAME _frame RIP
483 /* initial frame state for exceptions with error code (and interrupts with
484 vector already pushed) */
485 #define XCPT_FRAME _frame ORIG_RAX
488 * Interrupt entry/exit.
490 * Interrupt entry points save only callee clobbered registers in fast path.
492 * Entry runs with interrupts off.
495 /* 0(%rsp): interrupt number */
496 .macro interrupt func
499 leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler
501 CFI_ADJUST_CFA_OFFSET 8
502 CFI_REL_OFFSET rbp, 0
504 CFI_DEF_CFA_REGISTER rbp
508 /* irqcount is used to check if a CPU is already on an interrupt
509 stack or not. While this is essentially redundant with preempt_count
510 it is a little cheaper to use a separate counter in the PDA
511 (short of moving irq_enter into assembly, which would be too
513 1: incl %gs:pda_irqcount
514 cmoveq %gs:pda_irqstackptr,%rsp
515 push %rbp # backlink for old unwinder
517 * We entered an interrupt context - irqs are off:
523 ENTRY(common_interrupt)
526 /* 0(%rsp): oldrsp-ARGOFFSET */
530 decl %gs:pda_irqcount
532 CFI_DEF_CFA_REGISTER rsp
533 CFI_ADJUST_CFA_OFFSET -8
535 GET_THREAD_INFO(%rcx)
536 testl $3,CS-ARGOFFSET(%rsp)
539 /* Interrupt came from user space */
541 * Has a correct top of stack, but a partial stack frame
542 * %rcx: thread info. Interrupts off.
544 retint_with_reschedule:
545 movl $_TIF_WORK_MASK,%edi
547 movl threadinfo_flags(%rcx),%edx
553 * The iretq could re-enable interrupts:
563 * The iretq could re-enable interrupts:
571 .section __ex_table,"a"
572 .quad iret_label,bad_iret
575 /* force a signal here? this matches i386 behaviour */
576 /* running with kernel gs */
578 movq $11,%rdi /* SIGSEGV */
584 /* edi: workmask, edx: work */
587 bt $TIF_NEED_RESCHED,%edx
592 CFI_ADJUST_CFA_OFFSET 8
595 CFI_ADJUST_CFA_OFFSET -8
596 GET_THREAD_INFO(%rcx)
602 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
607 movq $-1,ORIG_RAX(%rsp)
608 xorl %esi,%esi # oldset
609 movq %rsp,%rdi # &pt_regs
610 call do_notify_resume
614 movl $_TIF_NEED_RESCHED,%edi
615 GET_THREAD_INFO(%rcx)
618 #ifdef CONFIG_PREEMPT
619 /* Returning to kernel space. Check if we need preemption */
620 /* rcx: threadinfo. interrupts off. */
622 cmpl $0,threadinfo_preempt_count(%rcx)
623 jnz retint_restore_args
624 bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx)
625 jnc retint_restore_args
626 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
627 jnc retint_restore_args
628 call preempt_schedule_irq
633 END(common_interrupt)
638 .macro apicinterrupt num,func
641 CFI_ADJUST_CFA_OFFSET 8
647 ENTRY(thermal_interrupt)
648 apicinterrupt THERMAL_APIC_VECTOR,smp_thermal_interrupt
649 END(thermal_interrupt)
651 ENTRY(threshold_interrupt)
652 apicinterrupt THRESHOLD_APIC_VECTOR,mce_threshold_interrupt
653 END(threshold_interrupt)
656 ENTRY(reschedule_interrupt)
657 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
658 END(reschedule_interrupt)
660 .macro INVALIDATE_ENTRY num
661 ENTRY(invalidate_interrupt\num)
662 apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt
663 END(invalidate_interrupt\num)
675 ENTRY(call_function_interrupt)
676 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
677 END(call_function_interrupt)
680 ENTRY(apic_timer_interrupt)
681 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
682 END(apic_timer_interrupt)
684 ENTRY(error_interrupt)
685 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt
688 ENTRY(spurious_interrupt)
689 apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
690 END(spurious_interrupt)
693 * Exception entry points.
697 pushq $0 /* push error code/oldrax */
698 CFI_ADJUST_CFA_OFFSET 8
699 pushq %rax /* push real oldrax to the rdi slot */
700 CFI_ADJUST_CFA_OFFSET 8
706 .macro errorentry sym
709 CFI_ADJUST_CFA_OFFSET 8
715 /* error code is on the stack already */
716 /* handle NMI like exceptions that can happen everywhere */
717 .macro paranoidentry sym, ist=0, irqtrace=1
721 movl $MSR_GS_BASE,%ecx
729 movq %gs:pda_data_offset, %rbp
732 movq ORIG_RAX(%rsp),%rsi
733 movq $-1,ORIG_RAX(%rsp)
735 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
739 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
748 * "Paranoid" exit path from exception stack.
749 * Paranoid because this is used by NMIs and cannot take
750 * any kernel state for granted.
751 * We don't do kernel preemption checks here, because only
752 * NMI should be common and it does not enable IRQs and
753 * cannot get reschedule ticks.
755 * "trace" is 0 for the NMI handler only, because irq-tracing
756 * is fundamentally NMI-unsafe. (we cannot change the soft and
757 * hard flags at once, atomically)
759 .macro paranoidexit trace=1
760 /* ebx: no swapgs flag */
762 testl %ebx,%ebx /* swapgs needed? */
763 jnz paranoid_restore\trace
765 jnz paranoid_userspace\trace
766 paranoid_swapgs\trace:
771 paranoid_restore\trace:
774 paranoid_userspace\trace:
775 GET_THREAD_INFO(%rcx)
776 movl threadinfo_flags(%rcx),%ebx
777 andl $_TIF_WORK_MASK,%ebx
778 jz paranoid_swapgs\trace
779 movq %rsp,%rdi /* &pt_regs */
781 movq %rax,%rsp /* switch stack for scheduling */
782 testl $_TIF_NEED_RESCHED,%ebx
783 jnz paranoid_schedule\trace
784 movl %ebx,%edx /* arg3: thread flags */
789 xorl %esi,%esi /* arg2: oldset */
790 movq %rsp,%rdi /* arg1: &pt_regs */
791 call do_notify_resume
796 jmp paranoid_userspace\trace
797 paranoid_schedule\trace:
807 jmp paranoid_userspace\trace
812 * Exception entry point. This expects an error code/orig_rax on the stack
813 * and the exception handler in %rax.
815 KPROBE_ENTRY(error_entry)
817 /* rdi slot contains rax, oldrax contains error code */
820 CFI_ADJUST_CFA_OFFSET (14*8)
822 CFI_REL_OFFSET rsi,RSI
823 movq 14*8(%rsp),%rsi /* load rax from rdi slot */
825 CFI_REL_OFFSET rdx,RDX
827 CFI_REL_OFFSET rcx,RCX
828 movq %rsi,10*8(%rsp) /* store rax */
829 CFI_REL_OFFSET rax,RAX
835 CFI_REL_OFFSET r10,R10
837 CFI_REL_OFFSET r11,R11
839 CFI_REL_OFFSET rbx,RBX
841 CFI_REL_OFFSET rbp,RBP
843 CFI_REL_OFFSET r12,R12
845 CFI_REL_OFFSET r13,R13
847 CFI_REL_OFFSET r14,R14
849 CFI_REL_OFFSET r15,R15
858 movq ORIG_RAX(%rsp),%rsi /* get error code */
859 movq $-1,ORIG_RAX(%rsp)
861 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
867 GET_THREAD_INFO(%rcx)
870 movl threadinfo_flags(%rcx),%edx
871 movl $_TIF_WORK_MASK,%edi
875 * The iret might restore flags:
885 /* There are two places in the kernel that can potentially fault with
886 usergs. Handle them here. The exception handlers after
887 iret run with kernel gs again, so don't set the user space flag.
888 B stepping K8s sometimes report an truncated RIP for IRET
889 exceptions returning to compat mode. Check for these here too. */
890 leaq iret_label(%rip),%rbp
893 movl %ebp,%ebp /* zero extend */
896 cmpq $gs_change,RIP(%rsp)
899 KPROBE_END(error_entry)
901 /* Reload gs selector with exception handling */
902 /* edi: new selector */
906 CFI_ADJUST_CFA_OFFSET 8
911 2: mfence /* workaround */
914 CFI_ADJUST_CFA_OFFSET -8
917 ENDPROC(load_gs_index)
919 .section __ex_table,"a"
921 .quad gs_change,bad_gs
924 /* running with kernelgs */
926 swapgs /* switch back to user gs */
933 * Create a kernel thread.
935 * C extern interface:
936 * extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
938 * asm input arguments:
939 * rdi: fn, rsi: arg, rdx: flags
943 FAKE_STACK_FRAME $child_rip
946 # rdi: flags, rsi: usp, rdx: will be &pt_regs
948 orq kernel_thread_flags(%rip),%rdi
961 * It isn't worth to check for reschedule here,
962 * so internally to the x86_64 port you can rely on kernel_thread()
963 * not to reschedule the child before returning, this avoids the need
964 * of hacks for example to fork off the per-CPU idle tasks.
965 * [Hopefully no generic code relies on the reschedule -AK]
971 ENDPROC(kernel_thread)
974 pushq $0 # fake return address
977 * Here we are in the child and the registers are set as they were
978 * at kernel_thread() invocation in the parent.
990 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
992 * C extern interface:
993 * extern long execve(char *name, char **argv, char **envp)
995 * asm input arguments:
996 * rdi: name, rsi: argv, rdx: envp
998 * We want to fallback into:
999 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs)
1001 * do_sys_execve asm fallback arguments:
1002 * rdi: name, rsi: argv, rdx: envp, fake frame on the stack
1004 ENTRY(kernel_execve)
1009 movq %rax, RAX(%rsp)
1012 je int_ret_from_sys_call
1017 ENDPROC(kernel_execve)
1019 KPROBE_ENTRY(page_fault)
1020 errorentry do_page_fault
1021 KPROBE_END(page_fault)
1023 ENTRY(coprocessor_error)
1024 zeroentry do_coprocessor_error
1025 END(coprocessor_error)
1027 ENTRY(simd_coprocessor_error)
1028 zeroentry do_simd_coprocessor_error
1029 END(simd_coprocessor_error)
1031 ENTRY(device_not_available)
1032 zeroentry math_state_restore
1033 END(device_not_available)
1035 /* runs on exception stack */
1039 CFI_ADJUST_CFA_OFFSET 8
1040 paranoidentry do_debug, DEBUG_STACK
1044 /* runs on exception stack */
1048 CFI_ADJUST_CFA_OFFSET 8
1049 paranoidentry do_nmi, 0, 0
1050 #ifdef CONFIG_TRACE_IRQFLAGS
1061 CFI_ADJUST_CFA_OFFSET 8
1062 paranoidentry do_int3, DEBUG_STACK
1068 zeroentry do_overflow
1076 zeroentry do_invalid_op
1079 ENTRY(coprocessor_segment_overrun)
1080 zeroentry do_coprocessor_segment_overrun
1081 END(coprocessor_segment_overrun)
1084 zeroentry do_reserved
1087 /* runs on exception stack */
1090 paranoidentry do_double_fault
1096 errorentry do_invalid_TSS
1099 ENTRY(segment_not_present)
1100 errorentry do_segment_not_present
1101 END(segment_not_present)
1103 /* runs on exception stack */
1104 ENTRY(stack_segment)
1106 paranoidentry do_stack_segment
1111 KPROBE_ENTRY(general_protection)
1112 errorentry do_general_protection
1113 KPROBE_END(general_protection)
1115 ENTRY(alignment_check)
1116 errorentry do_alignment_check
1117 END(alignment_check)
1120 zeroentry do_divide_error
1123 ENTRY(spurious_interrupt_bug)
1124 zeroentry do_spurious_interrupt_bug
1125 END(spurious_interrupt_bug)
1127 #ifdef CONFIG_X86_MCE
1128 /* runs on exception stack */
1129 ENTRY(machine_check)
1132 CFI_ADJUST_CFA_OFFSET 8
1133 paranoidentry do_machine_check
1139 /* Call softirq on interrupt stack. Interrupts are off. */
1143 CFI_ADJUST_CFA_OFFSET 8
1144 CFI_REL_OFFSET rbp,0
1146 CFI_DEF_CFA_REGISTER rbp
1147 incl %gs:pda_irqcount
1148 cmove %gs:pda_irqstackptr,%rsp
1149 push %rbp # backlink for old unwinder
1152 CFI_DEF_CFA_REGISTER rsp
1153 CFI_ADJUST_CFA_OFFSET -8
1154 decl %gs:pda_irqcount
1157 ENDPROC(call_softirq)
1159 #ifdef CONFIG_STACK_UNWIND
1160 ENTRY(arch_unwind_init_running)
1162 movq %r15, R15(%rdi)
1163 movq %r14, R14(%rdi)
1165 movq %r13, R13(%rdi)
1166 movq %r12, R12(%rdi)
1168 movq %rbp, RBP(%rdi)
1169 movq %rbx, RBX(%rdi)
1171 movq %rax, R11(%rdi)
1172 movq %rax, R10(%rdi)
1175 movq %rax, RAX(%rdi)
1176 movq %rax, RCX(%rdi)
1177 movq %rax, RDX(%rdi)
1178 movq %rax, RSI(%rdi)
1179 movq %rax, RDI(%rdi)
1180 movq %rax, ORIG_RAX(%rdi)
1181 movq %rcx, RIP(%rdi)
1183 movq $__KERNEL_CS, CS(%rdi)
1184 movq %rax, EFLAGS(%rdi)
1185 movq %rcx, RSP(%rdi)
1186 movq $__KERNEL_DS, SS(%rdi)
1189 ENDPROC(arch_unwind_init_running)