|
17 | 17 | #include <asm/sysreg.h>
|
18 | 18 | #include <asm/system_misc.h>
|
19 | 19 | #include <asm/traps.h>
|
20 |
| -#include <asm/kprobes.h> |
21 | 20 |
|
22 | 21 | #define CREATE_TRACE_POINTS
|
23 | 22 | #include "trace-events-emulation.h"
|
@@ -52,6 +51,25 @@ struct insn_emulation {
|
52 | 51 | int max;
|
53 | 52 | };
|
54 | 53 |
|
| 54 | +#define ARM_OPCODE_CONDTEST_FAIL 0 |
| 55 | +#define ARM_OPCODE_CONDTEST_PASS 1 |
| 56 | +#define ARM_OPCODE_CONDTEST_UNCOND 2 |
| 57 | + |
| 58 | +#define ARM_OPCODE_CONDITION_UNCOND 0xf |
| 59 | + |
| 60 | +static unsigned int aarch32_check_condition(u32 opcode, u32 psr) |
| 61 | +{ |
| 62 | + u32 cc_bits = opcode >> 28; |
| 63 | + |
| 64 | + if (cc_bits != ARM_OPCODE_CONDITION_UNCOND) { |
| 65 | + if ((*aarch32_opcode_cond_checks[cc_bits])(psr)) |
| 66 | + return ARM_OPCODE_CONDTEST_PASS; |
| 67 | + else |
| 68 | + return ARM_OPCODE_CONDTEST_FAIL; |
| 69 | + } |
| 70 | + return ARM_OPCODE_CONDTEST_UNCOND; |
| 71 | +} |
| 72 | + |
55 | 73 | /*
|
56 | 74 | * Implement emulation of the SWP/SWPB instructions using load-exclusive and
|
57 | 75 | * store-exclusive.
|
@@ -132,25 +150,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
|
132 | 150 | return res;
|
133 | 151 | }
|
134 | 152 |
|
135 |
| -#define ARM_OPCODE_CONDTEST_FAIL 0 |
136 |
| -#define ARM_OPCODE_CONDTEST_PASS 1 |
137 |
| -#define ARM_OPCODE_CONDTEST_UNCOND 2 |
138 |
| - |
139 |
| -#define ARM_OPCODE_CONDITION_UNCOND 0xf |
140 |
| - |
141 |
| -static unsigned int __kprobes aarch32_check_condition(u32 opcode, u32 psr) |
142 |
| -{ |
143 |
| - u32 cc_bits = opcode >> 28; |
144 |
| - |
145 |
| - if (cc_bits != ARM_OPCODE_CONDITION_UNCOND) { |
146 |
| - if ((*aarch32_opcode_cond_checks[cc_bits])(psr)) |
147 |
| - return ARM_OPCODE_CONDTEST_PASS; |
148 |
| - else |
149 |
| - return ARM_OPCODE_CONDTEST_FAIL; |
150 |
| - } |
151 |
| - return ARM_OPCODE_CONDTEST_UNCOND; |
152 |
| -} |
153 |
| - |
154 | 153 | /*
|
155 | 154 | * swp_handler logs the id of calling process, dissects the instruction, sanity
|
156 | 155 | * checks the memory location, calls emulate_swpX for the actual operation and
|
|
0 commit comments