aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/kprobes-arm.c
diff options
context:
space:
mode:
authorJon Medhurst <tixy@yxit.co.uk>2011-06-09 12:23:50 -0400
committerTixy <tixy@medhuaa1.miniserver.com>2011-07-13 13:32:49 -0400
commit0e44e9a0fae65c07fa5a23bd720b6108892c96f8 (patch)
treee182351ea6e7d78d38cb8862eb60bcdf6c0c4d5b /arch/arm/kernel/kprobes-arm.c
parentc038f3af507943244f2522585d17614915afd324 (diff)
ARM: kprobes: Add emulate_rd12rn16rm0_rwflags_nopc()
This is the emulation function for the instruction format used by the ARM media 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-arm.c')
-rw-r--r--arch/arm/kernel/kprobes-arm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index f2eed03f5522..eb11a56683b6 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -957,6 +957,33 @@ emulate_rd12rn16rm0rs8_rwflags(struct kprobe *p, struct pt_regs *regs)
957 regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK); 957 regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK);
958} 958}
959 959
960static void __kprobes
961emulate_rd12rn16rm0_rwflags_nopc(struct kprobe *p, struct pt_regs *regs)
962{
963 kprobe_opcode_t insn = p->opcode;
964 int rd = (insn >> 12) & 0xf;
965 int rn = (insn >> 16) & 0xf;
966 int rm = insn & 0xf;
967
968 register unsigned long rdv asm("r0") = regs->uregs[rd];
969 register unsigned long rnv asm("r2") = regs->uregs[rn];
970 register unsigned long rmv asm("r3") = regs->uregs[rm];
971 unsigned long cpsr = regs->ARM_cpsr;
972
973 __asm__ __volatile__ (
974 "msr cpsr_fs, %[cpsr] \n\t"
975 BLX("%[fn]")
976 "mrs %[cpsr], cpsr \n\t"
977 : "=r" (rdv), [cpsr] "=r" (cpsr)
978 : "0" (rdv), "r" (rnv), "r" (rmv),
979 "1" (cpsr), [fn] "r" (p->ainsn.insn_fn)
980 : "lr", "memory", "cc"
981 );
982
983 regs->uregs[rd] = rdv;
984 regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK);
985}
986
960/* 987/*
961 * For the instruction masking and comparisons in all the "space_*" 988 * For the instruction masking and comparisons in all the "space_*"
962 * functions below, Do _not_ rearrange the order of tests unless 989 * functions below, Do _not_ rearrange the order of tests unless