diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-08-14 15:45:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:34:58 -0400 |
commit | 0a37605c2261a06d8cafc62dee11374ad676c8c4 (patch) | |
tree | 0867723688dbdb824a5a15f91551f88bd47c6936 /arch | |
parent | e4b2b8866121bd06d5f3d9de0f79a04339ffa252 (diff) |
ftrace: x86 mcount stub
x86 now sets up the mcount locations through the build and no longer
needs to record the ip when the function is executed. This patch changes
the initial mcount to simply return. There's no need to do any other work.
If the ftrace start up test fails, the original mcount will be what everything
will use, so having this as fast as possible is a good thing.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/entry_32.S | 14 | ||||
-rw-r--r-- | arch/x86/kernel/entry_64.S | 26 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 14 |
3 files changed, 2 insertions, 52 deletions
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index b21fbfaffe39..4e4269c73bb7 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -1153,20 +1153,6 @@ ENDPROC(xen_failsafe_callback) | |||
1153 | #ifdef CONFIG_DYNAMIC_FTRACE | 1153 | #ifdef CONFIG_DYNAMIC_FTRACE |
1154 | 1154 | ||
1155 | ENTRY(mcount) | 1155 | ENTRY(mcount) |
1156 | pushl %eax | ||
1157 | pushl %ecx | ||
1158 | pushl %edx | ||
1159 | movl 0xc(%esp), %eax | ||
1160 | subl $MCOUNT_INSN_SIZE, %eax | ||
1161 | |||
1162 | .globl mcount_call | ||
1163 | mcount_call: | ||
1164 | call ftrace_stub | ||
1165 | |||
1166 | popl %edx | ||
1167 | popl %ecx | ||
1168 | popl %eax | ||
1169 | |||
1170 | ret | 1156 | ret |
1171 | END(mcount) | 1157 | END(mcount) |
1172 | 1158 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 1db6ce4314e1..09e7145484c5 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -64,32 +64,6 @@ | |||
64 | #ifdef CONFIG_FTRACE | 64 | #ifdef CONFIG_FTRACE |
65 | #ifdef CONFIG_DYNAMIC_FTRACE | 65 | #ifdef CONFIG_DYNAMIC_FTRACE |
66 | ENTRY(mcount) | 66 | ENTRY(mcount) |
67 | |||
68 | subq $0x38, %rsp | ||
69 | movq %rax, (%rsp) | ||
70 | movq %rcx, 8(%rsp) | ||
71 | movq %rdx, 16(%rsp) | ||
72 | movq %rsi, 24(%rsp) | ||
73 | movq %rdi, 32(%rsp) | ||
74 | movq %r8, 40(%rsp) | ||
75 | movq %r9, 48(%rsp) | ||
76 | |||
77 | movq 0x38(%rsp), %rdi | ||
78 | subq $MCOUNT_INSN_SIZE, %rdi | ||
79 | |||
80 | .globl mcount_call | ||
81 | mcount_call: | ||
82 | call ftrace_stub | ||
83 | |||
84 | movq 48(%rsp), %r9 | ||
85 | movq 40(%rsp), %r8 | ||
86 | movq 32(%rsp), %rdi | ||
87 | movq 24(%rsp), %rsi | ||
88 | movq 16(%rsp), %rdx | ||
89 | movq 8(%rsp), %rcx | ||
90 | movq (%rsp), %rax | ||
91 | addq $0x38, %rsp | ||
92 | |||
93 | retq | 67 | retq |
94 | END(mcount) | 68 | END(mcount) |
95 | 69 | ||
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index ab115cd15fdf..96aadbfedcc6 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -112,18 +112,8 @@ notrace int ftrace_update_ftrace_func(ftrace_func_t func) | |||
112 | 112 | ||
113 | notrace int ftrace_mcount_set(unsigned long *data) | 113 | notrace int ftrace_mcount_set(unsigned long *data) |
114 | { | 114 | { |
115 | unsigned long ip = (long)(&mcount_call); | 115 | /* mcount is initialized as a nop */ |
116 | unsigned long *addr = data; | 116 | *data = 0; |
117 | unsigned char old[MCOUNT_INSN_SIZE], *new; | ||
118 | |||
119 | /* | ||
120 | * Replace the mcount stub with a pointer to the | ||
121 | * ip recorder function. | ||
122 | */ | ||
123 | memcpy(old, &mcount_call, MCOUNT_INSN_SIZE); | ||
124 | new = ftrace_call_replace(ip, *addr); | ||
125 | *addr = ftrace_modify_code(ip, old, new); | ||
126 | |||
127 | return 0; | 117 | return 0; |
128 | } | 118 | } |
129 | 119 | ||