aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorJon Medhurst <tixy@yxit.co.uk>2011-04-19 05:52:19 -0400
committerNicolas Pitre <nicolas.pitre@linaro.org>2011-04-28 23:41:01 -0400
commit94254930786216106100e9a28c9a244df58be61f (patch)
tree4c2d0f0cb209b6c6608f129f98ba3a0e38f24d78 /arch/arm/kernel
parent20e8155e24ba5c04558780d0a8da13c39f98c002 (diff)
ARM: kprobes: Add emulation of hint instructions like NOP and WFI
Being able to probe NOP instructions is useful for hard-coding probeable locations and is used by the kprobes test code. 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.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 6bed8b089af0..03b85ad525ab 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1225,6 +1225,30 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1225 if ((insn & 0x0fb00000) == 0x03000000) 1225 if ((insn & 0x0fb00000) == 0x03000000)
1226 return prep_emulate_rd12_modify(insn, asi); 1226 return prep_emulate_rd12_modify(insn, asi);
1227 1227
1228 /* hints : cccc 0011 0010 0000 xxxx xxxx xxxx xxxx */
1229 if ((insn & 0x0fff0000) == 0x03200000) {
1230 unsigned op2 = insn & 0x000000ff;
1231 if (op2 == 0x01 || op2 == 0x04) {
1232 /* YIELD : cccc 0011 0010 0000 xxxx xxxx 0000 0001 */
1233 /* SEV : cccc 0011 0010 0000 xxxx xxxx 0000 0100 */
1234 asi->insn[0] = insn;
1235 asi->insn_handler = emulate_none;
1236 return INSN_GOOD;
1237 } else if (op2 <= 0x03) {
1238 /* NOP : cccc 0011 0010 0000 xxxx xxxx 0000 0000 */
1239 /* WFE : cccc 0011 0010 0000 xxxx xxxx 0000 0010 */
1240 /* WFI : cccc 0011 0010 0000 xxxx xxxx 0000 0011 */
1241 /*
1242 * We make WFE and WFI true NOPs to avoid stalls due
1243 * to missing events whilst processing the probe.
1244 */
1245 asi->insn_handler = emulate_nop;
1246 return INSN_GOOD_NO_SLOT;
1247 }
1248 /* For DBG and unallocated hints it's safest to reject them */
1249 return INSN_REJECTED;
1250 }
1251
1228 /* 1252 /*
1229 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx 1253 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx
1230 * ALU op with S bit and Rd == 15 : 1254 * ALU op with S bit and Rd == 15 :