diff options
author | Jon Medhurst <tixy@yxit.co.uk> | 2011-06-10 13:10:36 -0400 |
---|---|---|
committer | Tixy <tixy@medhuaa1.miniserver.com> | 2011-07-13 13:32:50 -0400 |
commit | c82584ebdf5948bfc6f0509be1c2bef714b49a33 (patch) | |
tree | 0960aa0c7c1a3a5f61bacfcc2c9f937d8b677615 /arch | |
parent | 35fab77469f8883077d8c9eda9325b38647ad3dc (diff) |
ARM: kprobes: Add emulate_rd12rm0_noflags_nopc()
This is the emulation function for the instruction format used by the
ARM bit-field manipulation instructions.
Various other instruction forms can also make use of this and it is used
to replace use of prep_emulate_rd12{rm0}{_modify}
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/kprobes-arm.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c index 2131506e1193..688101f2d39a 100644 --- a/arch/arm/kernel/kprobes-arm.c +++ b/arch/arm/kernel/kprobes-arm.c | |||
@@ -1013,6 +1013,26 @@ emulate_rd16rn12rm0rs8_rwflags_nopc(struct kprobe *p, struct pt_regs *regs) | |||
1013 | regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK); | 1013 | regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static void __kprobes | ||
1017 | emulate_rd12rm0_noflags_nopc(struct kprobe *p, struct pt_regs *regs) | ||
1018 | { | ||
1019 | kprobe_opcode_t insn = p->opcode; | ||
1020 | int rd = (insn >> 12) & 0xf; | ||
1021 | int rm = insn & 0xf; | ||
1022 | |||
1023 | register unsigned long rdv asm("r0") = regs->uregs[rd]; | ||
1024 | register unsigned long rmv asm("r3") = regs->uregs[rm]; | ||
1025 | |||
1026 | __asm__ __volatile__ ( | ||
1027 | BLX("%[fn]") | ||
1028 | : "=r" (rdv) | ||
1029 | : "0" (rdv), "r" (rmv), [fn] "r" (p->ainsn.insn_fn) | ||
1030 | : "lr", "memory", "cc" | ||
1031 | ); | ||
1032 | |||
1033 | regs->uregs[rd] = rdv; | ||
1034 | } | ||
1035 | |||
1016 | /* | 1036 | /* |
1017 | * For the instruction masking and comparisons in all the "space_*" | 1037 | * For the instruction masking and comparisons in all the "space_*" |
1018 | * functions below, Do _not_ rearrange the order of tests unless | 1038 | * functions below, Do _not_ rearrange the order of tests unless |
@@ -1068,7 +1088,8 @@ static const union decode_item arm_cccc_0001_0xx0____0xxx_table[] = { | |||
1068 | REGS(0, 0, 0, 0, NOPC)), | 1088 | REGS(0, 0, 0, 0, NOPC)), |
1069 | 1089 | ||
1070 | /* CLZ cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */ | 1090 | /* CLZ cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */ |
1071 | DECODE_CUSTOM (0x0ff000f0, 0x01600010, prep_emulate_rd12rm0), | 1091 | DECODE_EMULATEX (0x0ff000f0, 0x01600010, emulate_rd12rm0_noflags_nopc, |
1092 | REGS(0, NOPC, 0, 0, NOPC)), | ||
1072 | 1093 | ||
1073 | /* QADD cccc 0001 0000 xxxx xxxx xxxx 0101 xxxx */ | 1094 | /* QADD cccc 0001 0000 xxxx xxxx xxxx 0101 xxxx */ |
1074 | /* QSUB cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx */ | 1095 | /* QSUB cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx */ |
@@ -1249,7 +1270,8 @@ static const union decode_item arm_cccc_001x_table[] = { | |||
1249 | 1270 | ||
1250 | /* MOVW cccc 0011 0000 xxxx xxxx xxxx xxxx xxxx */ | 1271 | /* MOVW cccc 0011 0000 xxxx xxxx xxxx xxxx xxxx */ |
1251 | /* MOVT cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx */ | 1272 | /* MOVT cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx */ |
1252 | DECODE_CUSTOM (0x0fb00000, 0x03000000, prep_emulate_rd12_modify), | 1273 | DECODE_EMULATEX (0x0fb00000, 0x03000000, emulate_rd12rm0_noflags_nopc, |
1274 | REGS(0, NOPC, 0, 0, 0)), | ||
1253 | 1275 | ||
1254 | /* YIELD cccc 0011 0010 0000 xxxx xxxx 0000 0001 */ | 1276 | /* YIELD cccc 0011 0010 0000 xxxx xxxx 0000 0001 */ |
1255 | DECODE_OR (0x0fff00ff, 0x03200001), | 1277 | DECODE_OR (0x0fff00ff, 0x03200001), |
@@ -1314,7 +1336,8 @@ static const union decode_item arm_cccc_0110_____xxx1_table[] = { | |||
1314 | /* REV16 cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */ | 1336 | /* REV16 cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */ |
1315 | /* RBIT cccc 0110 1111 xxxx xxxx xxxx 0011 xxxx */ | 1337 | /* RBIT cccc 0110 1111 xxxx xxxx xxxx 0011 xxxx */ |
1316 | /* REVSH cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */ | 1338 | /* REVSH cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */ |
1317 | DECODE_CUSTOM (0x0fb00070, 0x06b00030, prep_emulate_rd12rm0), | 1339 | DECODE_EMULATEX (0x0fb00070, 0x06b00030, emulate_rd12rm0_noflags_nopc, |
1340 | REGS(0, NOPC, 0, 0, NOPC)), | ||
1318 | 1341 | ||
1319 | /* ??? cccc 0110 0x00 xxxx xxxx xxxx xxx1 xxxx */ | 1342 | /* ??? cccc 0110 0x00 xxxx xxxx xxxx xxx1 xxxx */ |
1320 | DECODE_REJECT (0x0fb00010, 0x06000010), | 1343 | DECODE_REJECT (0x0fb00010, 0x06000010), |
@@ -1376,7 +1399,8 @@ static const union decode_item arm_cccc_0110_____xxx1_table[] = { | |||
1376 | /* UXTB16 cccc 0110 1100 1111 xxxx xxxx 0111 xxxx */ | 1399 | /* UXTB16 cccc 0110 1100 1111 xxxx xxxx 0111 xxxx */ |
1377 | /* UXTB cccc 0110 1110 1111 xxxx xxxx 0111 xxxx */ | 1400 | /* UXTB cccc 0110 1110 1111 xxxx xxxx 0111 xxxx */ |
1378 | /* UXTH cccc 0110 1111 1111 xxxx xxxx 0111 xxxx */ | 1401 | /* UXTH cccc 0110 1111 1111 xxxx xxxx 0111 xxxx */ |
1379 | DECODE_CUSTOM (0x0f8f00f0, 0x068f0070, prep_emulate_rd12rm0), | 1402 | DECODE_EMULATEX (0x0f8f00f0, 0x068f0070, emulate_rd12rm0_noflags_nopc, |
1403 | REGS(0, NOPC, 0, 0, NOPC)), | ||
1380 | 1404 | ||
1381 | /* SXTAB16 cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx */ | 1405 | /* SXTAB16 cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx */ |
1382 | /* SXTAB cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx */ | 1406 | /* SXTAB cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx */ |
@@ -1424,13 +1448,16 @@ static const union decode_item arm_cccc_0111_____xxx1_table[] = { | |||
1424 | 1448 | ||
1425 | /* SBFX cccc 0111 101x xxxx xxxx xxxx x101 xxxx */ | 1449 | /* SBFX cccc 0111 101x xxxx xxxx xxxx x101 xxxx */ |
1426 | /* UBFX cccc 0111 111x xxxx xxxx xxxx x101 xxxx */ | 1450 | /* UBFX cccc 0111 111x xxxx xxxx xxxx x101 xxxx */ |
1427 | DECODE_CUSTOM (0x0fa00070, 0x07a00050, prep_emulate_rd12rm0), | 1451 | DECODE_EMULATEX (0x0fa00070, 0x07a00050, emulate_rd12rm0_noflags_nopc, |
1452 | REGS(0, NOPC, 0, 0, NOPC)), | ||
1428 | 1453 | ||
1429 | /* BFC cccc 0111 110x xxxx xxxx xxxx x001 1111 */ | 1454 | /* BFC cccc 0111 110x xxxx xxxx xxxx x001 1111 */ |
1430 | DECODE_CUSTOM (0x0fe0007f, 0x07c0001f, prep_emulate_rd12_modify), | 1455 | DECODE_EMULATEX (0x0fe0007f, 0x07c0001f, emulate_rd12rm0_noflags_nopc, |
1456 | REGS(0, NOPC, 0, 0, 0)), | ||
1431 | 1457 | ||
1432 | /* BFI cccc 0111 110x xxxx xxxx xxxx x001 xxxx */ | 1458 | /* BFI cccc 0111 110x xxxx xxxx xxxx x001 xxxx */ |
1433 | DECODE_CUSTOM (0x0fe00070, 0x07c00010, prep_emulate_rd12rn0_modify), | 1459 | DECODE_EMULATEX (0x0fe00070, 0x07c00010, emulate_rd12rm0_noflags_nopc, |
1460 | REGS(0, NOPC, 0, 0, NOPCX)), | ||
1434 | 1461 | ||
1435 | DECODE_END | 1462 | DECODE_END |
1436 | }; | 1463 | }; |