blob: 2ad9a1bc6a73fafd6ea8e34b9117877eb2e736dd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/x86_64/entry.S
3 *
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>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
8
9/*
10 * entry.S contains the system-call and fault low-level handling routines.
11 *
12 * NOTE: This code handles signal-recognition, which happens every time
13 * after an interrupt and after each system call.
14 *
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.
17 *
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.
Andi Kleen2e91a172006-09-26 10:52:29 +020023 *
24 * Some macro usage:
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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 */
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#include <linux/linkage.h>
41#include <asm/segment.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#include <asm/cache.h>
43#include <asm/errno.h>
44#include <asm/dwarf2.h>
45#include <asm/calling.h>
Sam Ravnborge2d5df92005-09-09 21:28:48 +020046#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include <asm/msr.h>
48#include <asm/unistd.h>
49#include <asm/thread_info.h>
50#include <asm/hw_irq.h>
Andi Kleen5f8efbb2006-01-16 01:56:39 +010051#include <asm/page.h>
Ingo Molnar2601e642006-07-03 00:24:45 -070052#include <asm/irqflags.h>
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +010053#include <asm/paravirt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55 .code64
56
Andi Kleendc37db42005-04-16 15:25:05 -070057#ifndef CONFIG_PREEMPT
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#define retint_kernel retint_restore_args
59#endif
Ingo Molnar2601e642006-07-03 00:24:45 -070060
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +010061#ifdef CONFIG_PARAVIRT
62ENTRY(native_irq_enable_syscall_ret)
63 movq %gs:pda_oldrsp,%rsp
64 swapgs
65 sysretq
66#endif /* CONFIG_PARAVIRT */
67
Ingo Molnar2601e642006-07-03 00:24:45 -070068
69.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
70#ifdef CONFIG_TRACE_IRQFLAGS
71 bt $9,EFLAGS-\offset(%rsp) /* interrupts off? */
72 jnc 1f
73 TRACE_IRQS_ON
741:
75#endif
76.endm
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078/*
79 * C code is not supposed to know about undefined top of stack. Every time
80 * a C function with an pt_regs argument is called from the SYSCALL based
81 * fast path FIXUP_TOP_OF_STACK is needed.
82 * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
83 * manipulation.
84 */
85
86 /* %rsp:at FRAMEEND */
87 .macro FIXUP_TOP_OF_STACK tmp
88 movq %gs:pda_oldrsp,\tmp
89 movq \tmp,RSP(%rsp)
90 movq $__USER_DS,SS(%rsp)
91 movq $__USER_CS,CS(%rsp)
92 movq $-1,RCX(%rsp)
93 movq R11(%rsp),\tmp /* get eflags */
94 movq \tmp,EFLAGS(%rsp)
95 .endm
96
97 .macro RESTORE_TOP_OF_STACK tmp,offset=0
98 movq RSP-\offset(%rsp),\tmp
99 movq \tmp,%gs:pda_oldrsp
100 movq EFLAGS-\offset(%rsp),\tmp
101 movq \tmp,R11-\offset(%rsp)
102 .endm
103
104 .macro FAKE_STACK_FRAME child_rip
105 /* push in order ss, rsp, eflags, cs, rip */
Andi Kleen3829ee62005-07-28 21:15:48 -0700106 xorl %eax, %eax
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 pushq %rax /* ss */
108 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich7effaa82005-09-12 18:49:24 +0200109 /*CFI_REL_OFFSET ss,0*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 pushq %rax /* rsp */
111 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich7effaa82005-09-12 18:49:24 +0200112 CFI_REL_OFFSET rsp,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 pushq $(1<<9) /* eflags - interrupts on */
114 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich7effaa82005-09-12 18:49:24 +0200115 /*CFI_REL_OFFSET rflags,0*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 pushq $__KERNEL_CS /* cs */
117 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich7effaa82005-09-12 18:49:24 +0200118 /*CFI_REL_OFFSET cs,0*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 pushq \child_rip /* rip */
120 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich7effaa82005-09-12 18:49:24 +0200121 CFI_REL_OFFSET rip,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 pushq %rax /* orig rax */
123 CFI_ADJUST_CFA_OFFSET 8
124 .endm
125
126 .macro UNFAKE_STACK_FRAME
127 addq $8*6, %rsp
128 CFI_ADJUST_CFA_OFFSET -(6*8)
129 .endm
130
Jan Beulich7effaa82005-09-12 18:49:24 +0200131 .macro CFI_DEFAULT_STACK start=1
132 .if \start
133 CFI_STARTPROC simple
Jan Beulichadf14232006-09-26 10:52:41 +0200134 CFI_SIGNAL_FRAME
Jan Beulich7effaa82005-09-12 18:49:24 +0200135 CFI_DEF_CFA rsp,SS+8
136 .else
137 CFI_DEF_CFA_OFFSET SS+8
138 .endif
139 CFI_REL_OFFSET r15,R15
140 CFI_REL_OFFSET r14,R14
141 CFI_REL_OFFSET r13,R13
142 CFI_REL_OFFSET r12,R12
143 CFI_REL_OFFSET rbp,RBP
144 CFI_REL_OFFSET rbx,RBX
145 CFI_REL_OFFSET r11,R11
146 CFI_REL_OFFSET r10,R10
147 CFI_REL_OFFSET r9,R9
148 CFI_REL_OFFSET r8,R8
149 CFI_REL_OFFSET rax,RAX
150 CFI_REL_OFFSET rcx,RCX
151 CFI_REL_OFFSET rdx,RDX
152 CFI_REL_OFFSET rsi,RSI
153 CFI_REL_OFFSET rdi,RDI
154 CFI_REL_OFFSET rip,RIP
155 /*CFI_REL_OFFSET cs,CS*/
156 /*CFI_REL_OFFSET rflags,EFLAGS*/
157 CFI_REL_OFFSET rsp,RSP
158 /*CFI_REL_OFFSET ss,SS*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 .endm
160/*
161 * A newly forked process directly context switches into this.
162 */
163/* rdi: prev */
164ENTRY(ret_from_fork)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 CFI_DEFAULT_STACK
Andi Kleen658fdbe2006-09-26 10:52:41 +0200166 push kernel_eflags(%rip)
167 CFI_ADJUST_CFA_OFFSET 4
168 popf # reset kernel eflags
169 CFI_ADJUST_CFA_OFFSET -4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 call schedule_tail
171 GET_THREAD_INFO(%rcx)
172 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx)
173 jnz rff_trace
174rff_action:
175 RESTORE_REST
176 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread?
177 je int_ret_from_sys_call
178 testl $_TIF_IA32,threadinfo_flags(%rcx)
179 jnz int_ret_from_sys_call
180 RESTORE_TOP_OF_STACK %rdi,ARGOFFSET
181 jmp ret_from_sys_call
182rff_trace:
183 movq %rsp,%rdi
184 call syscall_trace_leave
185 GET_THREAD_INFO(%rcx)
186 jmp rff_action
187 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200188END(ret_from_fork)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
190/*
191 * System call entry. Upto 6 arguments in registers are supported.
192 *
193 * SYSCALL does not save anything on the stack and does not change the
194 * stack pointer.
195 */
196
197/*
198 * Register setup:
199 * rax system call number
200 * rdi arg0
201 * rcx return address for syscall/sysret, C arg3
202 * rsi arg1
203 * rdx arg2
204 * r10 arg3 (--> moved to rcx for C)
205 * r8 arg4
206 * r9 arg5
207 * r11 eflags for syscall/sysret, temporary for C
208 * r12-r15,rbp,rbx saved by C code, not touched.
209 *
210 * Interrupts are off on entry.
211 * Only called from user space.
212 *
213 * XXX if we had a free scratch register we could save the RSP into the stack frame
214 * and report it properly in ps. Unfortunately we haven't.
Andi Kleen7bf36bb2006-04-07 19:50:00 +0200215 *
216 * When user can change the frames always force IRET. That is because
217 * it deals with uncanonical addresses better. SYSRET has trouble
218 * with them due to bugs in both AMD and Intel CPUs.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 */
220
221ENTRY(system_call)
Jan Beulich7effaa82005-09-12 18:49:24 +0200222 CFI_STARTPROC simple
Jan Beulichadf14232006-09-26 10:52:41 +0200223 CFI_SIGNAL_FRAME
Jan Beulichdffead42006-06-26 13:57:38 +0200224 CFI_DEF_CFA rsp,PDA_STACKOFFSET
Jan Beulich7effaa82005-09-12 18:49:24 +0200225 CFI_REGISTER rip,rcx
226 /*CFI_REGISTER rflags,r11*/
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100227 SWAPGS_UNSAFE_STACK
228 /*
229 * A hypervisor implementation might want to use a label
230 * after the swapgs, so that it can do the swapgs
231 * for the guest and jump here on syscall.
232 */
233ENTRY(system_call_after_swapgs)
234
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 movq %rsp,%gs:pda_oldrsp
236 movq %gs:pda_kernelstack,%rsp
Ingo Molnar2601e642006-07-03 00:24:45 -0700237 /*
238 * No need to follow this irqs off/on section - it's straight
239 * and short:
240 */
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100241 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 SAVE_ARGS 8,1
243 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200244 movq %rcx,RIP-ARGOFFSET(%rsp)
245 CFI_REL_OFFSET rip,RIP-ARGOFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 GET_THREAD_INFO(%rcx)
247 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
248 jnz tracesys
249 cmpq $__NR_syscall_max,%rax
250 ja badsys
251 movq %r10,%rcx
252 call *sys_call_table(,%rax,8) # XXX: rip relative
253 movq %rax,RAX-ARGOFFSET(%rsp)
254/*
255 * Syscall return path ending with SYSRET (fast path)
256 * Has incomplete stack frame and undefined top of stack.
257 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258ret_from_sys_call:
Andi Kleen11b854b2005-04-16 15:25:02 -0700259 movl $_TIF_ALLWORK_MASK,%edi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 /* edi: flagmask */
261sysret_check:
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200262 LOCKDEP_SYS_EXIT
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 GET_THREAD_INFO(%rcx)
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100264 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700265 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 movl threadinfo_flags(%rcx),%edx
267 andl %edi,%edx
268 jnz sysret_careful
Jan Beulichbcddc012006-12-07 02:14:02 +0100269 CFI_REMEMBER_STATE
Ingo Molnar2601e642006-07-03 00:24:45 -0700270 /*
271 * sysretq will re-enable interrupts:
272 */
273 TRACE_IRQS_ON
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 movq RIP-ARGOFFSET(%rsp),%rcx
Jan Beulich7effaa82005-09-12 18:49:24 +0200275 CFI_REGISTER rip,rcx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 RESTORE_ARGS 0,-ARG_SKIP,1
Jan Beulich7effaa82005-09-12 18:49:24 +0200277 /*CFI_REGISTER rflags,r11*/
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100278 ENABLE_INTERRUPTS_SYSCALL_RET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279
Jan Beulichbcddc012006-12-07 02:14:02 +0100280 CFI_RESTORE_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 /* Handle reschedules */
282 /* edx: work, edi: workmask */
283sysret_careful:
284 bt $TIF_NEED_RESCHED,%edx
285 jnc sysret_signal
Ingo Molnar2601e642006-07-03 00:24:45 -0700286 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100287 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 pushq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200289 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 call schedule
291 popq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200292 CFI_ADJUST_CFA_OFFSET -8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 jmp sysret_check
294
295 /* Handle a signal */
296sysret_signal:
Ingo Molnar2601e642006-07-03 00:24:45 -0700297 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100298 ENABLE_INTERRUPTS(CLBR_NONE)
Peter Zijlstra8f4d37e2008-01-25 21:08:29 +0100299 testl $_TIF_DO_NOTIFY_MASK,%edx
Andi Kleen10ffdbb2005-05-16 21:53:19 -0700300 jz 1f
301
302 /* Really a signal */
303 /* edx: work flags (arg3) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 leaq do_notify_resume(%rip),%rax
305 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
306 xorl %esi,%esi # oldset -> arg2
307 call ptregscall_common
Andi Kleen10ffdbb2005-05-16 21:53:19 -07003081: movl $_TIF_NEED_RESCHED,%edi
Andi Kleen7bf36bb2006-04-07 19:50:00 +0200309 /* Use IRET because user could have changed frame. This
310 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100311 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700312 TRACE_IRQS_OFF
Andi Kleen7bf36bb2006-04-07 19:50:00 +0200313 jmp int_with_check
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314
Jan Beulich7effaa82005-09-12 18:49:24 +0200315badsys:
316 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
317 jmp ret_from_sys_call
318
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 /* Do syscall tracing */
320tracesys:
321 SAVE_REST
322 movq $-ENOSYS,RAX(%rsp)
323 FIXUP_TOP_OF_STACK %rdi
324 movq %rsp,%rdi
325 call syscall_trace_enter
326 LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */
327 RESTORE_REST
328 cmpq $__NR_syscall_max,%rax
Jan Beulichcc7d4792006-10-21 18:37:02 +0200329 movq $-ENOSYS,%rcx
330 cmova %rcx,%rax
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 ja 1f
332 movq %r10,%rcx /* fixup for C */
333 call *sys_call_table(,%rax,8)
Andi Kleen822ff012006-05-30 22:48:03 +02003341: movq %rax,RAX-ARGOFFSET(%rsp)
Andi Kleen7bf36bb2006-04-07 19:50:00 +0200335 /* Use IRET because user could have changed frame */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337/*
338 * Syscall return path ending with IRET.
339 * Has correct top of stack, but partial stack frame.
Jan Beulichbcddc012006-12-07 02:14:02 +0100340 */
341 .globl int_ret_from_sys_call
342int_ret_from_sys_call:
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100343 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700344 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 testl $3,CS-ARGOFFSET(%rsp)
346 je retint_restore_args
347 movl $_TIF_ALLWORK_MASK,%edi
348 /* edi: mask to check */
349int_with_check:
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200350 LOCKDEP_SYS_EXIT_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 GET_THREAD_INFO(%rcx)
352 movl threadinfo_flags(%rcx),%edx
353 andl %edi,%edx
354 jnz int_careful
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100355 andl $~TS_COMPAT,threadinfo_status(%rcx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 jmp retint_swapgs
357
358 /* Either reschedule or signal or syscall exit tracking needed. */
359 /* First do a reschedule test. */
360 /* edx: work, edi: workmask */
361int_careful:
362 bt $TIF_NEED_RESCHED,%edx
363 jnc int_very_careful
Ingo Molnar2601e642006-07-03 00:24:45 -0700364 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100365 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 pushq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200367 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 call schedule
369 popq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200370 CFI_ADJUST_CFA_OFFSET -8
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100371 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700372 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 jmp int_with_check
374
375 /* handle signals and tracing -- both require a full stack frame */
376int_very_careful:
Ingo Molnar2601e642006-07-03 00:24:45 -0700377 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100378 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 SAVE_REST
380 /* Check for syscall exit trace */
381 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx
382 jz int_signal
383 pushq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200384 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 leaq 8(%rsp),%rdi # &ptregs -> arg1
386 call syscall_trace_leave
387 popq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200388 CFI_ADJUST_CFA_OFFSET -8
Andi Kleen36c11042005-04-16 15:25:01 -0700389 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 jmp int_restore_rest
391
392int_signal:
Peter Zijlstra8f4d37e2008-01-25 21:08:29 +0100393 testl $_TIF_DO_NOTIFY_MASK,%edx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 jz 1f
395 movq %rsp,%rdi # &ptregs -> arg1
396 xorl %esi,%esi # oldset -> arg2
397 call do_notify_resume
3981: movl $_TIF_NEED_RESCHED,%edi
399int_restore_rest:
400 RESTORE_REST
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100401 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700402 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 jmp int_with_check
404 CFI_ENDPROC
Jan Beulichbcddc012006-12-07 02:14:02 +0100405END(system_call)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406
407/*
408 * Certain special system calls that need to save a complete full stack frame.
409 */
410
411 .macro PTREGSCALL label,func,arg
412 .globl \label
413\label:
414 leaq \func(%rip),%rax
415 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
416 jmp ptregscall_common
Jan Beulich4b787e02006-06-26 13:56:55 +0200417END(\label)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 .endm
419
Jan Beulich7effaa82005-09-12 18:49:24 +0200420 CFI_STARTPROC
421
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 PTREGSCALL stub_clone, sys_clone, %r8
423 PTREGSCALL stub_fork, sys_fork, %rdi
424 PTREGSCALL stub_vfork, sys_vfork, %rdi
425 PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend, %rdx
426 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
427 PTREGSCALL stub_iopl, sys_iopl, %rsi
428
429ENTRY(ptregscall_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 popq %r11
Jan Beulich7effaa82005-09-12 18:49:24 +0200431 CFI_ADJUST_CFA_OFFSET -8
432 CFI_REGISTER rip, r11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 SAVE_REST
434 movq %r11, %r15
Jan Beulich7effaa82005-09-12 18:49:24 +0200435 CFI_REGISTER rip, r15
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 FIXUP_TOP_OF_STACK %r11
437 call *%rax
438 RESTORE_TOP_OF_STACK %r11
439 movq %r15, %r11
Jan Beulich7effaa82005-09-12 18:49:24 +0200440 CFI_REGISTER rip, r11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 RESTORE_REST
442 pushq %r11
Jan Beulich7effaa82005-09-12 18:49:24 +0200443 CFI_ADJUST_CFA_OFFSET 8
444 CFI_REL_OFFSET rip, 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 ret
446 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200447END(ptregscall_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448
449ENTRY(stub_execve)
450 CFI_STARTPROC
451 popq %r11
Jan Beulich7effaa82005-09-12 18:49:24 +0200452 CFI_ADJUST_CFA_OFFSET -8
453 CFI_REGISTER rip, r11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 SAVE_REST
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 FIXUP_TOP_OF_STACK %r11
456 call sys_execve
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 RESTORE_TOP_OF_STACK %r11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 movq %rax,RAX(%rsp)
459 RESTORE_REST
460 jmp int_ret_from_sys_call
461 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200462END(stub_execve)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463
464/*
465 * sigreturn is special because it needs to restore all registers on return.
466 * This cannot be done with SYSRET, so use the IRET return path instead.
467 */
468ENTRY(stub_rt_sigreturn)
469 CFI_STARTPROC
Jan Beulich7effaa82005-09-12 18:49:24 +0200470 addq $8, %rsp
471 CFI_ADJUST_CFA_OFFSET -8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 SAVE_REST
473 movq %rsp,%rdi
474 FIXUP_TOP_OF_STACK %r11
475 call sys_rt_sigreturn
476 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
477 RESTORE_REST
478 jmp int_ret_from_sys_call
479 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200480END(stub_rt_sigreturn)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481
Jan Beulich7effaa82005-09-12 18:49:24 +0200482/*
483 * initial frame state for interrupts and exceptions
484 */
485 .macro _frame ref
486 CFI_STARTPROC simple
Jan Beulichadf14232006-09-26 10:52:41 +0200487 CFI_SIGNAL_FRAME
Jan Beulich7effaa82005-09-12 18:49:24 +0200488 CFI_DEF_CFA rsp,SS+8-\ref
489 /*CFI_REL_OFFSET ss,SS-\ref*/
490 CFI_REL_OFFSET rsp,RSP-\ref
491 /*CFI_REL_OFFSET rflags,EFLAGS-\ref*/
492 /*CFI_REL_OFFSET cs,CS-\ref*/
493 CFI_REL_OFFSET rip,RIP-\ref
494 .endm
495
496/* initial frame state for interrupts (and exceptions without error code) */
497#define INTR_FRAME _frame RIP
498/* initial frame state for exceptions with error code (and interrupts with
499 vector already pushed) */
500#define XCPT_FRAME _frame ORIG_RAX
501
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502/*
503 * Interrupt entry/exit.
504 *
505 * Interrupt entry points save only callee clobbered registers in fast path.
506 *
507 * Entry runs with interrupts off.
508 */
509
510/* 0(%rsp): interrupt number */
511 .macro interrupt func
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 cld
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 SAVE_ARGS
514 leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler
Jan Beulich1de9c3f2006-06-26 13:57:35 +0200515 pushq %rbp
516 CFI_ADJUST_CFA_OFFSET 8
517 CFI_REL_OFFSET rbp, 0
518 movq %rsp,%rbp
519 CFI_DEF_CFA_REGISTER rbp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 testl $3,CS(%rdi)
521 je 1f
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100522 SWAPGS
Andi Kleen96e54042006-09-26 10:52:39 +0200523 /* irqcount is used to check if a CPU is already on an interrupt
524 stack or not. While this is essentially redundant with preempt_count
525 it is a little cheaper to use a separate counter in the PDA
526 (short of moving irq_enter into assembly, which would be too
527 much work) */
5281: incl %gs:pda_irqcount
Jan Beulich1de9c3f2006-06-26 13:57:35 +0200529 cmoveq %gs:pda_irqstackptr,%rsp
Andi Kleen26995002006-08-02 22:37:28 +0200530 push %rbp # backlink for old unwinder
Ingo Molnar2601e642006-07-03 00:24:45 -0700531 /*
532 * We entered an interrupt context - irqs are off:
533 */
534 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 call \func
536 .endm
537
538ENTRY(common_interrupt)
Jan Beulich7effaa82005-09-12 18:49:24 +0200539 XCPT_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 interrupt do_IRQ
541 /* 0(%rsp): oldrsp-ARGOFFSET */
Jan Beulich7effaa82005-09-12 18:49:24 +0200542ret_from_intr:
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100543 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700544 TRACE_IRQS_OFF
Andi Kleen3829ee62005-07-28 21:15:48 -0700545 decl %gs:pda_irqcount
Jan Beulich1de9c3f2006-06-26 13:57:35 +0200546 leaveq
Jan Beulich7effaa82005-09-12 18:49:24 +0200547 CFI_DEF_CFA_REGISTER rsp
Jan Beulich1de9c3f2006-06-26 13:57:35 +0200548 CFI_ADJUST_CFA_OFFSET -8
Jan Beulich7effaa82005-09-12 18:49:24 +0200549exit_intr:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 GET_THREAD_INFO(%rcx)
551 testl $3,CS-ARGOFFSET(%rsp)
552 je retint_kernel
553
554 /* Interrupt came from user space */
555 /*
556 * Has a correct top of stack, but a partial stack frame
557 * %rcx: thread info. Interrupts off.
558 */
559retint_with_reschedule:
560 movl $_TIF_WORK_MASK,%edi
Jan Beulich7effaa82005-09-12 18:49:24 +0200561retint_check:
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200562 LOCKDEP_SYS_EXIT_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 movl threadinfo_flags(%rcx),%edx
564 andl %edi,%edx
Jan Beulich7effaa82005-09-12 18:49:24 +0200565 CFI_REMEMBER_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 jnz retint_careful
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200567
568retint_swapgs: /* return to user-space */
Ingo Molnar2601e642006-07-03 00:24:45 -0700569 /*
570 * The iretq could re-enable interrupts:
571 */
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100572 DISABLE_INTERRUPTS(CLBR_ANY)
Ingo Molnar2601e642006-07-03 00:24:45 -0700573 TRACE_IRQS_IRETQ
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100574 SWAPGS
Ingo Molnar2601e642006-07-03 00:24:45 -0700575 jmp restore_args
576
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200577retint_restore_args: /* return to kernel space */
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100578 DISABLE_INTERRUPTS(CLBR_ANY)
Ingo Molnar2601e642006-07-03 00:24:45 -0700579 /*
580 * The iretq could re-enable interrupts:
581 */
582 TRACE_IRQS_IRETQ
583restore_args:
Ingo Molnar3701d8632008-02-09 23:24:08 +0100584 RESTORE_ARGS 0,8,0
585
Adrian Bunkf7f3d792008-02-13 23:29:53 +0200586irq_return:
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100587 INTERRUPT_RETURN
Ingo Molnar3701d8632008-02-09 23:24:08 +0100588
589 .section __ex_table, "a"
590 .quad irq_return, bad_iret
591 .previous
592
593#ifdef CONFIG_PARAVIRT
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100594ENTRY(native_iret)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 iretq
596
597 .section __ex_table,"a"
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100598 .quad native_iret, bad_iret
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .previous
Ingo Molnar3701d8632008-02-09 23:24:08 +0100600#endif
601
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .section .fixup,"ax"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603bad_iret:
Roland McGrath3aa4b372008-02-06 22:39:43 +0100604 /*
605 * The iret traps when the %cs or %ss being restored is bogus.
606 * We've lost the original trap vector and error code.
607 * #GPF is the most likely one to get for an invalid selector.
608 * So pretend we completed the iret and took the #GPF in user mode.
609 *
610 * We are now running with the kernel GS after exception recovery.
611 * But error_entry expects us to have user GS to match the user %cs,
612 * so swap back.
613 */
614 pushq $0
615
616 SWAPGS
617 jmp general_protection
618
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100619 .previous
620
Jan Beulich7effaa82005-09-12 18:49:24 +0200621 /* edi: workmask, edx: work */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622retint_careful:
Jan Beulich7effaa82005-09-12 18:49:24 +0200623 CFI_RESTORE_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 bt $TIF_NEED_RESCHED,%edx
625 jnc retint_signal
Ingo Molnar2601e642006-07-03 00:24:45 -0700626 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100627 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 pushq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200629 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 call schedule
631 popq %rdi
Jan Beulich7effaa82005-09-12 18:49:24 +0200632 CFI_ADJUST_CFA_OFFSET -8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 GET_THREAD_INFO(%rcx)
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100634 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700635 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 jmp retint_check
637
638retint_signal:
Peter Zijlstra8f4d37e2008-01-25 21:08:29 +0100639 testl $_TIF_DO_NOTIFY_MASK,%edx
Andi Kleen10ffdbb2005-05-16 21:53:19 -0700640 jz retint_swapgs
Ingo Molnar2601e642006-07-03 00:24:45 -0700641 TRACE_IRQS_ON
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100642 ENABLE_INTERRUPTS(CLBR_NONE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 SAVE_REST
644 movq $-1,ORIG_RAX(%rsp)
Andi Kleen3829ee62005-07-28 21:15:48 -0700645 xorl %esi,%esi # oldset
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 movq %rsp,%rdi # &pt_regs
647 call do_notify_resume
648 RESTORE_REST
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100649 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700650 TRACE_IRQS_OFF
Andi Kleen10ffdbb2005-05-16 21:53:19 -0700651 movl $_TIF_NEED_RESCHED,%edi
Andi Kleenbe9e6872005-05-01 08:58:51 -0700652 GET_THREAD_INFO(%rcx)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 jmp retint_check
654
655#ifdef CONFIG_PREEMPT
656 /* Returning to kernel space. Check if we need preemption */
657 /* rcx: threadinfo. interrupts off. */
Andi Kleenb06baba2006-09-26 10:52:29 +0200658ENTRY(retint_kernel)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 cmpl $0,threadinfo_preempt_count(%rcx)
660 jnz retint_restore_args
661 bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx)
662 jnc retint_restore_args
663 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
664 jnc retint_restore_args
665 call preempt_schedule_irq
666 jmp exit_intr
667#endif
Jan Beulich4b787e02006-06-26 13:56:55 +0200668
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200670END(common_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671
672/*
673 * APIC interrupts.
674 */
675 .macro apicinterrupt num,func
Jan Beulich7effaa82005-09-12 18:49:24 +0200676 INTR_FRAME
Rusty Russell19eadf92006-06-27 02:53:44 -0700677 pushq $~(\num)
Jan Beulich7effaa82005-09-12 18:49:24 +0200678 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 interrupt \func
680 jmp ret_from_intr
681 CFI_ENDPROC
682 .endm
683
684ENTRY(thermal_interrupt)
685 apicinterrupt THERMAL_APIC_VECTOR,smp_thermal_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200686END(thermal_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687
Jacob Shin89b831e2005-11-05 17:25:53 +0100688ENTRY(threshold_interrupt)
689 apicinterrupt THRESHOLD_APIC_VECTOR,mce_threshold_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200690END(threshold_interrupt)
Jacob Shin89b831e2005-11-05 17:25:53 +0100691
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692#ifdef CONFIG_SMP
693ENTRY(reschedule_interrupt)
694 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200695END(reschedule_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696
Andi Kleene5bc8b62005-09-12 18:49:24 +0200697 .macro INVALIDATE_ENTRY num
698ENTRY(invalidate_interrupt\num)
699 apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200700END(invalidate_interrupt\num)
Andi Kleene5bc8b62005-09-12 18:49:24 +0200701 .endm
702
703 INVALIDATE_ENTRY 0
704 INVALIDATE_ENTRY 1
705 INVALIDATE_ENTRY 2
706 INVALIDATE_ENTRY 3
707 INVALIDATE_ENTRY 4
708 INVALIDATE_ENTRY 5
709 INVALIDATE_ENTRY 6
710 INVALIDATE_ENTRY 7
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711
712ENTRY(call_function_interrupt)
713 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200714END(call_function_interrupt)
Eric W. Biederman61014292007-02-23 04:40:58 -0700715ENTRY(irq_move_cleanup_interrupt)
716 apicinterrupt IRQ_MOVE_CLEANUP_VECTOR,smp_irq_move_cleanup_interrupt
717END(irq_move_cleanup_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718#endif
719
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720ENTRY(apic_timer_interrupt)
721 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200722END(apic_timer_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723
724ENTRY(error_interrupt)
725 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200726END(error_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727
728ENTRY(spurious_interrupt)
729 apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
Jan Beulich4b787e02006-06-26 13:56:55 +0200730END(spurious_interrupt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731
732/*
733 * Exception entry points.
734 */
735 .macro zeroentry sym
Jan Beulich7effaa82005-09-12 18:49:24 +0200736 INTR_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737 pushq $0 /* push error code/oldrax */
Jan Beulich7effaa82005-09-12 18:49:24 +0200738 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 pushq %rax /* push real oldrax to the rdi slot */
Jan Beulich7effaa82005-09-12 18:49:24 +0200740 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich37550902007-05-02 19:27:05 +0200741 CFI_REL_OFFSET rax,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742 leaq \sym(%rip),%rax
743 jmp error_entry
Jan Beulich7effaa82005-09-12 18:49:24 +0200744 CFI_ENDPROC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745 .endm
746
747 .macro errorentry sym
Jan Beulich7effaa82005-09-12 18:49:24 +0200748 XCPT_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 pushq %rax
Jan Beulich7effaa82005-09-12 18:49:24 +0200750 CFI_ADJUST_CFA_OFFSET 8
Jan Beulich37550902007-05-02 19:27:05 +0200751 CFI_REL_OFFSET rax,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 leaq \sym(%rip),%rax
753 jmp error_entry
Jan Beulich7effaa82005-09-12 18:49:24 +0200754 CFI_ENDPROC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 .endm
756
757 /* error code is on the stack already */
758 /* handle NMI like exceptions that can happen everywhere */
Ingo Molnar2601e642006-07-03 00:24:45 -0700759 .macro paranoidentry sym, ist=0, irqtrace=1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 SAVE_ALL
761 cld
762 movl $1,%ebx
763 movl $MSR_GS_BASE,%ecx
764 rdmsr
765 testl %edx,%edx
766 js 1f
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100767 SWAPGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 xorl %ebx,%ebx
Jan Beulichb556b352006-01-11 22:43:00 +01007691:
770 .if \ist
771 movq %gs:pda_data_offset, %rbp
772 .endif
773 movq %rsp,%rdi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 movq ORIG_RAX(%rsp),%rsi
775 movq $-1,ORIG_RAX(%rsp)
Jan Beulichb556b352006-01-11 22:43:00 +0100776 .if \ist
Andi Kleen5f8efbb2006-01-16 01:56:39 +0100777 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
Jan Beulichb556b352006-01-11 22:43:00 +0100778 .endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 call \sym
Jan Beulichb556b352006-01-11 22:43:00 +0100780 .if \ist
Andi Kleen5f8efbb2006-01-16 01:56:39 +0100781 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
Jan Beulichb556b352006-01-11 22:43:00 +0100782 .endif
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100783 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700784 .if \irqtrace
785 TRACE_IRQS_OFF
786 .endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 .endm
Ingo Molnar2601e642006-07-03 00:24:45 -0700788
789 /*
790 * "Paranoid" exit path from exception stack.
791 * Paranoid because this is used by NMIs and cannot take
792 * any kernel state for granted.
793 * We don't do kernel preemption checks here, because only
794 * NMI should be common and it does not enable IRQs and
795 * cannot get reschedule ticks.
796 *
797 * "trace" is 0 for the NMI handler only, because irq-tracing
798 * is fundamentally NMI-unsafe. (we cannot change the soft and
799 * hard flags at once, atomically)
800 */
801 .macro paranoidexit trace=1
802 /* ebx: no swapgs flag */
803paranoid_exit\trace:
804 testl %ebx,%ebx /* swapgs needed? */
805 jnz paranoid_restore\trace
806 testl $3,CS(%rsp)
807 jnz paranoid_userspace\trace
808paranoid_swapgs\trace:
Andi Kleen7a0a2df2006-09-26 10:52:37 +0200809 .if \trace
Ingo Molnar2601e642006-07-03 00:24:45 -0700810 TRACE_IRQS_IRETQ 0
Andi Kleen7a0a2df2006-09-26 10:52:37 +0200811 .endif
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100812 SWAPGS_UNSAFE_STACK
Ingo Molnar2601e642006-07-03 00:24:45 -0700813paranoid_restore\trace:
814 RESTORE_ALL 8
Ingo Molnar3701d8632008-02-09 23:24:08 +0100815 jmp irq_return
Ingo Molnar2601e642006-07-03 00:24:45 -0700816paranoid_userspace\trace:
817 GET_THREAD_INFO(%rcx)
818 movl threadinfo_flags(%rcx),%ebx
819 andl $_TIF_WORK_MASK,%ebx
820 jz paranoid_swapgs\trace
821 movq %rsp,%rdi /* &pt_regs */
822 call sync_regs
823 movq %rax,%rsp /* switch stack for scheduling */
824 testl $_TIF_NEED_RESCHED,%ebx
825 jnz paranoid_schedule\trace
826 movl %ebx,%edx /* arg3: thread flags */
827 .if \trace
828 TRACE_IRQS_ON
829 .endif
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100830 ENABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700831 xorl %esi,%esi /* arg2: oldset */
832 movq %rsp,%rdi /* arg1: &pt_regs */
833 call do_notify_resume
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100834 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700835 .if \trace
836 TRACE_IRQS_OFF
837 .endif
838 jmp paranoid_userspace\trace
839paranoid_schedule\trace:
840 .if \trace
841 TRACE_IRQS_ON
842 .endif
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100843 ENABLE_INTERRUPTS(CLBR_ANY)
Ingo Molnar2601e642006-07-03 00:24:45 -0700844 call schedule
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100845 DISABLE_INTERRUPTS(CLBR_ANY)
Ingo Molnar2601e642006-07-03 00:24:45 -0700846 .if \trace
847 TRACE_IRQS_OFF
848 .endif
849 jmp paranoid_userspace\trace
850 CFI_ENDPROC
851 .endm
852
Linus Torvalds1da177e2005-04-16 15:20:36 -0700853/*
854 * Exception entry point. This expects an error code/orig_rax on the stack
855 * and the exception handler in %rax.
856 */
Prasanna S.Pd28c4392006-09-26 10:52:34 +0200857KPROBE_ENTRY(error_entry)
Jan Beulich7effaa82005-09-12 18:49:24 +0200858 _frame RDI
Jan Beulich37550902007-05-02 19:27:05 +0200859 CFI_REL_OFFSET rax,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860 /* rdi slot contains rax, oldrax contains error code */
861 cld
862 subq $14*8,%rsp
863 CFI_ADJUST_CFA_OFFSET (14*8)
864 movq %rsi,13*8(%rsp)
865 CFI_REL_OFFSET rsi,RSI
866 movq 14*8(%rsp),%rsi /* load rax from rdi slot */
Jan Beulich37550902007-05-02 19:27:05 +0200867 CFI_REGISTER rax,rsi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868 movq %rdx,12*8(%rsp)
869 CFI_REL_OFFSET rdx,RDX
870 movq %rcx,11*8(%rsp)
871 CFI_REL_OFFSET rcx,RCX
872 movq %rsi,10*8(%rsp) /* store rax */
873 CFI_REL_OFFSET rax,RAX
874 movq %r8, 9*8(%rsp)
875 CFI_REL_OFFSET r8,R8
876 movq %r9, 8*8(%rsp)
877 CFI_REL_OFFSET r9,R9
878 movq %r10,7*8(%rsp)
879 CFI_REL_OFFSET r10,R10
880 movq %r11,6*8(%rsp)
881 CFI_REL_OFFSET r11,R11
882 movq %rbx,5*8(%rsp)
883 CFI_REL_OFFSET rbx,RBX
884 movq %rbp,4*8(%rsp)
885 CFI_REL_OFFSET rbp,RBP
886 movq %r12,3*8(%rsp)
887 CFI_REL_OFFSET r12,R12
888 movq %r13,2*8(%rsp)
889 CFI_REL_OFFSET r13,R13
890 movq %r14,1*8(%rsp)
891 CFI_REL_OFFSET r14,R14
892 movq %r15,(%rsp)
893 CFI_REL_OFFSET r15,R15
894 xorl %ebx,%ebx
895 testl $3,CS(%rsp)
896 je error_kernelspace
897error_swapgs:
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100898 SWAPGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700899error_sti:
900 movq %rdi,RDI(%rsp)
Jan Beulich37550902007-05-02 19:27:05 +0200901 CFI_REL_OFFSET rdi,RDI
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902 movq %rsp,%rdi
903 movq ORIG_RAX(%rsp),%rsi /* get error code */
904 movq $-1,ORIG_RAX(%rsp)
905 call *%rax
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200906 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
907error_exit:
908 movl %ebx,%eax
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909 RESTORE_REST
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100910 DISABLE_INTERRUPTS(CLBR_NONE)
Ingo Molnar2601e642006-07-03 00:24:45 -0700911 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912 GET_THREAD_INFO(%rcx)
913 testl %eax,%eax
914 jne retint_kernel
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200915 LOCKDEP_SYS_EXIT_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -0700916 movl threadinfo_flags(%rcx),%edx
917 movl $_TIF_WORK_MASK,%edi
918 andl %edi,%edx
919 jnz retint_careful
Peter Zijlstra10cd7062007-10-11 22:11:12 +0200920 jmp retint_swapgs
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921 CFI_ENDPROC
922
923error_kernelspace:
924 incl %ebx
925 /* There are two places in the kernel that can potentially fault with
926 usergs. Handle them here. The exception handlers after
927 iret run with kernel gs again, so don't set the user space flag.
928 B stepping K8s sometimes report an truncated RIP for IRET
929 exceptions returning to compat mode. Check for these here too. */
Ingo Molnar3701d8632008-02-09 23:24:08 +0100930 leaq irq_return(%rip),%rbp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700931 cmpq %rbp,RIP(%rsp)
932 je error_swapgs
933 movl %ebp,%ebp /* zero extend */
934 cmpq %rbp,RIP(%rsp)
935 je error_swapgs
936 cmpq $gs_change,RIP(%rsp)
937 je error_swapgs
938 jmp error_sti
Prasanna S.Pd28c4392006-09-26 10:52:34 +0200939KPROBE_END(error_entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940
941 /* Reload gs selector with exception handling */
942 /* edi: new selector */
943ENTRY(load_gs_index)
Jan Beulich7effaa82005-09-12 18:49:24 +0200944 CFI_STARTPROC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945 pushf
Jan Beulich7effaa82005-09-12 18:49:24 +0200946 CFI_ADJUST_CFA_OFFSET 8
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100947 DISABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI))
948 SWAPGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700949gs_change:
950 movl %edi,%gs
9512: mfence /* workaround */
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100952 SWAPGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700953 popf
Jan Beulich7effaa82005-09-12 18:49:24 +0200954 CFI_ADJUST_CFA_OFFSET -8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700955 ret
Jan Beulich7effaa82005-09-12 18:49:24 +0200956 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200957ENDPROC(load_gs_index)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700958
959 .section __ex_table,"a"
960 .align 8
961 .quad gs_change,bad_gs
962 .previous
963 .section .fixup,"ax"
964 /* running with kernelgs */
965bad_gs:
Glauber de Oliveira Costa72fe4852008-01-30 13:32:08 +0100966 SWAPGS /* switch back to user gs */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700967 xorl %eax,%eax
968 movl %eax,%gs
969 jmp 2b
970 .previous
971
972/*
973 * Create a kernel thread.
974 *
975 * C extern interface:
976 * extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
977 *
978 * asm input arguments:
979 * rdi: fn, rsi: arg, rdx: flags
980 */
981ENTRY(kernel_thread)
982 CFI_STARTPROC
983 FAKE_STACK_FRAME $child_rip
984 SAVE_ALL
985
986 # rdi: flags, rsi: usp, rdx: will be &pt_regs
987 movq %rdx,%rdi
988 orq kernel_thread_flags(%rip),%rdi
989 movq $-1, %rsi
990 movq %rsp, %rdx
991
992 xorl %r8d,%r8d
993 xorl %r9d,%r9d
994
995 # clone now
996 call do_fork
997 movq %rax,RAX(%rsp)
998 xorl %edi,%edi
999
1000 /*
1001 * It isn't worth to check for reschedule here,
1002 * so internally to the x86_64 port you can rely on kernel_thread()
1003 * not to reschedule the child before returning, this avoids the need
1004 * of hacks for example to fork off the per-CPU idle tasks.
1005 * [Hopefully no generic code relies on the reschedule -AK]
1006 */
1007 RESTORE_ALL
1008 UNFAKE_STACK_FRAME
1009 ret
1010 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001011ENDPROC(kernel_thread)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001012
1013child_rip:
Andi Kleenc05991e2006-08-30 19:37:08 +02001014 pushq $0 # fake return address
1015 CFI_STARTPROC
Linus Torvalds1da177e2005-04-16 15:20:36 -07001016 /*
1017 * Here we are in the child and the registers are set as they were
1018 * at kernel_thread() invocation in the parent.
1019 */
1020 movq %rdi, %rax
1021 movq %rsi, %rdi
1022 call *%rax
1023 # exit
Andrey Mirkin1c5b5cf2007-10-17 18:04:33 +02001024 mov %eax, %edi
Linus Torvalds1da177e2005-04-16 15:20:36 -07001025 call do_exit
Andi Kleenc05991e2006-08-30 19:37:08 +02001026 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001027ENDPROC(child_rip)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001028
1029/*
1030 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
1031 *
1032 * C extern interface:
1033 * extern long execve(char *name, char **argv, char **envp)
1034 *
1035 * asm input arguments:
1036 * rdi: name, rsi: argv, rdx: envp
1037 *
1038 * We want to fallback into:
1039 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs)
1040 *
1041 * do_sys_execve asm fallback arguments:
1042 * rdi: name, rsi: argv, rdx: envp, fake frame on the stack
1043 */
Arnd Bergmann3db03b42006-10-02 02:18:31 -07001044ENTRY(kernel_execve)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001045 CFI_STARTPROC
1046 FAKE_STACK_FRAME $0
1047 SAVE_ALL
1048 call sys_execve
1049 movq %rax, RAX(%rsp)
1050 RESTORE_REST
1051 testq %rax,%rax
1052 je int_ret_from_sys_call
1053 RESTORE_ARGS
1054 UNFAKE_STACK_FRAME
1055 ret
1056 CFI_ENDPROC
Arnd Bergmann3db03b42006-10-02 02:18:31 -07001057ENDPROC(kernel_execve)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001058
Prasanna S Panchamukhi0f2fbdc2005-09-06 15:19:28 -07001059KPROBE_ENTRY(page_fault)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 errorentry do_page_fault
Prasanna S.Pd28c4392006-09-26 10:52:34 +02001061KPROBE_END(page_fault)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062
1063ENTRY(coprocessor_error)
1064 zeroentry do_coprocessor_error
Jan Beulich4b787e02006-06-26 13:56:55 +02001065END(coprocessor_error)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001066
1067ENTRY(simd_coprocessor_error)
1068 zeroentry do_simd_coprocessor_error
Jan Beulich4b787e02006-06-26 13:56:55 +02001069END(simd_coprocessor_error)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070
1071ENTRY(device_not_available)
1072 zeroentry math_state_restore
Jan Beulich4b787e02006-06-26 13:56:55 +02001073END(device_not_available)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001074
1075 /* runs on exception stack */
Prasanna S Panchamukhi0f2fbdc2005-09-06 15:19:28 -07001076KPROBE_ENTRY(debug)
Jan Beulich7effaa82005-09-12 18:49:24 +02001077 INTR_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -07001078 pushq $0
1079 CFI_ADJUST_CFA_OFFSET 8
Andi Kleen5f8efbb2006-01-16 01:56:39 +01001080 paranoidentry do_debug, DEBUG_STACK
Ingo Molnar2601e642006-07-03 00:24:45 -07001081 paranoidexit
Prasanna S.Pd28c4392006-09-26 10:52:34 +02001082KPROBE_END(debug)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001083
1084 /* runs on exception stack */
Andi Kleeneddb6fb2006-02-03 21:50:41 +01001085KPROBE_ENTRY(nmi)
Jan Beulich7effaa82005-09-12 18:49:24 +02001086 INTR_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087 pushq $-1
Jan Beulich7effaa82005-09-12 18:49:24 +02001088 CFI_ADJUST_CFA_OFFSET 8
Ingo Molnar2601e642006-07-03 00:24:45 -07001089 paranoidentry do_nmi, 0, 0
1090#ifdef CONFIG_TRACE_IRQFLAGS
1091 paranoidexit 0
1092#else
1093 jmp paranoid_exit1
1094 CFI_ENDPROC
1095#endif
Prasanna S.Pd28c4392006-09-26 10:52:34 +02001096KPROBE_END(nmi)
Andi Kleen6fefb0d2005-04-16 15:25:03 -07001097
Prasanna S Panchamukhi0f2fbdc2005-09-06 15:19:28 -07001098KPROBE_ENTRY(int3)
Jan Beulichb556b352006-01-11 22:43:00 +01001099 INTR_FRAME
1100 pushq $0
1101 CFI_ADJUST_CFA_OFFSET 8
Andi Kleen5f8efbb2006-01-16 01:56:39 +01001102 paranoidentry do_int3, DEBUG_STACK
Ingo Molnar2601e642006-07-03 00:24:45 -07001103 jmp paranoid_exit1
Jan Beulichb556b352006-01-11 22:43:00 +01001104 CFI_ENDPROC
Prasanna S.Pd28c4392006-09-26 10:52:34 +02001105KPROBE_END(int3)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001106
1107ENTRY(overflow)
1108 zeroentry do_overflow
Jan Beulich4b787e02006-06-26 13:56:55 +02001109END(overflow)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110
1111ENTRY(bounds)
1112 zeroentry do_bounds
Jan Beulich4b787e02006-06-26 13:56:55 +02001113END(bounds)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114
1115ENTRY(invalid_op)
1116 zeroentry do_invalid_op
Jan Beulich4b787e02006-06-26 13:56:55 +02001117END(invalid_op)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118
1119ENTRY(coprocessor_segment_overrun)
1120 zeroentry do_coprocessor_segment_overrun
Jan Beulich4b787e02006-06-26 13:56:55 +02001121END(coprocessor_segment_overrun)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001122
1123ENTRY(reserved)
1124 zeroentry do_reserved
Jan Beulich4b787e02006-06-26 13:56:55 +02001125END(reserved)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126
1127 /* runs on exception stack */
1128ENTRY(double_fault)
Jan Beulich7effaa82005-09-12 18:49:24 +02001129 XCPT_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -07001130 paranoidentry do_double_fault
Ingo Molnar2601e642006-07-03 00:24:45 -07001131 jmp paranoid_exit1
Linus Torvalds1da177e2005-04-16 15:20:36 -07001132 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001133END(double_fault)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134
1135ENTRY(invalid_TSS)
1136 errorentry do_invalid_TSS
Jan Beulich4b787e02006-06-26 13:56:55 +02001137END(invalid_TSS)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138
1139ENTRY(segment_not_present)
1140 errorentry do_segment_not_present
Jan Beulich4b787e02006-06-26 13:56:55 +02001141END(segment_not_present)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001142
1143 /* runs on exception stack */
1144ENTRY(stack_segment)
Jan Beulich7effaa82005-09-12 18:49:24 +02001145 XCPT_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -07001146 paranoidentry do_stack_segment
Ingo Molnar2601e642006-07-03 00:24:45 -07001147 jmp paranoid_exit1
Linus Torvalds1da177e2005-04-16 15:20:36 -07001148 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001149END(stack_segment)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001150
Prasanna S Panchamukhi0f2fbdc2005-09-06 15:19:28 -07001151KPROBE_ENTRY(general_protection)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001152 errorentry do_general_protection
Prasanna S.Pd28c4392006-09-26 10:52:34 +02001153KPROBE_END(general_protection)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001154
1155ENTRY(alignment_check)
1156 errorentry do_alignment_check
Jan Beulich4b787e02006-06-26 13:56:55 +02001157END(alignment_check)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158
1159ENTRY(divide_error)
1160 zeroentry do_divide_error
Jan Beulich4b787e02006-06-26 13:56:55 +02001161END(divide_error)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162
1163ENTRY(spurious_interrupt_bug)
1164 zeroentry do_spurious_interrupt_bug
Jan Beulich4b787e02006-06-26 13:56:55 +02001165END(spurious_interrupt_bug)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001166
1167#ifdef CONFIG_X86_MCE
1168 /* runs on exception stack */
1169ENTRY(machine_check)
Jan Beulich7effaa82005-09-12 18:49:24 +02001170 INTR_FRAME
Linus Torvalds1da177e2005-04-16 15:20:36 -07001171 pushq $0
1172 CFI_ADJUST_CFA_OFFSET 8
1173 paranoidentry do_machine_check
Ingo Molnar2601e642006-07-03 00:24:45 -07001174 jmp paranoid_exit1
Linus Torvalds1da177e2005-04-16 15:20:36 -07001175 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001176END(machine_check)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001177#endif
1178
Andi Kleen26995002006-08-02 22:37:28 +02001179/* Call softirq on interrupt stack. Interrupts are off. */
Andi Kleened6b6762005-07-28 21:15:49 -07001180ENTRY(call_softirq)
Jan Beulich7effaa82005-09-12 18:49:24 +02001181 CFI_STARTPROC
Andi Kleen26995002006-08-02 22:37:28 +02001182 push %rbp
1183 CFI_ADJUST_CFA_OFFSET 8
1184 CFI_REL_OFFSET rbp,0
1185 mov %rsp,%rbp
1186 CFI_DEF_CFA_REGISTER rbp
Andi Kleened6b6762005-07-28 21:15:49 -07001187 incl %gs:pda_irqcount
Andi Kleen26995002006-08-02 22:37:28 +02001188 cmove %gs:pda_irqstackptr,%rsp
1189 push %rbp # backlink for old unwinder
Andi Kleened6b6762005-07-28 21:15:49 -07001190 call __do_softirq
Andi Kleen26995002006-08-02 22:37:28 +02001191 leaveq
Jan Beulich7effaa82005-09-12 18:49:24 +02001192 CFI_DEF_CFA_REGISTER rsp
Andi Kleen26995002006-08-02 22:37:28 +02001193 CFI_ADJUST_CFA_OFFSET -8
Andi Kleened6b6762005-07-28 21:15:49 -07001194 decl %gs:pda_irqcount
Andi Kleened6b6762005-07-28 21:15:49 -07001195 ret
Jan Beulich7effaa82005-09-12 18:49:24 +02001196 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +02001197ENDPROC(call_softirq)
Andi Kleen75154f42007-06-23 02:29:25 +02001198
1199KPROBE_ENTRY(ignore_sysret)
1200 CFI_STARTPROC
1201 mov $-ENOSYS,%eax
1202 sysret
1203 CFI_ENDPROC
1204ENDPROC(ignore_sysret)