]>
Commit | Line | Data |
---|---|---|
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> |
1da177e4 | 11 | |
38e6b75d BP |
12 | /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ |
13 | .macro THUNK name, func, put_ret_addr_in_rdi=0 | |
81d68a96 | 14 | .globl \name |
058fb732 | 15 | .type \name, @function |
81d68a96 | 16 | \name: |
d4bf7078 JP |
17 | pushq %rbp |
18 | movq %rsp, %rbp | |
38e6b75d | 19 | |
131484c8 IM |
20 | pushq %rdi |
21 | pushq %rsi | |
22 | pushq %rdx | |
23 | pushq %rcx | |
24 | pushq %rax | |
25 | pushq %r8 | |
26 | pushq %r9 | |
27 | pushq %r10 | |
28 | pushq %r11 | |
38e6b75d BP |
29 | |
30 | .if \put_ret_addr_in_rdi | |
d4bf7078 JP |
31 | /* 8(%rbp) is return addr on stack */ |
32 | movq 8(%rbp), %rdi | |
38e6b75d BP |
33 | .endif |
34 | ||
81d68a96 | 35 | call \func |
9a7e7b57 | 36 | jmp .L_restore |
98def1de | 37 | _ASM_NOKPROBE(\name) |
81d68a96 SR |
38 | .endm |
39 | ||
38e6b75d BP |
40 | #ifdef CONFIG_TRACE_IRQFLAGS |
41 | THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1 | |
42 | THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1 | |
6375e2b7 | 43 | #endif |
10cd706d PZ |
44 | |
45 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
38e6b75d | 46 | THUNK lockdep_sys_exit_thunk,lockdep_sys_exit |
10cd706d | 47 | #endif |
38e6b75d | 48 | |
0ad6e3c5 ON |
49 | #ifdef CONFIG_PREEMPT |
50 | THUNK ___preempt_schedule, preempt_schedule | |
4eaca0a8 | 51 | THUNK ___preempt_schedule_notrace, preempt_schedule_notrace |
0ad6e3c5 ON |
52 | #endif |
53 | ||
69e8544c DV |
54 | #if defined(CONFIG_TRACE_IRQFLAGS) \ |
55 | || defined(CONFIG_DEBUG_LOCK_ALLOC) \ | |
56 | || defined(CONFIG_PREEMPT) | |
9a7e7b57 | 57 | .L_restore: |
131484c8 IM |
58 | popq %r11 |
59 | popq %r10 | |
60 | popq %r9 | |
61 | popq %r8 | |
62 | popq %rax | |
63 | popq %rcx | |
64 | popq %rdx | |
65 | popq %rsi | |
66 | popq %rdi | |
d4bf7078 | 67 | popq %rbp |
38e6b75d | 68 | ret |
9a7e7b57 | 69 | _ASM_NOKPROBE(.L_restore) |
69e8544c | 70 | #endif |