Merge remote-tracking branch 'mfd/for-mfd-next'
[deliverable/linux.git] / arch / x86 / entry / thunk_64.S
CommitLineData
cc1e684a
AK
1/*
2 * Save registers before calling assembly functions. This avoids
3 * disturbance of register allocation in some inline assembly constructs.
4 * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
81d68a96 5 * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
cc1e684a
AK
6 * Subject to the GNU public license, v.2. No warranty of any kind.
7 */
38e6b75d 8#include <linux/linkage.h>
d36f9479 9#include "calling.h"
98def1de 10#include <asm/asm.h>
784d5699 11#include <asm/export.h>
1da177e4 12
38e6b75d
BP
13 /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
14 .macro THUNK name, func, put_ret_addr_in_rdi=0
81d68a96 15 .globl \name
058fb732 16 .type \name, @function
81d68a96 17\name:
d4bf7078
JP
18 pushq %rbp
19 movq %rsp, %rbp
38e6b75d 20
131484c8
IM
21 pushq %rdi
22 pushq %rsi
23 pushq %rdx
24 pushq %rcx
25 pushq %rax
26 pushq %r8
27 pushq %r9
28 pushq %r10
29 pushq %r11
38e6b75d
BP
30
31 .if \put_ret_addr_in_rdi
d4bf7078
JP
32 /* 8(%rbp) is return addr on stack */
33 movq 8(%rbp), %rdi
38e6b75d
BP
34 .endif
35
81d68a96 36 call \func
9a7e7b57 37 jmp .L_restore
98def1de 38 _ASM_NOKPROBE(\name)
81d68a96
SR
39 .endm
40
38e6b75d
BP
41#ifdef CONFIG_TRACE_IRQFLAGS
42 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
43 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
6375e2b7 44#endif
10cd706d
PZ
45
46#ifdef CONFIG_DEBUG_LOCK_ALLOC
38e6b75d 47 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
10cd706d 48#endif
38e6b75d 49
0ad6e3c5
ON
50#ifdef CONFIG_PREEMPT
51 THUNK ___preempt_schedule, preempt_schedule
4eaca0a8 52 THUNK ___preempt_schedule_notrace, preempt_schedule_notrace
784d5699
AV
53 EXPORT_SYMBOL(___preempt_schedule)
54 EXPORT_SYMBOL(___preempt_schedule_notrace)
0ad6e3c5
ON
55#endif
56
69e8544c
DV
57#if defined(CONFIG_TRACE_IRQFLAGS) \
58 || defined(CONFIG_DEBUG_LOCK_ALLOC) \
59 || defined(CONFIG_PREEMPT)
9a7e7b57 60.L_restore:
131484c8
IM
61 popq %r11
62 popq %r10
63 popq %r9
64 popq %r8
65 popq %rax
66 popq %rcx
67 popq %rdx
68 popq %rsi
69 popq %rdi
d4bf7078 70 popq %rbp
38e6b75d 71 ret
9a7e7b57 72 _ASM_NOKPROBE(.L_restore)
69e8544c 73#endif
This page took 0.794269 seconds and 5 git commands to generate.