|
@@ -78,8 +78,8 @@ static bool __kprobes aarch64_insn_is_steppable(u32 insn)
|
|
|
* INSN_GOOD If instruction is supported and uses instruction slot,
|
|
|
* INSN_GOOD_NO_SLOT If instruction is supported but doesn't use its slot.
|
|
|
*/
|
|
|
-static enum kprobe_insn __kprobes
|
|
|
-arm_probe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
|
|
|
+enum probe_insn __kprobes
|
|
|
+arm_probe_decode_insn(probe_opcode_t insn, struct arch_probe_insn *api)
|
|
|
{
|
|
|
/*
|
|
|
* Instructions reading or modifying the PC won't work from the XOL
|
|
@@ -89,26 +89,26 @@ arm_probe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
|
|
|
return INSN_GOOD;
|
|
|
|
|
|
if (aarch64_insn_is_bcond(insn)) {
|
|
|
- asi->handler = simulate_b_cond;
|
|
|
+ api->handler = simulate_b_cond;
|
|
|
} else if (aarch64_insn_is_cbz(insn) ||
|
|
|
aarch64_insn_is_cbnz(insn)) {
|
|
|
- asi->handler = simulate_cbz_cbnz;
|
|
|
+ api->handler = simulate_cbz_cbnz;
|
|
|
} else if (aarch64_insn_is_tbz(insn) ||
|
|
|
aarch64_insn_is_tbnz(insn)) {
|
|
|
- asi->handler = simulate_tbz_tbnz;
|
|
|
+ api->handler = simulate_tbz_tbnz;
|
|
|
} else if (aarch64_insn_is_adr_adrp(insn)) {
|
|
|
- asi->handler = simulate_adr_adrp;
|
|
|
+ api->handler = simulate_adr_adrp;
|
|
|
} else if (aarch64_insn_is_b(insn) ||
|
|
|
aarch64_insn_is_bl(insn)) {
|
|
|
- asi->handler = simulate_b_bl;
|
|
|
+ api->handler = simulate_b_bl;
|
|
|
} else if (aarch64_insn_is_br(insn) ||
|
|
|
aarch64_insn_is_blr(insn) ||
|
|
|
aarch64_insn_is_ret(insn)) {
|
|
|
- asi->handler = simulate_br_blr_ret;
|
|
|
+ api->handler = simulate_br_blr_ret;
|
|
|
} else if (aarch64_insn_is_ldr_lit(insn)) {
|
|
|
- asi->handler = simulate_ldr_literal;
|
|
|
+ api->handler = simulate_ldr_literal;
|
|
|
} else if (aarch64_insn_is_ldrsw_lit(insn)) {
|
|
|
- asi->handler = simulate_ldrsw_literal;
|
|
|
+ api->handler = simulate_ldrsw_literal;
|
|
|
} else {
|
|
|
/*
|
|
|
* Instruction cannot be stepped out-of-line and we don't
|
|
@@ -120,6 +120,7 @@ arm_probe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
|
|
|
return INSN_GOOD_NO_SLOT;
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_KPROBES
|
|
|
static bool __kprobes
|
|
|
is_probed_address_atomic(kprobe_opcode_t *scan_start, kprobe_opcode_t *scan_end)
|
|
|
{
|
|
@@ -138,12 +139,12 @@ is_probed_address_atomic(kprobe_opcode_t *scan_start, kprobe_opcode_t *scan_end)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-enum kprobe_insn __kprobes
|
|
|
+enum probe_insn __kprobes
|
|
|
arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi)
|
|
|
{
|
|
|
- enum kprobe_insn decoded;
|
|
|
- kprobe_opcode_t insn = le32_to_cpu(*addr);
|
|
|
- kprobe_opcode_t *scan_end = NULL;
|
|
|
+ enum probe_insn decoded;
|
|
|
+ probe_opcode_t insn = le32_to_cpu(*addr);
|
|
|
+ probe_opcode_t *scan_end = NULL;
|
|
|
unsigned long size = 0, offset = 0;
|
|
|
|
|
|
/*
|
|
@@ -162,7 +163,7 @@ arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi)
|
|
|
else
|
|
|
scan_end = addr - MAX_ATOMIC_CONTEXT_SIZE;
|
|
|
}
|
|
|
- decoded = arm_probe_decode_insn(insn, asi);
|
|
|
+ decoded = arm_probe_decode_insn(insn, &asi->api);
|
|
|
|
|
|
if (decoded != INSN_REJECTED && scan_end)
|
|
|
if (is_probed_address_atomic(addr - 1, scan_end))
|
|
@@ -170,3 +171,4 @@ arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi)
|
|
|
|
|
|
return decoded;
|
|
|
}
|
|
|
+#endif
|