diff options
author | Jon Medhurst <tixy@yxit.co.uk> | 2011-07-02 11:10:44 -0400 |
---|---|---|
committer | Tixy <tixy@medhuaa1.miniserver.com> | 2011-07-13 13:32:44 -0400 |
commit | 32818f31f8ed811ea7ef924f24642580a63a7c85 (patch) | |
tree | 3e02542ff2e32c9da7cf3d47ef742e80a215cf8b /arch/arm/kernel/kprobes-thumb.c | |
parent | 2f335829040cb16d0640e87121bef208894d4934 (diff) |
ARM: kprobes: Decode 16-bit Thumb CBZ and bit manipulation instructions
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Diffstat (limited to 'arch/arm/kernel/kprobes-thumb.c')
-rw-r--r-- | arch/arm/kernel/kprobes-thumb.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c index 2b30828d5f0c..a5bdb2dc39e7 100644 --- a/arch/arm/kernel/kprobes-thumb.c +++ b/arch/arm/kernel/kprobes-thumb.c | |||
@@ -96,6 +96,20 @@ t16_simulate_add_sp_imm(struct kprobe *p, struct pt_regs *regs) | |||
96 | regs->ARM_sp += imm * 4; | 96 | regs->ARM_sp += imm * 4; |
97 | } | 97 | } |
98 | 98 | ||
99 | static void __kprobes | ||
100 | t16_simulate_cbz(struct kprobe *p, struct pt_regs *regs) | ||
101 | { | ||
102 | kprobe_opcode_t insn = p->opcode; | ||
103 | int rn = insn & 0x7; | ||
104 | kprobe_opcode_t nonzero = regs->uregs[rn] ? insn : ~insn; | ||
105 | if (nonzero & 0x800) { | ||
106 | long i = insn & 0x200; | ||
107 | long imm5 = insn & 0xf8; | ||
108 | unsigned long pc = thumb_probe_pc(p); | ||
109 | regs->ARM_pc = pc + (i >> 3) + (imm5 >> 2); | ||
110 | } | ||
111 | } | ||
112 | |||
99 | static unsigned long __kprobes | 113 | static unsigned long __kprobes |
100 | t16_emulate_loregs(struct kprobe *p, struct pt_regs *regs) | 114 | t16_emulate_loregs(struct kprobe *p, struct pt_regs *regs) |
101 | { | 115 | { |
@@ -180,6 +194,21 @@ static const union decode_item t16_table_1011[] = { | |||
180 | /* SUB (SP minus immediate) 1011 0000 1xxx xxxx */ | 194 | /* SUB (SP minus immediate) 1011 0000 1xxx xxxx */ |
181 | DECODE_SIMULATE (0xff00, 0xb000, t16_simulate_add_sp_imm), | 195 | DECODE_SIMULATE (0xff00, 0xb000, t16_simulate_add_sp_imm), |
182 | 196 | ||
197 | /* CBZ 1011 00x1 xxxx xxxx */ | ||
198 | /* CBNZ 1011 10x1 xxxx xxxx */ | ||
199 | DECODE_SIMULATE (0xf500, 0xb100, t16_simulate_cbz), | ||
200 | |||
201 | /* SXTH 1011 0010 00xx xxxx */ | ||
202 | /* SXTB 1011 0010 01xx xxxx */ | ||
203 | /* UXTH 1011 0010 10xx xxxx */ | ||
204 | /* UXTB 1011 0010 11xx xxxx */ | ||
205 | /* REV 1011 1010 00xx xxxx */ | ||
206 | /* REV16 1011 1010 01xx xxxx */ | ||
207 | /* ??? 1011 1010 10xx xxxx */ | ||
208 | /* REVSH 1011 1010 11xx xxxx */ | ||
209 | DECODE_REJECT (0xffc0, 0xba80), | ||
210 | DECODE_EMULATE (0xf500, 0xb000, t16_emulate_loregs_rwflags), | ||
211 | |||
183 | /* | 212 | /* |
184 | * If-Then, and hints | 213 | * If-Then, and hints |
185 | * 1011 1111 xxxx xxxx | 214 | * 1011 1111 xxxx xxxx |