]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/x86/kernel/entry_64.S
x86: entry_64.S: factor out save_paranoid and paranoid_exit
[mirror_ubuntu-zesty-kernel.git] / arch / x86 / kernel / entry_64.S
CommitLineData
1da177e4
LT
1/*
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>
1da177e4
LT
7 */
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.
0bd7b798
AH
14 *
15 * Normal syscalls and interrupts don't save a full stack frame, this is
1da177e4 16 * only done for syscall tracing, signals or fork/exec et.al.
0bd7b798
AH
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.
1da177e4 21 * - partial stack frame: partially saved registers upto R11.
0bd7b798 22 * - full stack frame: Like partial stack frame, but all register saved.
2e91a17b
AK
23 *
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.
1da177e4
LT
38 */
39
1da177e4
LT
40#include <linux/linkage.h>
41#include <asm/segment.h>
1da177e4
LT
42#include <asm/cache.h>
43#include <asm/errno.h>
44#include <asm/dwarf2.h>
45#include <asm/calling.h>
e2d5df93 46#include <asm/asm-offsets.h>
1da177e4
LT
47#include <asm/msr.h>
48#include <asm/unistd.h>
49#include <asm/thread_info.h>
50#include <asm/hw_irq.h>
5f8efbb9 51#include <asm/page.h>
2601e64d 52#include <asm/irqflags.h>
72fe4858 53#include <asm/paravirt.h>
395a59d0 54#include <asm/ftrace.h>
1da177e4 55
86a1c34a
RM
56/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
57#include <linux/elf-em.h>
58#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
59#define __AUDIT_ARCH_64BIT 0x80000000
60#define __AUDIT_ARCH_LE 0x40000000
61
1da177e4 62 .code64
dcd072e2
AH
63/*
64 * Some macro's to hide the most frequently occuring CFI annotations.
65 */
14ae22ba 66 .macro pushq_cfi reg
dcd072e2
AH
67 pushq \reg
68 CFI_ADJUST_CFA_OFFSET 8
69 .endm
70
14ae22ba 71 .macro popq_cfi reg
dcd072e2
AH
72 popq \reg
73 CFI_ADJUST_CFA_OFFSET -8
74 .endm
75
14ae22ba 76 .macro movq_cfi reg offset=0
dcd072e2
AH
77 movq %\reg, \offset(%rsp)
78 CFI_REL_OFFSET \reg, \offset
79 .endm
1da177e4 80
c002a1e6
AH
81 .macro movq_cfi_restore offset reg
82 movq \offset(%rsp), %\reg
83 CFI_RESTORE \reg
84 .endm
85
606576ce 86#ifdef CONFIG_FUNCTION_TRACER
d61f82d0
SR
87#ifdef CONFIG_DYNAMIC_FTRACE
88ENTRY(mcount)
d61f82d0
SR
89 retq
90END(mcount)
91
92ENTRY(ftrace_caller)
93
94 /* taken from glibc */
95 subq $0x38, %rsp
96 movq %rax, (%rsp)
97 movq %rcx, 8(%rsp)
98 movq %rdx, 16(%rsp)
99 movq %rsi, 24(%rsp)
100 movq %rdi, 32(%rsp)
101 movq %r8, 40(%rsp)
102 movq %r9, 48(%rsp)
103
104 movq 0x38(%rsp), %rdi
105 movq 8(%rbp), %rsi
395a59d0 106 subq $MCOUNT_INSN_SIZE, %rdi
d61f82d0
SR
107
108.globl ftrace_call
109ftrace_call:
110 call ftrace_stub
111
112 movq 48(%rsp), %r9
113 movq 40(%rsp), %r8
114 movq 32(%rsp), %rdi
115 movq 24(%rsp), %rsi
116 movq 16(%rsp), %rdx
117 movq 8(%rsp), %rcx
118 movq (%rsp), %rax
119 addq $0x38, %rsp
120
121.globl ftrace_stub
122ftrace_stub:
123 retq
124END(ftrace_caller)
125
126#else /* ! CONFIG_DYNAMIC_FTRACE */
16444a8a
ACM
127ENTRY(mcount)
128 cmpq $ftrace_stub, ftrace_trace_function
129 jnz trace
130.globl ftrace_stub
131ftrace_stub:
132 retq
133
134trace:
135 /* taken from glibc */
136 subq $0x38, %rsp
137 movq %rax, (%rsp)
138 movq %rcx, 8(%rsp)
139 movq %rdx, 16(%rsp)
140 movq %rsi, 24(%rsp)
141 movq %rdi, 32(%rsp)
142 movq %r8, 40(%rsp)
143 movq %r9, 48(%rsp)
144
145 movq 0x38(%rsp), %rdi
146 movq 8(%rbp), %rsi
395a59d0 147 subq $MCOUNT_INSN_SIZE, %rdi
16444a8a
ACM
148
149 call *ftrace_trace_function
150
151 movq 48(%rsp), %r9
152 movq 40(%rsp), %r8
153 movq 32(%rsp), %rdi
154 movq 24(%rsp), %rsi
155 movq 16(%rsp), %rdx
156 movq 8(%rsp), %rcx
157 movq (%rsp), %rax
158 addq $0x38, %rsp
159
160 jmp ftrace_stub
161END(mcount)
d61f82d0 162#endif /* CONFIG_DYNAMIC_FTRACE */
606576ce 163#endif /* CONFIG_FUNCTION_TRACER */
16444a8a 164
dc37db4d 165#ifndef CONFIG_PREEMPT
1da177e4 166#define retint_kernel retint_restore_args
0bd7b798 167#endif
2601e64d 168
72fe4858 169#ifdef CONFIG_PARAVIRT
2be29982 170ENTRY(native_usergs_sysret64)
72fe4858
GOC
171 swapgs
172 sysretq
173#endif /* CONFIG_PARAVIRT */
174
2601e64d
IM
175
176.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
177#ifdef CONFIG_TRACE_IRQFLAGS
178 bt $9,EFLAGS-\offset(%rsp) /* interrupts off? */
179 jnc 1f
180 TRACE_IRQS_ON
1811:
182#endif
183.endm
184
1da177e4 185/*
0bd7b798
AH
186 * C code is not supposed to know about undefined top of stack. Every time
187 * a C function with an pt_regs argument is called from the SYSCALL based
1da177e4
LT
188 * fast path FIXUP_TOP_OF_STACK is needed.
189 * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
190 * manipulation.
0bd7b798
AH
191 */
192
193 /* %rsp:at FRAMEEND */
c002a1e6
AH
194 .macro FIXUP_TOP_OF_STACK tmp offset=0
195 movq %gs:pda_oldrsp,\tmp
196 movq \tmp,RSP+\offset(%rsp)
197 movq $__USER_DS,SS+\offset(%rsp)
198 movq $__USER_CS,CS+\offset(%rsp)
199 movq $-1,RCX+\offset(%rsp)
200 movq R11+\offset(%rsp),\tmp /* get eflags */
201 movq \tmp,EFLAGS+\offset(%rsp)
1da177e4
LT
202 .endm
203
c002a1e6
AH
204 .macro RESTORE_TOP_OF_STACK tmp offset=0
205 movq RSP+\offset(%rsp),\tmp
206 movq \tmp,%gs:pda_oldrsp
207 movq EFLAGS+\offset(%rsp),\tmp
208 movq \tmp,R11+\offset(%rsp)
1da177e4
LT
209 .endm
210
211 .macro FAKE_STACK_FRAME child_rip
212 /* push in order ss, rsp, eflags, cs, rip */
3829ee6b 213 xorl %eax, %eax
e04e0a63 214 pushq $__KERNEL_DS /* ss */
1da177e4 215 CFI_ADJUST_CFA_OFFSET 8
7effaa88 216 /*CFI_REL_OFFSET ss,0*/
1da177e4
LT
217 pushq %rax /* rsp */
218 CFI_ADJUST_CFA_OFFSET 8
7effaa88 219 CFI_REL_OFFSET rsp,0
1da177e4
LT
220 pushq $(1<<9) /* eflags - interrupts on */
221 CFI_ADJUST_CFA_OFFSET 8
7effaa88 222 /*CFI_REL_OFFSET rflags,0*/
1da177e4
LT
223 pushq $__KERNEL_CS /* cs */
224 CFI_ADJUST_CFA_OFFSET 8
7effaa88 225 /*CFI_REL_OFFSET cs,0*/
1da177e4
LT
226 pushq \child_rip /* rip */
227 CFI_ADJUST_CFA_OFFSET 8
7effaa88 228 CFI_REL_OFFSET rip,0
1da177e4
LT
229 pushq %rax /* orig rax */
230 CFI_ADJUST_CFA_OFFSET 8
231 .endm
232
233 .macro UNFAKE_STACK_FRAME
234 addq $8*6, %rsp
235 CFI_ADJUST_CFA_OFFSET -(6*8)
236 .endm
237
dcd072e2
AH
238/*
239 * initial frame state for interrupts (and exceptions without error code)
240 */
241 .macro EMPTY_FRAME start=1 offset=0
7effaa88 242 .if \start
dcd072e2 243 CFI_STARTPROC simple
adf14236 244 CFI_SIGNAL_FRAME
dcd072e2 245 CFI_DEF_CFA rsp,8+\offset
7effaa88 246 .else
dcd072e2 247 CFI_DEF_CFA_OFFSET 8+\offset
7effaa88 248 .endif
1da177e4 249 .endm
d99015b1
AH
250
251/*
dcd072e2 252 * initial frame state for interrupts (and exceptions without error code)
d99015b1 253 */
dcd072e2 254 .macro INTR_FRAME start=1 offset=0
e8a0e276
IM
255 EMPTY_FRAME \start, SS+8+\offset-RIP
256 /*CFI_REL_OFFSET ss, SS+\offset-RIP*/
257 CFI_REL_OFFSET rsp, RSP+\offset-RIP
258 /*CFI_REL_OFFSET rflags, EFLAGS+\offset-RIP*/
259 /*CFI_REL_OFFSET cs, CS+\offset-RIP*/
260 CFI_REL_OFFSET rip, RIP+\offset-RIP
d99015b1
AH
261 .endm
262
d99015b1
AH
263/*
264 * initial frame state for exceptions with error code (and interrupts
265 * with vector already pushed)
266 */
dcd072e2 267 .macro XCPT_FRAME start=1 offset=0
e8a0e276 268 INTR_FRAME \start, RIP+\offset-ORIG_RAX
dcd072e2
AH
269 /*CFI_REL_OFFSET orig_rax, ORIG_RAX-ORIG_RAX*/
270 .endm
271
272/*
273 * frame that enables calling into C.
274 */
275 .macro PARTIAL_FRAME start=1 offset=0
e8a0e276
IM
276 XCPT_FRAME \start, ORIG_RAX+\offset-ARGOFFSET
277 CFI_REL_OFFSET rdi, RDI+\offset-ARGOFFSET
278 CFI_REL_OFFSET rsi, RSI+\offset-ARGOFFSET
279 CFI_REL_OFFSET rdx, RDX+\offset-ARGOFFSET
280 CFI_REL_OFFSET rcx, RCX+\offset-ARGOFFSET
281 CFI_REL_OFFSET rax, RAX+\offset-ARGOFFSET
282 CFI_REL_OFFSET r8, R8+\offset-ARGOFFSET
283 CFI_REL_OFFSET r9, R9+\offset-ARGOFFSET
284 CFI_REL_OFFSET r10, R10+\offset-ARGOFFSET
285 CFI_REL_OFFSET r11, R11+\offset-ARGOFFSET
dcd072e2
AH
286 .endm
287
288/*
289 * frame that enables passing a complete pt_regs to a C function.
290 */
291 .macro DEFAULT_FRAME start=1 offset=0
e8a0e276 292 PARTIAL_FRAME \start, R11+\offset-R15
dcd072e2
AH
293 CFI_REL_OFFSET rbx, RBX+\offset
294 CFI_REL_OFFSET rbp, RBP+\offset
295 CFI_REL_OFFSET r12, R12+\offset
296 CFI_REL_OFFSET r13, R13+\offset
297 CFI_REL_OFFSET r14, R14+\offset
298 CFI_REL_OFFSET r15, R15+\offset
299 .endm
d99015b1
AH
300
301/* save partial stack frame */
302ENTRY(save_args)
303 XCPT_FRAME
304 cld
14ae22ba
IM
305 movq_cfi rdi, RDI+16-ARGOFFSET
306 movq_cfi rsi, RSI+16-ARGOFFSET
307 movq_cfi rdx, RDX+16-ARGOFFSET
308 movq_cfi rcx, RCX+16-ARGOFFSET
309 movq_cfi rax, RAX+16-ARGOFFSET
310 movq_cfi r8, R8+16-ARGOFFSET
311 movq_cfi r9, R9+16-ARGOFFSET
312 movq_cfi r10, R10+16-ARGOFFSET
313 movq_cfi r11, R11+16-ARGOFFSET
314
d99015b1 315 leaq -ARGOFFSET+16(%rsp),%rdi /* arg1 for handler */
14ae22ba 316 movq_cfi rbp, 8 /* push %rbp */
d99015b1
AH
317 leaq 8(%rsp), %rbp /* mov %rsp, %ebp */
318 testl $3, CS(%rdi)
319 je 1f
320 SWAPGS
321 /*
322 * irqcount is used to check if a CPU is already on an interrupt stack
323 * or not. While this is essentially redundant with preempt_count it is
324 * a little cheaper to use a separate counter in the PDA (short of
325 * moving irq_enter into assembly, which would be too much work)
326 */
3271: incl %gs:pda_irqcount
328 jne 2f
14ae22ba 329 popq_cfi %rax /* move return address... */
d99015b1 330 mov %gs:pda_irqstackptr,%rsp
dcd072e2 331 EMPTY_FRAME 0
14ae22ba 332 pushq_cfi %rax /* ... to the new stack */
d99015b1
AH
333 /*
334 * We entered an interrupt context - irqs are off:
335 */
3362: TRACE_IRQS_OFF
337 ret
338 CFI_ENDPROC
339END(save_args)
340
c002a1e6
AH
341ENTRY(save_rest)
342 PARTIAL_FRAME 1 REST_SKIP+8
343 movq 5*8+16(%rsp), %r11 /* save return address */
344 movq_cfi rbx, RBX+16
345 movq_cfi rbp, RBP+16
346 movq_cfi r12, R12+16
347 movq_cfi r13, R13+16
348 movq_cfi r14, R14+16
349 movq_cfi r15, R15+16
350 movq %r11, 8(%rsp) /* return address */
351 FIXUP_TOP_OF_STACK %r11, 16
352 ret
353 CFI_ENDPROC
354END(save_rest)
355
e2f6bc25
AH
356/* save complete stack frame */
357ENTRY(save_paranoid)
358 XCPT_FRAME 1 RDI+8
359 cld
360 movq_cfi rdi, RDI+8
361 movq_cfi rsi, RSI+8
362 movq_cfi rdx, RDX+8
363 movq_cfi rcx, RCX+8
364 movq_cfi rax, RAX+8
365 movq_cfi r8, R8+8
366 movq_cfi r9, R9+8
367 movq_cfi r10, R10+8
368 movq_cfi r11, R11+8
369 movq_cfi rbx, RBX+8
370 movq_cfi rbp, RBP+8
371 movq_cfi r12, R12+8
372 movq_cfi r13, R13+8
373 movq_cfi r14, R14+8
374 movq_cfi r15, R15+8
375 movl $1,%ebx
376 movl $MSR_GS_BASE,%ecx
377 rdmsr
378 testl %edx,%edx
379 js 1f /* negative -> in kernel */
380 SWAPGS
381 xorl %ebx,%ebx
3821: ret
383 CFI_ENDPROC
384END(save_paranoid)
385
1da177e4
LT
386/*
387 * A newly forked process directly context switches into this.
0bd7b798
AH
388 */
389/* rdi: prev */
1da177e4 390ENTRY(ret_from_fork)
dcd072e2 391 DEFAULT_FRAME
658fdbef 392 push kernel_eflags(%rip)
e0a5a5d9 393 CFI_ADJUST_CFA_OFFSET 8
658fdbef 394 popf # reset kernel eflags
e0a5a5d9 395 CFI_ADJUST_CFA_OFFSET -8
1da177e4
LT
396 call schedule_tail
397 GET_THREAD_INFO(%rcx)
26ccb8a7 398 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
1da177e4 399 jnz rff_trace
0bd7b798 400rff_action:
1da177e4
LT
401 RESTORE_REST
402 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread?
403 je int_ret_from_sys_call
26ccb8a7 404 testl $_TIF_IA32,TI_flags(%rcx)
1da177e4 405 jnz int_ret_from_sys_call
c002a1e6 406 RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
1da177e4
LT
407 jmp ret_from_sys_call
408rff_trace:
409 movq %rsp,%rdi
410 call syscall_trace_leave
0bd7b798 411 GET_THREAD_INFO(%rcx)
1da177e4
LT
412 jmp rff_action
413 CFI_ENDPROC
4b787e0b 414END(ret_from_fork)
1da177e4
LT
415
416/*
417 * System call entry. Upto 6 arguments in registers are supported.
418 *
419 * SYSCALL does not save anything on the stack and does not change the
420 * stack pointer.
421 */
0bd7b798 422
1da177e4 423/*
0bd7b798 424 * Register setup:
1da177e4
LT
425 * rax system call number
426 * rdi arg0
0bd7b798 427 * rcx return address for syscall/sysret, C arg3
1da177e4 428 * rsi arg1
0bd7b798 429 * rdx arg2
1da177e4
LT
430 * r10 arg3 (--> moved to rcx for C)
431 * r8 arg4
432 * r9 arg5
433 * r11 eflags for syscall/sysret, temporary for C
0bd7b798
AH
434 * r12-r15,rbp,rbx saved by C code, not touched.
435 *
1da177e4
LT
436 * Interrupts are off on entry.
437 * Only called from user space.
438 *
439 * XXX if we had a free scratch register we could save the RSP into the stack frame
440 * and report it properly in ps. Unfortunately we haven't.
7bf36bbc
AK
441 *
442 * When user can change the frames always force IRET. That is because
443 * it deals with uncanonical addresses better. SYSRET has trouble
444 * with them due to bugs in both AMD and Intel CPUs.
0bd7b798 445 */
1da177e4
LT
446
447ENTRY(system_call)
7effaa88 448 CFI_STARTPROC simple
adf14236 449 CFI_SIGNAL_FRAME
dffead4e 450 CFI_DEF_CFA rsp,PDA_STACKOFFSET
7effaa88
JB
451 CFI_REGISTER rip,rcx
452 /*CFI_REGISTER rflags,r11*/
72fe4858
GOC
453 SWAPGS_UNSAFE_STACK
454 /*
455 * A hypervisor implementation might want to use a label
456 * after the swapgs, so that it can do the swapgs
457 * for the guest and jump here on syscall.
458 */
459ENTRY(system_call_after_swapgs)
460
0bd7b798 461 movq %rsp,%gs:pda_oldrsp
1da177e4 462 movq %gs:pda_kernelstack,%rsp
2601e64d
IM
463 /*
464 * No need to follow this irqs off/on section - it's straight
465 * and short:
466 */
72fe4858 467 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 468 SAVE_ARGS 8,1
0bd7b798 469 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
7effaa88
JB
470 movq %rcx,RIP-ARGOFFSET(%rsp)
471 CFI_REL_OFFSET rip,RIP-ARGOFFSET
1da177e4 472 GET_THREAD_INFO(%rcx)
d4d67150 473 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%rcx)
1da177e4 474 jnz tracesys
86a1c34a 475system_call_fastpath:
1da177e4
LT
476 cmpq $__NR_syscall_max,%rax
477 ja badsys
478 movq %r10,%rcx
479 call *sys_call_table(,%rax,8) # XXX: rip relative
480 movq %rax,RAX-ARGOFFSET(%rsp)
481/*
482 * Syscall return path ending with SYSRET (fast path)
0bd7b798
AH
483 * Has incomplete stack frame and undefined top of stack.
484 */
1da177e4 485ret_from_sys_call:
11b854b2 486 movl $_TIF_ALLWORK_MASK,%edi
1da177e4 487 /* edi: flagmask */
0bd7b798 488sysret_check:
10cd706d 489 LOCKDEP_SYS_EXIT
1da177e4 490 GET_THREAD_INFO(%rcx)
72fe4858 491 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 492 TRACE_IRQS_OFF
26ccb8a7 493 movl TI_flags(%rcx),%edx
1da177e4 494 andl %edi,%edx
0bd7b798 495 jnz sysret_careful
bcddc015 496 CFI_REMEMBER_STATE
2601e64d
IM
497 /*
498 * sysretq will re-enable interrupts:
499 */
500 TRACE_IRQS_ON
1da177e4 501 movq RIP-ARGOFFSET(%rsp),%rcx
7effaa88 502 CFI_REGISTER rip,rcx
1da177e4 503 RESTORE_ARGS 0,-ARG_SKIP,1
7effaa88 504 /*CFI_REGISTER rflags,r11*/
c7245da6 505 movq %gs:pda_oldrsp, %rsp
2be29982 506 USERGS_SYSRET64
1da177e4 507
bcddc015 508 CFI_RESTORE_STATE
1da177e4 509 /* Handle reschedules */
0bd7b798 510 /* edx: work, edi: workmask */
1da177e4
LT
511sysret_careful:
512 bt $TIF_NEED_RESCHED,%edx
513 jnc sysret_signal
2601e64d 514 TRACE_IRQS_ON
72fe4858 515 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 516 pushq %rdi
7effaa88 517 CFI_ADJUST_CFA_OFFSET 8
1da177e4
LT
518 call schedule
519 popq %rdi
7effaa88 520 CFI_ADJUST_CFA_OFFSET -8
1da177e4
LT
521 jmp sysret_check
522
0bd7b798 523 /* Handle a signal */
1da177e4 524sysret_signal:
2601e64d 525 TRACE_IRQS_ON
72fe4858 526 ENABLE_INTERRUPTS(CLBR_NONE)
86a1c34a
RM
527#ifdef CONFIG_AUDITSYSCALL
528 bt $TIF_SYSCALL_AUDIT,%edx
529 jc sysret_audit
530#endif
10ffdbb8 531 /* edx: work flags (arg3) */
1da177e4
LT
532 leaq do_notify_resume(%rip),%rax
533 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
534 xorl %esi,%esi # oldset -> arg2
535 call ptregscall_common
15e8f348 536 movl $_TIF_WORK_MASK,%edi
7bf36bbc
AK
537 /* Use IRET because user could have changed frame. This
538 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
72fe4858 539 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 540 TRACE_IRQS_OFF
7bf36bbc 541 jmp int_with_check
0bd7b798 542
7effaa88
JB
543badsys:
544 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
545 jmp ret_from_sys_call
546
86a1c34a
RM
547#ifdef CONFIG_AUDITSYSCALL
548 /*
549 * Fast path for syscall audit without full syscall trace.
550 * We just call audit_syscall_entry() directly, and then
551 * jump back to the normal fast path.
552 */
553auditsys:
554 movq %r10,%r9 /* 6th arg: 4th syscall arg */
555 movq %rdx,%r8 /* 5th arg: 3rd syscall arg */
556 movq %rsi,%rcx /* 4th arg: 2nd syscall arg */
557 movq %rdi,%rdx /* 3rd arg: 1st syscall arg */
558 movq %rax,%rsi /* 2nd arg: syscall number */
559 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */
560 call audit_syscall_entry
561 LOAD_ARGS 0 /* reload call-clobbered registers */
562 jmp system_call_fastpath
563
564 /*
565 * Return fast path for syscall audit. Call audit_syscall_exit()
566 * directly and then jump back to the fast path with TIF_SYSCALL_AUDIT
567 * masked off.
568 */
569sysret_audit:
570 movq %rax,%rsi /* second arg, syscall return value */
571 cmpq $0,%rax /* is it < 0? */
572 setl %al /* 1 if so, 0 if not */
573 movzbl %al,%edi /* zero-extend that into %edi */
574 inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */
575 call audit_syscall_exit
576 movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
577 jmp sysret_check
578#endif /* CONFIG_AUDITSYSCALL */
579
1da177e4 580 /* Do syscall tracing */
0bd7b798 581tracesys:
86a1c34a
RM
582#ifdef CONFIG_AUDITSYSCALL
583 testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
584 jz auditsys
585#endif
1da177e4 586 SAVE_REST
a31f8dd7 587 movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
1da177e4
LT
588 FIXUP_TOP_OF_STACK %rdi
589 movq %rsp,%rdi
590 call syscall_trace_enter
d4d67150
RM
591 /*
592 * Reload arg registers from stack in case ptrace changed them.
593 * We don't reload %rax because syscall_trace_enter() returned
594 * the value it wants us to use in the table lookup.
595 */
596 LOAD_ARGS ARGOFFSET, 1
1da177e4
LT
597 RESTORE_REST
598 cmpq $__NR_syscall_max,%rax
a31f8dd7 599 ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */
1da177e4
LT
600 movq %r10,%rcx /* fixup for C */
601 call *sys_call_table(,%rax,8)
a31f8dd7 602 movq %rax,RAX-ARGOFFSET(%rsp)
7bf36bbc 603 /* Use IRET because user could have changed frame */
0bd7b798
AH
604
605/*
1da177e4
LT
606 * Syscall return path ending with IRET.
607 * Has correct top of stack, but partial stack frame.
bcddc015
JB
608 */
609 .globl int_ret_from_sys_call
5cbf1565 610 .globl int_with_check
bcddc015 611int_ret_from_sys_call:
72fe4858 612 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 613 TRACE_IRQS_OFF
1da177e4
LT
614 testl $3,CS-ARGOFFSET(%rsp)
615 je retint_restore_args
616 movl $_TIF_ALLWORK_MASK,%edi
617 /* edi: mask to check */
618int_with_check:
10cd706d 619 LOCKDEP_SYS_EXIT_IRQ
1da177e4 620 GET_THREAD_INFO(%rcx)
26ccb8a7 621 movl TI_flags(%rcx),%edx
1da177e4
LT
622 andl %edi,%edx
623 jnz int_careful
26ccb8a7 624 andl $~TS_COMPAT,TI_status(%rcx)
1da177e4
LT
625 jmp retint_swapgs
626
627 /* Either reschedule or signal or syscall exit tracking needed. */
628 /* First do a reschedule test. */
629 /* edx: work, edi: workmask */
630int_careful:
631 bt $TIF_NEED_RESCHED,%edx
632 jnc int_very_careful
2601e64d 633 TRACE_IRQS_ON
72fe4858 634 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 635 pushq %rdi
7effaa88 636 CFI_ADJUST_CFA_OFFSET 8
1da177e4
LT
637 call schedule
638 popq %rdi
7effaa88 639 CFI_ADJUST_CFA_OFFSET -8
72fe4858 640 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 641 TRACE_IRQS_OFF
1da177e4
LT
642 jmp int_with_check
643
644 /* handle signals and tracing -- both require a full stack frame */
645int_very_careful:
2601e64d 646 TRACE_IRQS_ON
72fe4858 647 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 648 SAVE_REST
0bd7b798 649 /* Check for syscall exit trace */
d4d67150 650 testl $_TIF_WORK_SYSCALL_EXIT,%edx
1da177e4
LT
651 jz int_signal
652 pushq %rdi
7effaa88 653 CFI_ADJUST_CFA_OFFSET 8
0bd7b798 654 leaq 8(%rsp),%rdi # &ptregs -> arg1
1da177e4
LT
655 call syscall_trace_leave
656 popq %rdi
7effaa88 657 CFI_ADJUST_CFA_OFFSET -8
d4d67150 658 andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi
1da177e4 659 jmp int_restore_rest
0bd7b798 660
1da177e4 661int_signal:
8f4d37ec 662 testl $_TIF_DO_NOTIFY_MASK,%edx
1da177e4
LT
663 jz 1f
664 movq %rsp,%rdi # &ptregs -> arg1
665 xorl %esi,%esi # oldset -> arg2
666 call do_notify_resume
eca91e78 6671: movl $_TIF_WORK_MASK,%edi
1da177e4
LT
668int_restore_rest:
669 RESTORE_REST
72fe4858 670 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 671 TRACE_IRQS_OFF
1da177e4
LT
672 jmp int_with_check
673 CFI_ENDPROC
bcddc015 674END(system_call)
0bd7b798
AH
675
676/*
1da177e4 677 * Certain special system calls that need to save a complete full stack frame.
0bd7b798 678 */
1da177e4 679 .macro PTREGSCALL label,func,arg
c002a1e6
AH
680ENTRY(\label)
681 PARTIAL_FRAME 1 8 /* offset 8: return address */
682 subq $REST_SKIP, %rsp
683 CFI_ADJUST_CFA_OFFSET REST_SKIP
684 call save_rest
685 DEFAULT_FRAME 0 8 /* offset 8: return address */
686 leaq 8(%rsp), \arg /* pt_regs pointer */
687 call \func
688 jmp ptregscall_common
689 CFI_ENDPROC
4b787e0b 690END(\label)
1da177e4
LT
691 .endm
692
693 PTREGSCALL stub_clone, sys_clone, %r8
694 PTREGSCALL stub_fork, sys_fork, %rdi
695 PTREGSCALL stub_vfork, sys_vfork, %rdi
1da177e4
LT
696 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
697 PTREGSCALL stub_iopl, sys_iopl, %rsi
698
699ENTRY(ptregscall_common)
c002a1e6
AH
700 DEFAULT_FRAME 1 8 /* offset 8: return address */
701 RESTORE_TOP_OF_STACK %r11, 8
702 movq_cfi_restore R15+8, r15
703 movq_cfi_restore R14+8, r14
704 movq_cfi_restore R13+8, r13
705 movq_cfi_restore R12+8, r12
706 movq_cfi_restore RBP+8, rbp
707 movq_cfi_restore RBX+8, rbx
708 ret $REST_SKIP /* pop extended registers */
1da177e4 709 CFI_ENDPROC
4b787e0b 710END(ptregscall_common)
0bd7b798 711
1da177e4
LT
712ENTRY(stub_execve)
713 CFI_STARTPROC
714 popq %r11
7effaa88
JB
715 CFI_ADJUST_CFA_OFFSET -8
716 CFI_REGISTER rip, r11
1da177e4 717 SAVE_REST
1da177e4 718 FIXUP_TOP_OF_STACK %r11
5d119b2c 719 movq %rsp, %rcx
1da177e4 720 call sys_execve
1da177e4 721 RESTORE_TOP_OF_STACK %r11
1da177e4
LT
722 movq %rax,RAX(%rsp)
723 RESTORE_REST
724 jmp int_ret_from_sys_call
725 CFI_ENDPROC
4b787e0b 726END(stub_execve)
0bd7b798 727
1da177e4
LT
728/*
729 * sigreturn is special because it needs to restore all registers on return.
730 * This cannot be done with SYSRET, so use the IRET return path instead.
0bd7b798 731 */
1da177e4
LT
732ENTRY(stub_rt_sigreturn)
733 CFI_STARTPROC
7effaa88
JB
734 addq $8, %rsp
735 CFI_ADJUST_CFA_OFFSET -8
1da177e4
LT
736 SAVE_REST
737 movq %rsp,%rdi
738 FIXUP_TOP_OF_STACK %r11
739 call sys_rt_sigreturn
740 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
741 RESTORE_REST
742 jmp int_ret_from_sys_call
743 CFI_ENDPROC
4b787e0b 744END(stub_rt_sigreturn)
1da177e4 745
939b7871
PA
746/*
747 * Build the entry stubs and pointer table with some assembler magic.
748 * We pack 7 stubs into a single 32-byte chunk, which will fit in a
749 * single cache line on all modern x86 implementations.
750 */
751 .section .init.rodata,"a"
752ENTRY(interrupt)
753 .text
754 .p2align 5
755 .p2align CONFIG_X86_L1_CACHE_SHIFT
756ENTRY(irq_entries_start)
757 INTR_FRAME
758vector=FIRST_EXTERNAL_VECTOR
759.rept (NR_VECTORS-FIRST_EXTERNAL_VECTOR+6)/7
760 .balign 32
761 .rept 7
762 .if vector < NR_VECTORS
8665596e 763 .if vector <> FIRST_EXTERNAL_VECTOR
939b7871
PA
764 CFI_ADJUST_CFA_OFFSET -8
765 .endif
7661: pushq $(~vector+0x80) /* Note: always in signed byte range */
767 CFI_ADJUST_CFA_OFFSET 8
8665596e 768 .if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6
939b7871
PA
769 jmp 2f
770 .endif
771 .previous
772 .quad 1b
773 .text
774vector=vector+1
775 .endif
776 .endr
7772: jmp common_interrupt
778.endr
779 CFI_ENDPROC
780END(irq_entries_start)
781
782.previous
783END(interrupt)
784.previous
785
d99015b1 786/*
1da177e4
LT
787 * Interrupt entry/exit.
788 *
789 * Interrupt entry points save only callee clobbered registers in fast path.
d99015b1
AH
790 *
791 * Entry runs with interrupts off.
792 */
1da177e4 793
722024db 794/* 0(%rsp): ~(interrupt number) */
1da177e4 795 .macro interrupt func
d99015b1
AH
796 subq $10*8, %rsp
797 CFI_ADJUST_CFA_OFFSET 10*8
798 call save_args
dcd072e2 799 PARTIAL_FRAME 0
1da177e4
LT
800 call \func
801 .endm
802
722024db
AH
803 /*
804 * The interrupt stubs push (~vector+0x80) onto the stack and
805 * then jump to common_interrupt.
806 */
939b7871
PA
807 .p2align CONFIG_X86_L1_CACHE_SHIFT
808common_interrupt:
7effaa88 809 XCPT_FRAME
722024db 810 addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */
1da177e4
LT
811 interrupt do_IRQ
812 /* 0(%rsp): oldrsp-ARGOFFSET */
7effaa88 813ret_from_intr:
72fe4858 814 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 815 TRACE_IRQS_OFF
3829ee6b 816 decl %gs:pda_irqcount
1de9c3f6 817 leaveq
7effaa88 818 CFI_DEF_CFA_REGISTER rsp
1de9c3f6 819 CFI_ADJUST_CFA_OFFSET -8
7effaa88 820exit_intr:
1da177e4
LT
821 GET_THREAD_INFO(%rcx)
822 testl $3,CS-ARGOFFSET(%rsp)
823 je retint_kernel
0bd7b798 824
1da177e4
LT
825 /* Interrupt came from user space */
826 /*
827 * Has a correct top of stack, but a partial stack frame
828 * %rcx: thread info. Interrupts off.
0bd7b798 829 */
1da177e4
LT
830retint_with_reschedule:
831 movl $_TIF_WORK_MASK,%edi
7effaa88 832retint_check:
10cd706d 833 LOCKDEP_SYS_EXIT_IRQ
26ccb8a7 834 movl TI_flags(%rcx),%edx
1da177e4 835 andl %edi,%edx
7effaa88 836 CFI_REMEMBER_STATE
1da177e4 837 jnz retint_careful
10cd706d
PZ
838
839retint_swapgs: /* return to user-space */
2601e64d
IM
840 /*
841 * The iretq could re-enable interrupts:
842 */
72fe4858 843 DISABLE_INTERRUPTS(CLBR_ANY)
2601e64d 844 TRACE_IRQS_IRETQ
72fe4858 845 SWAPGS
2601e64d
IM
846 jmp restore_args
847
10cd706d 848retint_restore_args: /* return to kernel space */
72fe4858 849 DISABLE_INTERRUPTS(CLBR_ANY)
2601e64d
IM
850 /*
851 * The iretq could re-enable interrupts:
852 */
853 TRACE_IRQS_IRETQ
854restore_args:
3701d863
IM
855 RESTORE_ARGS 0,8,0
856
f7f3d791 857irq_return:
72fe4858 858 INTERRUPT_RETURN
3701d863
IM
859
860 .section __ex_table, "a"
861 .quad irq_return, bad_iret
862 .previous
863
864#ifdef CONFIG_PARAVIRT
72fe4858 865ENTRY(native_iret)
1da177e4
LT
866 iretq
867
868 .section __ex_table,"a"
72fe4858 869 .quad native_iret, bad_iret
1da177e4 870 .previous
3701d863
IM
871#endif
872
1da177e4 873 .section .fixup,"ax"
1da177e4 874bad_iret:
3aa4b37d
RM
875 /*
876 * The iret traps when the %cs or %ss being restored is bogus.
877 * We've lost the original trap vector and error code.
878 * #GPF is the most likely one to get for an invalid selector.
879 * So pretend we completed the iret and took the #GPF in user mode.
880 *
881 * We are now running with the kernel GS after exception recovery.
882 * But error_entry expects us to have user GS to match the user %cs,
883 * so swap back.
884 */
885 pushq $0
886
887 SWAPGS
888 jmp general_protection
889
72fe4858
GOC
890 .previous
891
7effaa88 892 /* edi: workmask, edx: work */
1da177e4 893retint_careful:
7effaa88 894 CFI_RESTORE_STATE
1da177e4
LT
895 bt $TIF_NEED_RESCHED,%edx
896 jnc retint_signal
2601e64d 897 TRACE_IRQS_ON
72fe4858 898 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 899 pushq %rdi
7effaa88 900 CFI_ADJUST_CFA_OFFSET 8
1da177e4 901 call schedule
0bd7b798 902 popq %rdi
7effaa88 903 CFI_ADJUST_CFA_OFFSET -8
1da177e4 904 GET_THREAD_INFO(%rcx)
72fe4858 905 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 906 TRACE_IRQS_OFF
1da177e4 907 jmp retint_check
0bd7b798 908
1da177e4 909retint_signal:
8f4d37ec 910 testl $_TIF_DO_NOTIFY_MASK,%edx
10ffdbb8 911 jz retint_swapgs
2601e64d 912 TRACE_IRQS_ON
72fe4858 913 ENABLE_INTERRUPTS(CLBR_NONE)
1da177e4 914 SAVE_REST
0bd7b798 915 movq $-1,ORIG_RAX(%rsp)
3829ee6b 916 xorl %esi,%esi # oldset
1da177e4
LT
917 movq %rsp,%rdi # &pt_regs
918 call do_notify_resume
919 RESTORE_REST
72fe4858 920 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 921 TRACE_IRQS_OFF
be9e6870 922 GET_THREAD_INFO(%rcx)
eca91e78 923 jmp retint_with_reschedule
1da177e4
LT
924
925#ifdef CONFIG_PREEMPT
926 /* Returning to kernel space. Check if we need preemption */
927 /* rcx: threadinfo. interrupts off. */
b06babac 928ENTRY(retint_kernel)
26ccb8a7 929 cmpl $0,TI_preempt_count(%rcx)
1da177e4 930 jnz retint_restore_args
26ccb8a7 931 bt $TIF_NEED_RESCHED,TI_flags(%rcx)
1da177e4
LT
932 jnc retint_restore_args
933 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
934 jnc retint_restore_args
935 call preempt_schedule_irq
936 jmp exit_intr
0bd7b798 937#endif
4b787e0b 938
1da177e4 939 CFI_ENDPROC
4b787e0b 940END(common_interrupt)
0bd7b798 941
1da177e4
LT
942/*
943 * APIC interrupts.
0bd7b798 944 */
d99015b1
AH
945 .p2align 5
946
1da177e4 947 .macro apicinterrupt num,func
7effaa88 948 INTR_FRAME
19eadf98 949 pushq $~(\num)
7effaa88 950 CFI_ADJUST_CFA_OFFSET 8
1da177e4
LT
951 interrupt \func
952 jmp ret_from_intr
953 CFI_ENDPROC
954 .endm
955
956ENTRY(thermal_interrupt)
957 apicinterrupt THERMAL_APIC_VECTOR,smp_thermal_interrupt
4b787e0b 958END(thermal_interrupt)
1da177e4 959
89b831ef
JS
960ENTRY(threshold_interrupt)
961 apicinterrupt THRESHOLD_APIC_VECTOR,mce_threshold_interrupt
4b787e0b 962END(threshold_interrupt)
89b831ef 963
0bd7b798 964#ifdef CONFIG_SMP
1da177e4
LT
965ENTRY(reschedule_interrupt)
966 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
4b787e0b 967END(reschedule_interrupt)
1da177e4 968
e5bc8b6b
AK
969 .macro INVALIDATE_ENTRY num
970ENTRY(invalidate_interrupt\num)
0bd7b798 971 apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt
4b787e0b 972END(invalidate_interrupt\num)
e5bc8b6b
AK
973 .endm
974
975 INVALIDATE_ENTRY 0
976 INVALIDATE_ENTRY 1
977 INVALIDATE_ENTRY 2
978 INVALIDATE_ENTRY 3
979 INVALIDATE_ENTRY 4
980 INVALIDATE_ENTRY 5
981 INVALIDATE_ENTRY 6
982 INVALIDATE_ENTRY 7
1da177e4
LT
983
984ENTRY(call_function_interrupt)
985 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
4b787e0b 986END(call_function_interrupt)
3b16cf87
JA
987ENTRY(call_function_single_interrupt)
988 apicinterrupt CALL_FUNCTION_SINGLE_VECTOR,smp_call_function_single_interrupt
989END(call_function_single_interrupt)
61014292
EB
990ENTRY(irq_move_cleanup_interrupt)
991 apicinterrupt IRQ_MOVE_CLEANUP_VECTOR,smp_irq_move_cleanup_interrupt
992END(irq_move_cleanup_interrupt)
1da177e4
LT
993#endif
994
1da177e4
LT
995ENTRY(apic_timer_interrupt)
996 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
4b787e0b 997END(apic_timer_interrupt)
1da177e4 998
1812924b
CW
999ENTRY(uv_bau_message_intr1)
1000 apicinterrupt 220,uv_bau_message_interrupt
1001END(uv_bau_message_intr1)
1002
1da177e4
LT
1003ENTRY(error_interrupt)
1004 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt
4b787e0b 1005END(error_interrupt)
1da177e4
LT
1006
1007ENTRY(spurious_interrupt)
1008 apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
4b787e0b 1009END(spurious_interrupt)
0bd7b798 1010
1da177e4
LT
1011/*
1012 * Exception entry points.
0bd7b798 1013 */
1da177e4 1014 .macro zeroentry sym
7effaa88 1015 INTR_FRAME
fab58420 1016 PARAVIRT_ADJUST_EXCEPTION_FRAME
14ae22ba 1017 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
d99015b1
AH
1018 subq $15*8,%rsp
1019 CFI_ADJUST_CFA_OFFSET 15*8
1020 call error_entry
dcd072e2 1021 DEFAULT_FRAME 0
d99015b1
AH
1022 movq %rsp,%rdi /* pt_regs pointer */
1023 xorl %esi,%esi /* no error code */
1024 call \sym
1025 jmp error_exit /* %ebx: no swapgs flag */
7effaa88 1026 CFI_ENDPROC
0bd7b798 1027 .endm
1da177e4
LT
1028
1029 .macro errorentry sym
7effaa88 1030 XCPT_FRAME
fab58420 1031 PARAVIRT_ADJUST_EXCEPTION_FRAME
d99015b1
AH
1032 subq $15*8,%rsp
1033 CFI_ADJUST_CFA_OFFSET 15*8
1034 call error_entry
dcd072e2 1035 DEFAULT_FRAME 0
d99015b1
AH
1036 movq %rsp,%rdi /* pt_regs pointer */
1037 movq ORIG_RAX(%rsp),%rsi /* get error code */
1038 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
1039 call \sym
1040 jmp error_exit /* %ebx: no swapgs flag */
7effaa88 1041 CFI_ENDPROC
1da177e4
LT
1042 .endm
1043
1044 /* error code is on the stack already */
e2f6bc25
AH
1045 .macro paranoidentry sym ist=0
1046 subq $15*8, %rsp
1047 CFI_ADJUST_CFA_OFFSET 15*8
1048 call save_paranoid
1049 DEFAULT_FRAME 0
b556b35e
JB
1050 .if \ist
1051 movq %gs:pda_data_offset, %rbp
1052 .endif
7e61a793 1053 TRACE_IRQS_OFF
b556b35e 1054 movq %rsp,%rdi
1da177e4
LT
1055 movq ORIG_RAX(%rsp),%rsi
1056 movq $-1,ORIG_RAX(%rsp)
b556b35e 1057 .if \ist
5f8efbb9 1058 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
b556b35e 1059 .endif
1da177e4 1060 call \sym
b556b35e 1061 .if \ist
5f8efbb9 1062 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
b556b35e 1063 .endif
72fe4858 1064 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 1065 TRACE_IRQS_OFF
1da177e4 1066 .endm
2601e64d
IM
1067
1068 /*
1069 * "Paranoid" exit path from exception stack.
1070 * Paranoid because this is used by NMIs and cannot take
1071 * any kernel state for granted.
1072 * We don't do kernel preemption checks here, because only
1073 * NMI should be common and it does not enable IRQs and
1074 * cannot get reschedule ticks.
1075 *
1076 * "trace" is 0 for the NMI handler only, because irq-tracing
1077 * is fundamentally NMI-unsafe. (we cannot change the soft and
1078 * hard flags at once, atomically)
1079 */
e2f6bc25 1080
2601e64d 1081 /* ebx: no swapgs flag */
e2f6bc25
AH
1082KPROBE_ENTRY(paranoid_exit)
1083 INTR_FRAME
2601e64d 1084 testl %ebx,%ebx /* swapgs needed? */
e2f6bc25 1085 jnz paranoid_restore
2601e64d 1086 testl $3,CS(%rsp)
e2f6bc25
AH
1087 jnz paranoid_userspace
1088paranoid_swapgs:
2601e64d 1089 TRACE_IRQS_IRETQ 0
72fe4858 1090 SWAPGS_UNSAFE_STACK
e2f6bc25 1091paranoid_restore:
2601e64d 1092 RESTORE_ALL 8
3701d863 1093 jmp irq_return
e2f6bc25 1094paranoid_userspace:
2601e64d 1095 GET_THREAD_INFO(%rcx)
26ccb8a7 1096 movl TI_flags(%rcx),%ebx
2601e64d 1097 andl $_TIF_WORK_MASK,%ebx
e2f6bc25 1098 jz paranoid_swapgs
2601e64d
IM
1099 movq %rsp,%rdi /* &pt_regs */
1100 call sync_regs
1101 movq %rax,%rsp /* switch stack for scheduling */
1102 testl $_TIF_NEED_RESCHED,%ebx
e2f6bc25 1103 jnz paranoid_schedule
2601e64d 1104 movl %ebx,%edx /* arg3: thread flags */
2601e64d 1105 TRACE_IRQS_ON
72fe4858 1106 ENABLE_INTERRUPTS(CLBR_NONE)
2601e64d
IM
1107 xorl %esi,%esi /* arg2: oldset */
1108 movq %rsp,%rdi /* arg1: &pt_regs */
1109 call do_notify_resume
72fe4858 1110 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 1111 TRACE_IRQS_OFF
e2f6bc25
AH
1112 jmp paranoid_userspace
1113paranoid_schedule:
2601e64d 1114 TRACE_IRQS_ON
72fe4858 1115 ENABLE_INTERRUPTS(CLBR_ANY)
2601e64d 1116 call schedule
72fe4858 1117 DISABLE_INTERRUPTS(CLBR_ANY)
2601e64d 1118 TRACE_IRQS_OFF
e2f6bc25 1119 jmp paranoid_userspace
2601e64d 1120 CFI_ENDPROC
e2f6bc25 1121END(paranoid_exit)
2601e64d 1122
1da177e4 1123/*
d99015b1
AH
1124 * Exception entry point. This expects an error code/orig_rax on the stack.
1125 * returns in "no swapgs flag" in %ebx.
0bd7b798 1126 */
d28c4393 1127KPROBE_ENTRY(error_entry)
dcd072e2 1128 XCPT_FRAME
d99015b1
AH
1129 CFI_ADJUST_CFA_OFFSET 15*8
1130 /* oldrax contains error code */
0bd7b798 1131 cld
14ae22ba
IM
1132 movq_cfi rdi, RDI+8
1133 movq_cfi rsi, RSI+8
1134 movq_cfi rdx, RDX+8
1135 movq_cfi rcx, RCX+8
1136 movq_cfi rax, RAX+8
1137 movq_cfi r8, R8+8
1138 movq_cfi r9, R9+8
1139 movq_cfi r10, R10+8
1140 movq_cfi r11, R11+8
1141 movq_cfi rbx, RBX+8
1142 movq_cfi rbp, RBP+8
1143 movq_cfi r12, R12+8
1144 movq_cfi r13, R13+8
1145 movq_cfi r14, R14+8
1146 movq_cfi r15, R15+8
0bd7b798 1147 xorl %ebx,%ebx
d99015b1
AH
1148 testl $3,CS+8(%rsp)
1149 je error_kernelspace
0bd7b798 1150error_swapgs:
72fe4858 1151 SWAPGS
6b11d4ef
AH
1152error_sti:
1153 TRACE_IRQS_OFF
d99015b1
AH
1154 ret
1155 CFI_ENDPROC
1156
1157/*
1158 * There are two places in the kernel that can potentially fault with
1159 * usergs. Handle them here. The exception handlers after iret run with
1160 * kernel gs again, so don't set the user space flag. B stepping K8s
1161 * sometimes report an truncated RIP for IRET exceptions returning to
1162 * compat mode. Check for these here too.
1163 */
1164error_kernelspace:
1165 incl %ebx
1166 leaq irq_return(%rip),%rcx
1167 cmpq %rcx,RIP+8(%rsp)
1168 je error_swapgs
1169 movl %ecx,%ecx /* zero extend */
1170 cmpq %rcx,RIP+8(%rsp)
1171 je error_swapgs
1172 cmpq $gs_change,RIP+8(%rsp)
1173 je error_swapgs
1174 jmp error_sti
1175KPROBE_END(error_entry)
1176
1177
1178/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
1179KPROBE_ENTRY(error_exit)
dcd072e2 1180 DEFAULT_FRAME
10cd706d 1181 movl %ebx,%eax
1da177e4 1182 RESTORE_REST
72fe4858 1183 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 1184 TRACE_IRQS_OFF
0bd7b798 1185 GET_THREAD_INFO(%rcx)
1da177e4 1186 testl %eax,%eax
d99015b1 1187 jne retint_kernel
10cd706d 1188 LOCKDEP_SYS_EXIT_IRQ
d99015b1
AH
1189 movl TI_flags(%rcx),%edx
1190 movl $_TIF_WORK_MASK,%edi
1191 andl %edi,%edx
1192 jnz retint_careful
10cd706d 1193 jmp retint_swapgs
1da177e4 1194 CFI_ENDPROC
d99015b1 1195KPROBE_END(error_exit)
0bd7b798 1196
1da177e4 1197 /* Reload gs selector with exception handling */
0bd7b798 1198 /* edi: new selector */
9f9d489a 1199ENTRY(native_load_gs_index)
7effaa88 1200 CFI_STARTPROC
1da177e4 1201 pushf
7effaa88 1202 CFI_ADJUST_CFA_OFFSET 8
72fe4858
GOC
1203 DISABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI))
1204 SWAPGS
0bd7b798
AH
1205gs_change:
1206 movl %edi,%gs
1da177e4 12072: mfence /* workaround */
72fe4858 1208 SWAPGS
1da177e4 1209 popf
7effaa88 1210 CFI_ADJUST_CFA_OFFSET -8
1da177e4 1211 ret
7effaa88 1212 CFI_ENDPROC
9f9d489a 1213ENDPROC(native_load_gs_index)
0bd7b798 1214
1da177e4
LT
1215 .section __ex_table,"a"
1216 .align 8
1217 .quad gs_change,bad_gs
1218 .previous
1219 .section .fixup,"ax"
1220 /* running with kernelgs */
0bd7b798 1221bad_gs:
72fe4858 1222 SWAPGS /* switch back to user gs */
1da177e4
LT
1223 xorl %eax,%eax
1224 movl %eax,%gs
1225 jmp 2b
0bd7b798
AH
1226 .previous
1227
1da177e4
LT
1228/*
1229 * Create a kernel thread.
1230 *
1231 * C extern interface:
1232 * extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
1233 *
1234 * asm input arguments:
1235 * rdi: fn, rsi: arg, rdx: flags
1236 */
1237ENTRY(kernel_thread)
1238 CFI_STARTPROC
1239 FAKE_STACK_FRAME $child_rip
1240 SAVE_ALL
1241
1242 # rdi: flags, rsi: usp, rdx: will be &pt_regs
1243 movq %rdx,%rdi
1244 orq kernel_thread_flags(%rip),%rdi
1245 movq $-1, %rsi
1246 movq %rsp, %rdx
1247
1248 xorl %r8d,%r8d
1249 xorl %r9d,%r9d
0bd7b798 1250
1da177e4
LT
1251 # clone now
1252 call do_fork
1253 movq %rax,RAX(%rsp)
1254 xorl %edi,%edi
1255
1256 /*
1257 * It isn't worth to check for reschedule here,
1258 * so internally to the x86_64 port you can rely on kernel_thread()
1259 * not to reschedule the child before returning, this avoids the need
1260 * of hacks for example to fork off the per-CPU idle tasks.
0bd7b798 1261 * [Hopefully no generic code relies on the reschedule -AK]
1da177e4
LT
1262 */
1263 RESTORE_ALL
1264 UNFAKE_STACK_FRAME
1265 ret
1266 CFI_ENDPROC
4b787e0b 1267ENDPROC(kernel_thread)
0bd7b798 1268
1da177e4 1269child_rip:
c05991ed
AK
1270 pushq $0 # fake return address
1271 CFI_STARTPROC
1da177e4
LT
1272 /*
1273 * Here we are in the child and the registers are set as they were
1274 * at kernel_thread() invocation in the parent.
1275 */
1276 movq %rdi, %rax
1277 movq %rsi, %rdi
1278 call *%rax
1279 # exit
1c5b5cfd 1280 mov %eax, %edi
1da177e4 1281 call do_exit
c05991ed 1282 CFI_ENDPROC
4b787e0b 1283ENDPROC(child_rip)
1da177e4
LT
1284
1285/*
1286 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
1287 *
1288 * C extern interface:
1289 * extern long execve(char *name, char **argv, char **envp)
1290 *
1291 * asm input arguments:
1292 * rdi: name, rsi: argv, rdx: envp
1293 *
1294 * We want to fallback into:
5d119b2c 1295 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs)
1da177e4
LT
1296 *
1297 * do_sys_execve asm fallback arguments:
5d119b2c 1298 * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack
1da177e4 1299 */
3db03b4a 1300ENTRY(kernel_execve)
1da177e4
LT
1301 CFI_STARTPROC
1302 FAKE_STACK_FRAME $0
0bd7b798 1303 SAVE_ALL
5d119b2c 1304 movq %rsp,%rcx
1da177e4 1305 call sys_execve
0bd7b798 1306 movq %rax, RAX(%rsp)
1da177e4
LT
1307 RESTORE_REST
1308 testq %rax,%rax
1309 je int_ret_from_sys_call
1310 RESTORE_ARGS
1311 UNFAKE_STACK_FRAME
1312 ret
1313 CFI_ENDPROC
3db03b4a 1314ENDPROC(kernel_execve)
1da177e4 1315
0f2fbdcb 1316KPROBE_ENTRY(page_fault)
1da177e4 1317 errorentry do_page_fault
d28c4393 1318KPROBE_END(page_fault)
1da177e4
LT
1319
1320ENTRY(coprocessor_error)
1321 zeroentry do_coprocessor_error
4b787e0b 1322END(coprocessor_error)
1da177e4
LT
1323
1324ENTRY(simd_coprocessor_error)
0bd7b798 1325 zeroentry do_simd_coprocessor_error
4b787e0b 1326END(simd_coprocessor_error)
1da177e4
LT
1327
1328ENTRY(device_not_available)
e407d620 1329 zeroentry do_device_not_available
4b787e0b 1330END(device_not_available)
1da177e4
LT
1331
1332 /* runs on exception stack */
0f2fbdcb 1333KPROBE_ENTRY(debug)
7effaa88 1334 INTR_FRAME
09402947 1335 PARAVIRT_ADJUST_EXCEPTION_FRAME
1da177e4 1336 pushq $0
0bd7b798 1337 CFI_ADJUST_CFA_OFFSET 8
5f8efbb9 1338 paranoidentry do_debug, DEBUG_STACK
e2f6bc25
AH
1339 jmp paranoid_exit
1340 CFI_ENDPROC
d28c4393 1341KPROBE_END(debug)
1da177e4 1342
0bd7b798 1343 /* runs on exception stack */
eddb6fb9 1344KPROBE_ENTRY(nmi)
7effaa88 1345 INTR_FRAME
09402947 1346 PARAVIRT_ADJUST_EXCEPTION_FRAME
e2f6bc25
AH
1347 pushq_cfi $-1
1348 subq $15*8, %rsp
1349 CFI_ADJUST_CFA_OFFSET 15*8
1350 call save_paranoid
1351 DEFAULT_FRAME 0
1352 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
1353 movq %rsp,%rdi
1354 movq ORIG_RAX(%rsp),%rsi
1355 movq $-1,ORIG_RAX(%rsp)
1356 call do_nmi
1357 DISABLE_INTERRUPTS(CLBR_NONE)
2601e64d 1358#ifdef CONFIG_TRACE_IRQFLAGS
e2f6bc25
AH
1359 /* paranoidexit; without TRACE_IRQS_OFF */
1360 /* ebx: no swapgs flag */
1361nmi_exit:
1362 testl %ebx,%ebx /* swapgs needed? */
1363 jnz nmi_restore
1364 testl $3,CS(%rsp)
1365 jnz nmi_userspace
1366nmi_swapgs:
1367 SWAPGS_UNSAFE_STACK
1368nmi_restore:
1369 RESTORE_ALL 8
1370 jmp irq_return
1371nmi_userspace:
1372 GET_THREAD_INFO(%rcx)
1373 movl TI_flags(%rcx),%ebx
1374 andl $_TIF_WORK_MASK,%ebx
1375 jz nmi_swapgs
1376 movq %rsp,%rdi /* &pt_regs */
1377 call sync_regs
1378 movq %rax,%rsp /* switch stack for scheduling */
1379 testl $_TIF_NEED_RESCHED,%ebx
1380 jnz nmi_schedule
1381 movl %ebx,%edx /* arg3: thread flags */
1382 ENABLE_INTERRUPTS(CLBR_NONE)
1383 xorl %esi,%esi /* arg2: oldset */
1384 movq %rsp,%rdi /* arg1: &pt_regs */
1385 call do_notify_resume
1386 DISABLE_INTERRUPTS(CLBR_NONE)
1387 jmp nmi_userspace
1388nmi_schedule:
1389 ENABLE_INTERRUPTS(CLBR_ANY)
1390 call schedule
1391 DISABLE_INTERRUPTS(CLBR_ANY)
1392 jmp nmi_userspace
1393 CFI_ENDPROC
2601e64d 1394#else
e2f6bc25 1395 jmp paranoid_exit
2601e64d
IM
1396 CFI_ENDPROC
1397#endif
d28c4393 1398KPROBE_END(nmi)
6fefb0d1 1399
0f2fbdcb 1400KPROBE_ENTRY(int3)
b556b35e 1401 INTR_FRAME
09402947 1402 PARAVIRT_ADJUST_EXCEPTION_FRAME
b556b35e
JB
1403 pushq $0
1404 CFI_ADJUST_CFA_OFFSET 8
5f8efbb9 1405 paranoidentry do_int3, DEBUG_STACK
e2f6bc25 1406 jmp paranoid_exit
b556b35e 1407 CFI_ENDPROC
d28c4393 1408KPROBE_END(int3)
1da177e4
LT
1409
1410ENTRY(overflow)
1411 zeroentry do_overflow
4b787e0b 1412END(overflow)
1da177e4
LT
1413
1414ENTRY(bounds)
1415 zeroentry do_bounds
4b787e0b 1416END(bounds)
1da177e4
LT
1417
1418ENTRY(invalid_op)
0bd7b798 1419 zeroentry do_invalid_op
4b787e0b 1420END(invalid_op)
1da177e4
LT
1421
1422ENTRY(coprocessor_segment_overrun)
1423 zeroentry do_coprocessor_segment_overrun
4b787e0b 1424END(coprocessor_segment_overrun)
1da177e4 1425
1da177e4
LT
1426 /* runs on exception stack */
1427ENTRY(double_fault)
7effaa88 1428 XCPT_FRAME
09402947 1429 PARAVIRT_ADJUST_EXCEPTION_FRAME
1da177e4 1430 paranoidentry do_double_fault
e2f6bc25 1431 jmp paranoid_exit
1da177e4 1432 CFI_ENDPROC
4b787e0b 1433END(double_fault)
1da177e4
LT
1434
1435ENTRY(invalid_TSS)
1436 errorentry do_invalid_TSS
4b787e0b 1437END(invalid_TSS)
1da177e4
LT
1438
1439ENTRY(segment_not_present)
1440 errorentry do_segment_not_present
4b787e0b 1441END(segment_not_present)
1da177e4
LT
1442
1443 /* runs on exception stack */
1444ENTRY(stack_segment)
7effaa88 1445 XCPT_FRAME
09402947 1446 PARAVIRT_ADJUST_EXCEPTION_FRAME
1da177e4 1447 paranoidentry do_stack_segment
e2f6bc25 1448 jmp paranoid_exit
1da177e4 1449 CFI_ENDPROC
4b787e0b 1450END(stack_segment)
1da177e4 1451
0f2fbdcb 1452KPROBE_ENTRY(general_protection)
1da177e4 1453 errorentry do_general_protection
d28c4393 1454KPROBE_END(general_protection)
1da177e4
LT
1455
1456ENTRY(alignment_check)
1457 errorentry do_alignment_check
4b787e0b 1458END(alignment_check)
1da177e4
LT
1459
1460ENTRY(divide_error)
1461 zeroentry do_divide_error
4b787e0b 1462END(divide_error)
1da177e4
LT
1463
1464ENTRY(spurious_interrupt_bug)
1465 zeroentry do_spurious_interrupt_bug
4b787e0b 1466END(spurious_interrupt_bug)
1da177e4
LT
1467
1468#ifdef CONFIG_X86_MCE
1469 /* runs on exception stack */
1470ENTRY(machine_check)
7effaa88 1471 INTR_FRAME
09402947 1472 PARAVIRT_ADJUST_EXCEPTION_FRAME
1da177e4 1473 pushq $0
0bd7b798 1474 CFI_ADJUST_CFA_OFFSET 8
1da177e4 1475 paranoidentry do_machine_check
e2f6bc25 1476 jmp paranoid_exit
1da177e4 1477 CFI_ENDPROC
4b787e0b 1478END(machine_check)
1da177e4
LT
1479#endif
1480
2699500b 1481/* Call softirq on interrupt stack. Interrupts are off. */
ed6b676c 1482ENTRY(call_softirq)
7effaa88 1483 CFI_STARTPROC
2699500b
AK
1484 push %rbp
1485 CFI_ADJUST_CFA_OFFSET 8
1486 CFI_REL_OFFSET rbp,0
1487 mov %rsp,%rbp
1488 CFI_DEF_CFA_REGISTER rbp
ed6b676c 1489 incl %gs:pda_irqcount
2699500b
AK
1490 cmove %gs:pda_irqstackptr,%rsp
1491 push %rbp # backlink for old unwinder
ed6b676c 1492 call __do_softirq
2699500b 1493 leaveq
7effaa88 1494 CFI_DEF_CFA_REGISTER rsp
2699500b 1495 CFI_ADJUST_CFA_OFFSET -8
ed6b676c 1496 decl %gs:pda_irqcount
ed6b676c 1497 ret
7effaa88 1498 CFI_ENDPROC
4b787e0b 1499ENDPROC(call_softirq)
75154f40
AK
1500
1501KPROBE_ENTRY(ignore_sysret)
1502 CFI_STARTPROC
1503 mov $-ENOSYS,%eax
1504 sysret
1505 CFI_ENDPROC
1506ENDPROC(ignore_sysret)
3d75e1b8
JF
1507
1508#ifdef CONFIG_XEN
1509ENTRY(xen_hypervisor_callback)
1510 zeroentry xen_do_hypervisor_callback
1511END(xen_hypervisor_callback)
1512
1513/*
1514# A note on the "critical region" in our callback handler.
1515# We want to avoid stacking callback handlers due to events occurring
1516# during handling of the last event. To do this, we keep events disabled
1517# until we've done all processing. HOWEVER, we must enable events before
1518# popping the stack frame (can't be done atomically) and so it would still
1519# be possible to get enough handler activations to overflow the stack.
1520# Although unlikely, bugs of that kind are hard to track down, so we'd
1521# like to avoid the possibility.
1522# So, on entry to the handler we detect whether we interrupted an
1523# existing activation in its critical region -- if so, we pop the current
1524# activation and restart the handler using the previous one.
1525*/
1526ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
1527 CFI_STARTPROC
1528/* Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will
1529 see the correct pointer to the pt_regs */
1530 movq %rdi, %rsp # we don't return, adjust the stack frame
1531 CFI_ENDPROC
dcd072e2 1532 DEFAULT_FRAME
3d75e1b8
JF
153311: incl %gs:pda_irqcount
1534 movq %rsp,%rbp
1535 CFI_DEF_CFA_REGISTER rbp
1536 cmovzq %gs:pda_irqstackptr,%rsp
1537 pushq %rbp # backlink for old unwinder
1538 call xen_evtchn_do_upcall
1539 popq %rsp
1540 CFI_DEF_CFA_REGISTER rsp
1541 decl %gs:pda_irqcount
1542 jmp error_exit
1543 CFI_ENDPROC
1544END(do_hypervisor_callback)
1545
1546/*
1547# Hypervisor uses this for application faults while it executes.
1548# We get here for two reasons:
1549# 1. Fault while reloading DS, ES, FS or GS
1550# 2. Fault while executing IRET
1551# Category 1 we do not need to fix up as Xen has already reloaded all segment
1552# registers that could be reloaded and zeroed the others.
1553# Category 2 we fix up by killing the current process. We cannot use the
1554# normal Linux return path in this case because if we use the IRET hypercall
1555# to pop the stack frame we end up in an infinite loop of failsafe callbacks.
1556# We distinguish between categories by comparing each saved segment register
1557# with its current contents: any discrepancy means we in category 1.
1558*/
1559ENTRY(xen_failsafe_callback)
dcd072e2
AH
1560 INTR_FRAME 1 (6*8)
1561 /*CFI_REL_OFFSET gs,GS*/
1562 /*CFI_REL_OFFSET fs,FS*/
1563 /*CFI_REL_OFFSET es,ES*/
1564 /*CFI_REL_OFFSET ds,DS*/
1565 CFI_REL_OFFSET r11,8
1566 CFI_REL_OFFSET rcx,0
3d75e1b8
JF
1567 movw %ds,%cx
1568 cmpw %cx,0x10(%rsp)
1569 CFI_REMEMBER_STATE
1570 jne 1f
1571 movw %es,%cx
1572 cmpw %cx,0x18(%rsp)
1573 jne 1f
1574 movw %fs,%cx
1575 cmpw %cx,0x20(%rsp)
1576 jne 1f
1577 movw %gs,%cx
1578 cmpw %cx,0x28(%rsp)
1579 jne 1f
1580 /* All segments match their saved values => Category 2 (Bad IRET). */
1581 movq (%rsp),%rcx
1582 CFI_RESTORE rcx
1583 movq 8(%rsp),%r11
1584 CFI_RESTORE r11
1585 addq $0x30,%rsp
1586 CFI_ADJUST_CFA_OFFSET -0x30
14ae22ba
IM
1587 pushq_cfi $0 /* RIP */
1588 pushq_cfi %r11
1589 pushq_cfi %rcx
4a5c3e77 1590 jmp general_protection
3d75e1b8
JF
1591 CFI_RESTORE_STATE
15921: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
1593 movq (%rsp),%rcx
1594 CFI_RESTORE rcx
1595 movq 8(%rsp),%r11
1596 CFI_RESTORE r11
1597 addq $0x30,%rsp
1598 CFI_ADJUST_CFA_OFFSET -0x30
14ae22ba 1599 pushq_cfi $0
3d75e1b8
JF
1600 SAVE_ALL
1601 jmp error_exit
1602 CFI_ENDPROC
3d75e1b8
JF
1603END(xen_failsafe_callback)
1604
1605#endif /* CONFIG_XEN */