1
2
3
4
5
6
7
8#include <linux/linkage.h>
9#include <asm/dwarf2.h>
10#include <asm/calling.h>
11
12
13 .macro THUNK name, func, put_ret_addr_in_rdi=0
14 .globl \name
15 .type \name, @function
16\name:
17 CFI_STARTPROC
18 pushq %rbp
19 movq %rsp, %rbp
20
21 pushq_cfi %rdi
22 CFI_REL_OFFSET rdi, 0
23 pushq_cfi %rsi
24 CFI_REL_OFFSET rsi, 0
25 pushq_cfi %rdx
26 CFI_REL_OFFSET rdx, 0
27 pushq_cfi %rcx
28 CFI_REL_OFFSET rcx, 0
29 pushq_cfi %rax
30 CFI_REL_OFFSET rax, 0
31 pushq_cfi %r8
32 CFI_REL_OFFSET r8, 0
33 pushq_cfi %r9
34 CFI_REL_OFFSET r9, 0
35 pushq_cfi %r10
36 CFI_REL_OFFSET r10, 0
37 pushq_cfi %r11
38 CFI_REL_OFFSET r11, 0
39
40 .if \put_ret_addr_in_rdi
41
42 movq 8(%rbp), %rdi
43 .endif
44
45 call \func
46 jmp restore
47 CFI_ENDPROC
48 .endm
49
50#ifdef CONFIG_TRACE_IRQFLAGS
51 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
52 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
53#endif
54
55#ifdef CONFIG_DEBUG_LOCK_ALLOC
56 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
57#endif
58
59
60 || defined(CONFIG_DEBUG_LOCK_ALLOC)
61 CFI_STARTPROC
62 CFI_ADJUST_CFA_OFFSET 9*8
63restore:
64 popq_cfi %r11
65 CFI_RESTORE r11
66 popq_cfi %r10
67 CFI_RESTORE r10
68 popq_cfi %r9
69 CFI_RESTORE r9
70 popq_cfi %r8
71 CFI_RESTORE r8
72 popq_cfi %rax
73 CFI_RESTORE rax
74 popq_cfi %rcx
75 CFI_RESTORE rcx
76 popq_cfi %rdx
77 CFI_RESTORE rdx
78 popq_cfi %rsi
79 CFI_RESTORE rsi
80 popq_cfi %rdi
81 CFI_RESTORE rdi
82 popq %rbp
83 ret
84 CFI_ENDPROC
85#endif
86