diff options
author | Jon Medhurst <tixy@yxit.co.uk> | 2011-06-16 09:53:56 -0400 |
---|---|---|
committer | Tixy <tixy@medhuaa1.miniserver.com> | 2011-07-13 13:32:42 -0400 |
commit | 6aaa8b5570c7b5b9eb8913ec80263a1012b1dd66 (patch) | |
tree | 45a54e0b4f25b7e6979d16870f3d23fdd28b3a78 | |
parent | eaf4f33feca2704ad1d06f1ef6b427712c506cc0 (diff) |
ARM: kprobes: Add it_advance()
This advances the ITSTATE bits in CPSR to their values for the next
instruction.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r-- | arch/arm/kernel/kprobes.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h index a84b14d8cdc8..5e2485c4cacd 100644 --- a/arch/arm/kernel/kprobes.h +++ b/arch/arm/kernel/kprobes.h | |||
@@ -69,6 +69,31 @@ void __init find_str_pc_offset(void); | |||
69 | 69 | ||
70 | 70 | ||
71 | /* | 71 | /* |
72 | * Update ITSTATE after normal execution of an IT block instruction. | ||
73 | * | ||
74 | * The 8 IT state bits are split into two parts in CPSR: | ||
75 | * ITSTATE<1:0> are in CPSR<26:25> | ||
76 | * ITSTATE<7:2> are in CPSR<15:10> | ||
77 | */ | ||
78 | static inline unsigned long it_advance(unsigned long cpsr) | ||
79 | { | ||
80 | if ((cpsr & 0x06000400) == 0) { | ||
81 | /* ITSTATE<2:0> == 0 means end of IT block, so clear IT state */ | ||
82 | cpsr &= ~PSR_IT_MASK; | ||
83 | } else { | ||
84 | /* We need to shift left ITSTATE<4:0> */ | ||
85 | const unsigned long mask = 0x06001c00; /* Mask ITSTATE<4:0> */ | ||
86 | unsigned long it = cpsr & mask; | ||
87 | it <<= 1; | ||
88 | it |= it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ | ||
89 | it &= mask; | ||
90 | cpsr &= ~mask; | ||
91 | cpsr |= it; | ||
92 | } | ||
93 | return cpsr; | ||
94 | } | ||
95 | |||
96 | /* | ||
72 | * Test if load/store instructions writeback the address register. | 97 | * Test if load/store instructions writeback the address register. |
73 | * if P (bit 24) == 0 or W (bit 21) == 1 | 98 | * if P (bit 24) == 0 or W (bit 21) == 1 |
74 | */ | 99 | */ |