aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPratyush Anand <panand@redhat.com>2015-01-14 14:36:36 +0530
committerSteve Capper <steve.capper@linaro.org>2015-01-27 16:46:18 +0000
commitf1c8932dc83fc2c9afed0b0db67107b725c4602e (patch)
treecc4492fc6090aa5fa1365267dc2ac9ba71fcd510
parentaa701674867592e91558b8a8256e20f4437b54fb (diff)
downloadlinux-f1c8932dc83fc2c9afed0b0db67107b725c4602e.tar.gz
ARM64: kprobe: Fix few instruction which is to be simulated
Signed-off-by: Pratyush Anand <panand@redhat.com>
-rw-r--r--arch/arm64/include/asm/insn.h2
-rw-r--r--arch/arm64/kernel/insn.c2
-rw-r--r--arch/arm64/kernel/kprobes-arm64.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
index 466afd4550c..55f89c83763 100644
--- a/arch/arm64/include/asm/insn.h
+++ b/arch/arm64/include/asm/insn.h
@@ -223,7 +223,7 @@ static __always_inline bool aarch64_insn_is_##abbr(u32 code) \
static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \
{ return (val); }
-__AARCH64_INSN_FUNCS(adr, 0x9F000000, 0x10000000)
+__AARCH64_INSN_FUNCS(adr_adrp, 0x1F000000, 0x10000000)
__AARCH64_INSN_FUNCS(prfm_lit, 0xFF000000, 0xD8000000)
__AARCH64_INSN_FUNCS(str_reg, 0x3FE0EC00, 0x38206800)
__AARCH64_INSN_FUNCS(ldr_reg, 0x3FE0EC00, 0x38606800)
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 8021722a346..ac4d16c3ecb 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -78,6 +78,7 @@ bool aarch64_insn_uses_literal(u32 insn)
return aarch64_insn_is_ldr_lit(insn) ||
aarch64_insn_is_ldrsw_lit(insn) ||
+ aarch64_insn_is_adr_adrp(insn) ||
aarch64_insn_is_prfm_lit(insn);
}
@@ -87,6 +88,7 @@ bool aarch64_insn_is_branch(u32 insn)
return aarch64_insn_is_b_bl_cb_tb(insn) ||
aarch64_insn_is_br_blr(insn) ||
+ aarch64_insn_is_ret(insn) ||
aarch64_insn_is_bcond(insn);
}
diff --git a/arch/arm64/kernel/kprobes-arm64.c b/arch/arm64/kernel/kprobes-arm64.c
index 531d14a1db8..7d2a5c48b80 100644
--- a/arch/arm64/kernel/kprobes-arm64.c
+++ b/arch/arm64/kernel/kprobes-arm64.c
@@ -142,10 +142,12 @@ arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
} else if (aarch64_insn_is_tb(insn)) {
asi->prepare = prepare_tbz_tbnz;
asi->handler = simulate_tbz_tbnz;
- } else if (aarch64_insn_is_adr(insn))
+ } else if (aarch64_insn_is_adr_adrp(insn))
asi->handler = simulate_adr_adrp;
else if (aarch64_insn_is_b_bl(insn))
asi->handler = simulate_b_bl;
+ else if (aarch64_insn_is_br_blr(insn) || aarch64_insn_is_ret(insn))
+ asi->handler = simulate_br_blr_ret;
else if (aarch64_insn_is_ldr_lit(insn))
asi->handler = simulate_ldr_literal;
else if (aarch64_insn_is_ldrsw_lit(insn))