diff options
author | Jon Medhurst <tixy@linaro.org> | 2015-01-19 10:15:36 -0500 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-01-20 04:06:04 -0500 |
commit | fb892bd0fdcb2e5eac9c105cf68def90396ed8cc (patch) | |
tree | 193a2dd316d64e90705032e9870a7848d1be7b07 | |
parent | bfc9657d752c47d59dc0bab85ebdc19cf60100dd (diff) |
ARM: kprobes: Eliminate test code's use of BX instruction on ARMv4 CPUs
Non-T variants of ARMv4 CPUs don't support the BX instruction so
eliminate its use.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | arch/arm/probes/kprobes/test-arm.c | 3 | ||||
-rw-r--r-- | arch/arm/probes/kprobes/test-core.c | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/probes/kprobes/test-arm.c b/arch/arm/probes/kprobes/test-arm.c index e72b07e8cd9a..8866aedfdea2 100644 --- a/arch/arm/probes/kprobes/test-arm.c +++ b/arch/arm/probes/kprobes/test-arm.c | |||
@@ -215,9 +215,12 @@ void kprobe_arm_test_cases(void) | |||
215 | TEST_UNSUPPORTED("msr cpsr_f, lr") | 215 | TEST_UNSUPPORTED("msr cpsr_f, lr") |
216 | TEST_UNSUPPORTED("msr spsr, r0") | 216 | TEST_UNSUPPORTED("msr spsr, r0") |
217 | 217 | ||
218 | #if __LINUX_ARM_ARCH__ >= 5 || \ | ||
219 | (__LINUX_ARM_ARCH__ == 4 && !defined(CONFIG_CPU_32v4)) | ||
218 | TEST_BF_R("bx r",0,2f,"") | 220 | TEST_BF_R("bx r",0,2f,"") |
219 | TEST_BB_R("bx r",7,2f,"") | 221 | TEST_BB_R("bx r",7,2f,"") |
220 | TEST_BF_R("bxeq r",14,2f,"") | 222 | TEST_BF_R("bxeq r",14,2f,"") |
223 | #endif | ||
221 | 224 | ||
222 | #if __LINUX_ARM_ARCH__ >= 5 | 225 | #if __LINUX_ARM_ARCH__ >= 5 |
223 | TEST_R("clz r0, r",0, 0x0,"") | 226 | TEST_R("clz r0, r",0, 0x0,"") |
diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c index e495127d7571..9775de22e2ff 100644 --- a/arch/arm/probes/kprobes/test-core.c +++ b/arch/arm/probes/kprobes/test-core.c | |||
@@ -236,6 +236,8 @@ static int tests_failed; | |||
236 | 236 | ||
237 | #ifndef CONFIG_THUMB2_KERNEL | 237 | #ifndef CONFIG_THUMB2_KERNEL |
238 | 238 | ||
239 | #define RET(reg) "mov pc, "#reg | ||
240 | |||
239 | long arm_func(long r0, long r1); | 241 | long arm_func(long r0, long r1); |
240 | 242 | ||
241 | static void __used __naked __arm_kprobes_test_func(void) | 243 | static void __used __naked __arm_kprobes_test_func(void) |
@@ -245,7 +247,7 @@ static void __used __naked __arm_kprobes_test_func(void) | |||
245 | ".type arm_func, %%function \n\t" | 247 | ".type arm_func, %%function \n\t" |
246 | "arm_func: \n\t" | 248 | "arm_func: \n\t" |
247 | "adds r0, r0, r1 \n\t" | 249 | "adds r0, r0, r1 \n\t" |
248 | "bx lr \n\t" | 250 | "mov pc, lr \n\t" |
249 | ".code "NORMAL_ISA /* Back to Thumb if necessary */ | 251 | ".code "NORMAL_ISA /* Back to Thumb if necessary */ |
250 | : : : "r0", "r1", "cc" | 252 | : : : "r0", "r1", "cc" |
251 | ); | 253 | ); |
@@ -253,6 +255,8 @@ static void __used __naked __arm_kprobes_test_func(void) | |||
253 | 255 | ||
254 | #else /* CONFIG_THUMB2_KERNEL */ | 256 | #else /* CONFIG_THUMB2_KERNEL */ |
255 | 257 | ||
258 | #define RET(reg) "bx "#reg | ||
259 | |||
256 | long thumb16_func(long r0, long r1); | 260 | long thumb16_func(long r0, long r1); |
257 | long thumb32even_func(long r0, long r1); | 261 | long thumb32even_func(long r0, long r1); |
258 | long thumb32odd_func(long r0, long r1); | 262 | long thumb32odd_func(long r0, long r1); |
@@ -494,7 +498,7 @@ static void __naked benchmark_nop(void) | |||
494 | { | 498 | { |
495 | __asm__ __volatile__ ( | 499 | __asm__ __volatile__ ( |
496 | "nop \n\t" | 500 | "nop \n\t" |
497 | "bx lr" | 501 | RET(lr)" \n\t" |
498 | ); | 502 | ); |
499 | } | 503 | } |
500 | 504 | ||
@@ -977,7 +981,7 @@ void __naked __kprobes_test_case_start(void) | |||
977 | "bic r0, lr, #1 @ r0 = inline data \n\t" | 981 | "bic r0, lr, #1 @ r0 = inline data \n\t" |
978 | "mov r1, sp \n\t" | 982 | "mov r1, sp \n\t" |
979 | "bl kprobes_test_case_start \n\t" | 983 | "bl kprobes_test_case_start \n\t" |
980 | "bx r0 \n\t" | 984 | RET(r0)" \n\t" |
981 | ); | 985 | ); |
982 | } | 986 | } |
983 | 987 | ||