summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorJon Medhurst <tixy@yxit.co.uk>2011-04-08 15:32:54 +0100
committerNicolas Pitre <nicolas.pitre@linaro.org>2011-04-28 23:40:56 -0400
commit6823fc85fcfba11675f2027aadf2d5291c6f351b (patch)
tree44da95dd42e7b98e475a644f1aaac46310b69492 /arch/arm/kernel
parentec58d7f2373cec47f30b773d40a89f18bf6fc489 (diff)
downloadblackbird-op-linux-6823fc85fcfba11675f2027aadf2d5291c6f351b.tar.gz
blackbird-op-linux-6823fc85fcfba11675f2027aadf2d5291c6f351b.zip
ARM: kprobes: Fix emulation of LDRH, STRH, LDRSB and LDRSH instructions
The decoding of these instructions got the register indexed and immediate indexed forms the wrong way around, causing incorrect emulation. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/kprobes-decode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index c24e21ec427f..348ff47acd06 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -883,11 +883,12 @@ emulate_alu_tests(struct kprobe *p, struct pt_regs *regs)
static enum kprobe_insn __kprobes
prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi)
{
- int ibit = (insn & (1 << 26)) ? 25 : 22;
+ int not_imm = (insn & (1 << 26)) ? (insn & (1 << 25))
+ : (~insn & (1 << 22));
insn &= 0xfff00fff;
insn |= 0x00001000; /* Rn = r0, Rd = r1 */
- if (insn & (1 << ibit)) {
+ if (not_imm) {
insn &= ~0xf;
insn |= 2; /* Rm = r2 */
}
OpenPOWER on IntegriCloud