diff options
author | Borislav Petkov <bp@alien8.de> | 2011-05-31 16:21:54 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-06-03 17:38:55 -0400 |
commit | 38e6b75d3b6f4b9445eb6486e28fc716acda44ae (patch) | |
tree | 78eff99f936457750e355a306b429efc0fbe788c /arch/x86/lib | |
parent | 838feb47549a9b73534c6c1d7da4a9639a0750f4 (diff) |
x86, asm: Cleanup thunk_64.S
Drop thunk_ra macro in favor of an additional argument to the thunk
macro since their bodies are almost identical. Do a whitespace scrubbing
and use CFI-aware macros for full annotation.
Signed-off-by: Borislav Petkov <bp@alien8.de>
Link: http://lkml.kernel.org/r/1306873314-32523-5-git-send-email-bp@alien8.de
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/thunk_64.S | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S index 782b082c9ff7..d5b088b3ab81 100644 --- a/arch/x86/lib/thunk_64.S +++ b/arch/x86/lib/thunk_64.S | |||
@@ -5,50 +5,42 @@ | |||
5 | * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc. | 5 | * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc. |
6 | * Subject to the GNU public license, v.2. No warranty of any kind. | 6 | * Subject to the GNU public license, v.2. No warranty of any kind. |
7 | */ | 7 | */ |
8 | #include <linux/linkage.h> | ||
9 | #include <asm/dwarf2.h> | ||
10 | #include <asm/calling.h> | ||
11 | #include <asm/rwlock.h> | ||
8 | 12 | ||
9 | #include <linux/linkage.h> | 13 | /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ |
10 | #include <asm/dwarf2.h> | 14 | .macro THUNK name, func, put_ret_addr_in_rdi=0 |
11 | #include <asm/calling.h> | ||
12 | #include <asm/rwlock.h> | ||
13 | |||
14 | /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ | ||
15 | .macro thunk name,func | ||
16 | .globl \name | ||
17 | \name: | ||
18 | CFI_STARTPROC | ||
19 | SAVE_ARGS | ||
20 | call \func | ||
21 | jmp restore | ||
22 | CFI_ENDPROC | ||
23 | .endm | ||
24 | |||
25 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
26 | /* put return address in rdi (arg1) */ | ||
27 | .macro thunk_ra name,func | ||
28 | .globl \name | 15 | .globl \name |
29 | \name: | 16 | \name: |
30 | CFI_STARTPROC | 17 | CFI_STARTPROC |
18 | |||
19 | /* this one pushes 9 elems, the next one would be %rIP */ | ||
31 | SAVE_ARGS | 20 | SAVE_ARGS |
32 | /* SAVE_ARGS pushs 9 elements */ | 21 | |
33 | /* the next element would be the rip */ | 22 | .if \put_ret_addr_in_rdi |
34 | movq 9*8(%rsp), %rdi | 23 | movq_cfi_restore 9*8, rdi |
24 | .endif | ||
25 | |||
35 | call \func | 26 | call \func |
36 | jmp restore | 27 | jmp restore |
37 | CFI_ENDPROC | 28 | CFI_ENDPROC |
38 | .endm | 29 | .endm |
39 | 30 | ||
40 | thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller | 31 | #ifdef CONFIG_TRACE_IRQFLAGS |
41 | thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller | 32 | THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1 |
33 | THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1 | ||
42 | #endif | 34 | #endif |
43 | 35 | ||
44 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 36 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
45 | thunk lockdep_sys_exit_thunk,lockdep_sys_exit | 37 | THUNK lockdep_sys_exit_thunk,lockdep_sys_exit |
46 | #endif | 38 | #endif |
47 | 39 | ||
48 | /* SAVE_ARGS below is used only for the .cfi directives it contains. */ | 40 | /* SAVE_ARGS below is used only for the .cfi directives it contains. */ |
49 | CFI_STARTPROC | 41 | CFI_STARTPROC |
50 | SAVE_ARGS | 42 | SAVE_ARGS |
51 | restore: | 43 | restore: |
52 | RESTORE_ARGS | 44 | RESTORE_ARGS |
53 | ret | 45 | ret |
54 | CFI_ENDPROC | 46 | CFI_ENDPROC |