aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Medhurst <tixy@yxit.co.uk>2011-06-09 12:39:42 -0400
committerTixy <tixy@medhuaa1.miniserver.com>2011-07-13 13:32:48 -0400
commit8723942f7b4501c87a95b7446786e6f4ba3779cf (patch)
tree26bb42a9a538c596493744018909c568ebb6ef91
parent3535a89ab26db6b69603abf04420ec0b6c9ac387 (diff)
ARM: kprobes: Add emulate_ldrdstrd()
This is an emulation function for the LDRD and STRD instructions. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--arch/arm/kernel/kprobes-arm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index 8e4b7185f9fb..2b43d056fff5 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -894,6 +894,35 @@ prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn,
894} 894}
895 895
896static void __kprobes 896static void __kprobes
897emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
898{
899 kprobe_opcode_t insn = p->opcode;
900 unsigned long pc = (unsigned long)p->addr + 8;
901 int rt = (insn >> 12) & 0xf;
902 int rn = (insn >> 16) & 0xf;
903 int rm = insn & 0xf;
904
905 register unsigned long rtv asm("r0") = regs->uregs[rt];
906 register unsigned long rt2v asm("r1") = regs->uregs[rt+1];
907 register unsigned long rnv asm("r2") = (rn == 15) ? pc
908 : regs->uregs[rn];
909 register unsigned long rmv asm("r3") = regs->uregs[rm];
910
911 __asm__ __volatile__ (
912 BLX("%[fn]")
913 : "=r" (rtv), "=r" (rt2v), "=r" (rnv)
914 : "0" (rtv), "1" (rt2v), "2" (rnv), "r" (rmv),
915 [fn] "r" (p->ainsn.insn_fn)
916 : "lr", "memory", "cc"
917 );
918
919 regs->uregs[rt] = rtv;
920 regs->uregs[rt+1] = rt2v;
921 if (is_writeback(insn))
922 regs->uregs[rn] = rnv;
923}
924
925static void __kprobes
897emulate_rd12rn16rm0rs8_rwflags(struct kprobe *p, struct pt_regs *regs) 926emulate_rd12rn16rm0rs8_rwflags(struct kprobe *p, struct pt_regs *regs)
898{ 927{
899 kprobe_opcode_t insn = p->opcode; 928 kprobe_opcode_t insn = p->opcode;