diff options
-rw-r--r-- | arch/x86/kernel/ftrace.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index b1e5e2244eca..50ea0ac8c9bf 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -21,8 +21,7 @@ | |||
21 | #include <asm/nops.h> | 21 | #include <asm/nops.h> |
22 | 22 | ||
23 | 23 | ||
24 | /* Long is fine, even if it is only 4 bytes ;-) */ | 24 | static unsigned char ftrace_nop[MCOUNT_INSN_SIZE]; |
25 | static unsigned long *ftrace_nop; | ||
26 | 25 | ||
27 | union ftrace_code_union { | 26 | union ftrace_code_union { |
28 | char code[MCOUNT_INSN_SIZE]; | 27 | char code[MCOUNT_INSN_SIZE]; |
@@ -40,7 +39,7 @@ static int ftrace_calc_offset(long ip, long addr) | |||
40 | 39 | ||
41 | unsigned char *ftrace_nop_replace(void) | 40 | unsigned char *ftrace_nop_replace(void) |
42 | { | 41 | { |
43 | return (char *)ftrace_nop; | 42 | return ftrace_nop; |
44 | } | 43 | } |
45 | 44 | ||
46 | unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) | 45 | unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) |
@@ -125,9 +124,6 @@ int __init ftrace_dyn_arch_init(void *data) | |||
125 | * TODO: check the cpuid to determine the best nop. | 124 | * TODO: check the cpuid to determine the best nop. |
126 | */ | 125 | */ |
127 | asm volatile ( | 126 | asm volatile ( |
128 | "jmp ftrace_test_jmp\n" | ||
129 | /* This code needs to stay around */ | ||
130 | ".section .text, \"ax\"\n" | ||
131 | "ftrace_test_jmp:" | 127 | "ftrace_test_jmp:" |
132 | "jmp ftrace_test_p6nop\n" | 128 | "jmp ftrace_test_p6nop\n" |
133 | "nop\n" | 129 | "nop\n" |
@@ -138,8 +134,6 @@ int __init ftrace_dyn_arch_init(void *data) | |||
138 | "jmp 1f\n" | 134 | "jmp 1f\n" |
139 | "ftrace_test_nop5:" | 135 | "ftrace_test_nop5:" |
140 | ".byte 0x66,0x66,0x66,0x66,0x90\n" | 136 | ".byte 0x66,0x66,0x66,0x66,0x90\n" |
141 | "jmp 1f\n" | ||
142 | ".previous\n" | ||
143 | "1:" | 137 | "1:" |
144 | ".section .fixup, \"ax\"\n" | 138 | ".section .fixup, \"ax\"\n" |
145 | "2: movl $1, %0\n" | 139 | "2: movl $1, %0\n" |
@@ -154,15 +148,15 @@ int __init ftrace_dyn_arch_init(void *data) | |||
154 | switch (faulted) { | 148 | switch (faulted) { |
155 | case 0: | 149 | case 0: |
156 | pr_info("ftrace: converting mcount calls to 0f 1f 44 00 00\n"); | 150 | pr_info("ftrace: converting mcount calls to 0f 1f 44 00 00\n"); |
157 | ftrace_nop = (unsigned long *)ftrace_test_p6nop; | 151 | memcpy(ftrace_nop, ftrace_test_p6nop, MCOUNT_INSN_SIZE); |
158 | break; | 152 | break; |
159 | case 1: | 153 | case 1: |
160 | pr_info("ftrace: converting mcount calls to 66 66 66 66 90\n"); | 154 | pr_info("ftrace: converting mcount calls to 66 66 66 66 90\n"); |
161 | ftrace_nop = (unsigned long *)ftrace_test_nop5; | 155 | memcpy(ftrace_nop, ftrace_test_nop5, MCOUNT_INSN_SIZE); |
162 | break; | 156 | break; |
163 | case 2: | 157 | case 2: |
164 | pr_info("ftrace: converting mcount calls to jmp . + 5\n"); | 158 | pr_info("ftrace: converting mcount calls to jmp . + 5\n"); |
165 | ftrace_nop = (unsigned long *)ftrace_test_jmp; | 159 | memcpy(ftrace_nop, ftrace_test_jmp, MCOUNT_INSN_SIZE); |
166 | break; | 160 | break; |
167 | } | 161 | } |
168 | 162 | ||