aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@codethink.co.uk>2013-11-08 18:29:26 +0000
committerAndrey Konovalov <andrey.konovalov@linaro.org>2014-02-28 17:31:12 +0400
commitb9d43b94f54c5232b1d3c3d3b45d9092cfc767a6 (patch)
tree746951dbf1ded2257bc45d2d96110d5fe59e20c5
parente0264fc0ffbf6a086581def0d690297ea431411b (diff)
ARM: kprobes-test: use <asm/opcodes.h> for instruction accesses
Ensure we read instructions in the correct endian-ness by using the <asm/opcodes.h> helper to transform them as necessary. Acked-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> [taras.kondratiuk@linaro.org: fix next_instruction() function] Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
-rw-r--r--arch/arm/kernel/kprobes-test.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index a1f155ca4c09..d190290bb9c7 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -1339,7 +1339,8 @@ static void test_case_failed(const char *message)
static unsigned long next_instruction(unsigned long pc)
{
#ifdef CONFIG_THUMB2_KERNEL
- if ((pc & 1) && !is_wide_instruction(*(u16 *)(pc - 1)))
+ if ((pc & 1) &&
+ !is_wide_instruction(__mem_to_opcode_thumb16(*(u16 *)(pc - 1))))
return pc + 2;
else
#endif
@@ -1384,13 +1385,13 @@ static uintptr_t __used kprobes_test_case_start(const char *title, void *stack)
if (test_case_is_thumb) {
u16 *p = (u16 *)(test_code & ~1);
- current_instruction = p[0];
+ current_instruction = __mem_to_opcode_thumb16(p[0]);
if (is_wide_instruction(current_instruction)) {
- current_instruction <<= 16;
- current_instruction |= p[1];
+ u16 instr2 = __mem_to_opcode_thumb16(p[1]);
+ current_instruction = __opcode_thumb32_compose(current_instruction, instr2);
}
} else {
- current_instruction = *(u32 *)test_code;
+ current_instruction = __mem_to_opcode_arm(*(u32 *)test_code);
}
if (current_title[0] == '.')