aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-11-24 14:26:38 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-12-01 14:08:15 -0500
commit85f6f0290c4d4667a5afb06e66815bcf5ce2c4f7 (patch)
tree6d01938fa3d053a5921464d9954c7aa1cca52e68
parent527aa75b333f90f4f90ac1730762156680a42fe8 (diff)
ftrace/x86: Add macro MCOUNT_REG_SIZE for amount of stack used to save mcount regs
The macro save_mcount_regs saves regs onto the stack. But to uncouple the amount of stack used in that macro from the users of the macro, we need to have a define that tells all the users how much stack is used by that macro. This way we can change the amount of stack the macro uses without breaking its users. Also remove some dead code that was left over from commit fdc841b58cf5 "ftrace: x86: Remove check of obsolete variable function_trace_stop". Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1411262304010.3961@nanos Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--arch/x86/kernel/mcount_64.S24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index 596ac330c1db..a0f6f942183a 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -21,6 +21,9 @@
21# define function_hook mcount 21# define function_hook mcount
22#endif 22#endif
23 23
24/* Size of stack used to save mcount regs in save_mcount_regs */
25#define MCOUNT_REG_SIZE (SS+8)
26
24/* 27/*
25 * gcc -pg option adds a call to 'mcount' in most functions. 28 * gcc -pg option adds a call to 'mcount' in most functions.
26 * When -mfentry is used, the call is to 'fentry' and not 'mcount' 29 * When -mfentry is used, the call is to 'fentry' and not 'mcount'
@@ -42,7 +45,7 @@
42 /* 45 /*
43 * We add enough stack to save all regs. 46 * We add enough stack to save all regs.
44 */ 47 */
45 subq $(SS+8), %rsp 48 subq $MCOUNT_REG_SIZE, %rsp
46 movq %rax, RAX(%rsp) 49 movq %rax, RAX(%rsp)
47 movq %rcx, RCX(%rsp) 50 movq %rcx, RCX(%rsp)
48 movq %rdx, RDX(%rsp) 51 movq %rdx, RDX(%rsp)
@@ -51,7 +54,7 @@
51 movq %r8, R8(%rsp) 54 movq %r8, R8(%rsp)
52 movq %r9, R9(%rsp) 55 movq %r9, R9(%rsp)
53 /* Move RIP to its proper location */ 56 /* Move RIP to its proper location */
54 movq SS+8+\added(%rsp), %rdi 57 movq MCOUNT_REG_SIZE+\added(%rsp), %rdi
55 movq %rdi, RIP(%rsp) 58 movq %rdi, RIP(%rsp)
56 .endm 59 .endm
57 60
@@ -63,7 +66,7 @@
63 movq RDX(%rsp), %rdx 66 movq RDX(%rsp), %rdx
64 movq RCX(%rsp), %rcx 67 movq RCX(%rsp), %rcx
65 movq RAX(%rsp), %rax 68 movq RAX(%rsp), %rax
66 addq $(SS+8), %rsp 69 addq $MCOUNT_REG_SIZE, %rsp
67 .endm 70 .endm
68 71
69/* skip is set if stack has been adjusted */ 72/* skip is set if stack has been adjusted */
@@ -79,7 +82,7 @@ GLOBAL(\trace_label)
79 subq $MCOUNT_INSN_SIZE, %rdi 82 subq $MCOUNT_INSN_SIZE, %rdi
80 /* Load the parent_ip into the second parameter */ 83 /* Load the parent_ip into the second parameter */
81#ifdef CC_USING_FENTRY 84#ifdef CC_USING_FENTRY
82 movq SS+16+\added(%rsp), %rsi 85 movq MCOUNT_REG_SIZE+8+\added(%rsp), %rsi
83#else 86#else
84 movq 8+\added(%rbp), %rsi 87 movq 8+\added(%rbp), %rsi
85#endif 88#endif
@@ -172,7 +175,7 @@ ENTRY(ftrace_regs_caller)
172 movq %rbp, RBP(%rsp) 175 movq %rbp, RBP(%rsp)
173 movq %rbx, RBX(%rsp) 176 movq %rbx, RBX(%rsp)
174 /* Copy saved flags */ 177 /* Copy saved flags */
175 movq SS+8(%rsp), %rcx 178 movq MCOUNT_REG_SIZE(%rsp), %rcx
176 movq %rcx, EFLAGS(%rsp) 179 movq %rcx, EFLAGS(%rsp)
177 /* Kernel segments */ 180 /* Kernel segments */
178 movq $__KERNEL_DS, %rcx 181 movq $__KERNEL_DS, %rcx
@@ -180,7 +183,7 @@ ENTRY(ftrace_regs_caller)
180 movq $__KERNEL_CS, %rcx 183 movq $__KERNEL_CS, %rcx
181 movq %rcx, CS(%rsp) 184 movq %rcx, CS(%rsp)
182 /* Stack - skipping return address and flags */ 185 /* Stack - skipping return address and flags */
183 leaq SS+8*3(%rsp), %rcx 186 leaq MCOUNT_REG_SIZE+8*2(%rsp), %rcx
184 movq %rcx, RSP(%rsp) 187 movq %rcx, RSP(%rsp)
185 188
186 /* regs go into 4th parameter */ 189 /* regs go into 4th parameter */
@@ -195,11 +198,11 @@ GLOBAL(ftrace_regs_call)
195 198
196 /* Copy flags back to SS, to restore them */ 199 /* Copy flags back to SS, to restore them */
197 movq EFLAGS(%rsp), %rax 200 movq EFLAGS(%rsp), %rax
198 movq %rax, SS+8(%rsp) 201 movq %rax, MCOUNT_REG_SIZE(%rsp)
199 202
200 /* Handlers can change the RIP */ 203 /* Handlers can change the RIP */
201 movq RIP(%rsp), %rax 204 movq RIP(%rsp), %rax
202 movq %rax, SS+8*2(%rsp) 205 movq %rax, MCOUNT_REG_SIZE+8(%rsp)
203 206
204 /* restore the rest of pt_regs */ 207 /* restore the rest of pt_regs */
205 movq R15(%rsp), %r15 208 movq R15(%rsp), %r15
@@ -225,9 +228,6 @@ GLOBAL(ftrace_regs_caller_end)
225 228
226 jmp ftrace_return 229 jmp ftrace_return
227 230
228 popfq
229 jmp ftrace_stub
230
231END(ftrace_regs_caller) 231END(ftrace_regs_caller)
232 232
233 233
@@ -266,7 +266,7 @@ ENTRY(ftrace_graph_caller)
266 save_mcount_regs 266 save_mcount_regs
267 267
268#ifdef CC_USING_FENTRY 268#ifdef CC_USING_FENTRY
269 leaq SS+16(%rsp), %rdi 269 leaq MCOUNT_REG_SIZE+8(%rsp), %rdi
270 movq $0, %rdx /* No framepointers needed */ 270 movq $0, %rdx /* No framepointers needed */
271#else 271#else
272 leaq 8(%rbp), %rdi 272 leaq 8(%rbp), %rdi