aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Medhurst <tixy@yxit.co.uk>2011-08-27 07:41:05 -0400
committerJon Medhurst <tixy@yxit.co.uk>2011-09-20 14:17:43 -0400
commitc0cc6df16394da020242a54d577848f9edd9dc50 (patch)
tree5a4da2ef6eeffad38d5771cd1ed8a000a6dbf037
parentc7054aad538c18bc4c311e74a24cb2e205f02e04 (diff)
ARM: kprobes: Add ARM instruction simulation test cases
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/kprobes-test-arm.c1323
-rw-r--r--arch/arm/kernel/kprobes-test.c5
-rw-r--r--arch/arm/kernel/kprobes-test.h2
4 files changed, 1332 insertions, 0 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index ee9c049fc177..af32e466e1c1 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -47,6 +47,8 @@ obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o
47test-kprobes-objs := kprobes-test.o 47test-kprobes-objs := kprobes-test.o
48ifdef CONFIG_THUMB2_KERNEL 48ifdef CONFIG_THUMB2_KERNEL
49test-kprobes-objs += kprobes-test-thumb.o 49test-kprobes-objs += kprobes-test-thumb.o
50else
51test-kprobes-objs += kprobes-test-arm.o
50endif 52endif
51obj-$(CONFIG_ATAGS_PROC) += atags.o 53obj-$(CONFIG_ATAGS_PROC) += atags.o
52obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 54obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
new file mode 100644
index 000000000000..fc82de8bdcce
--- /dev/null
+++ b/arch/arm/kernel/kprobes-test-arm.c
@@ -0,0 +1,1323 @@
1/*
2 * arch/arm/kernel/kprobes-test-arm.c
3 *
4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/module.h>
13
14#include "kprobes-test.h"
15
16
17#define TEST_ISA "32"
18
19#define TEST_ARM_TO_THUMB_INTERWORK_R(code1, reg, val, code2) \
20 TESTCASE_START(code1 #reg code2) \
21 TEST_ARG_REG(reg, val) \
22 TEST_ARG_REG(14, 99f) \
23 TEST_ARG_END("") \
24 "50: nop \n\t" \
25 "1: "code1 #reg code2" \n\t" \
26 " bx lr \n\t" \
27 ".thumb \n\t" \
28 "3: adr lr, 2f \n\t" \
29 " bx lr \n\t" \
30 ".arm \n\t" \
31 "2: nop \n\t" \
32 TESTCASE_END
33
34#define TEST_ARM_TO_THUMB_INTERWORK_P(code1, reg, val, code2) \
35 TESTCASE_START(code1 #reg code2) \
36 TEST_ARG_PTR(reg, val) \
37 TEST_ARG_REG(14, 99f) \
38 TEST_ARG_MEM(15, 3f+1) \
39 TEST_ARG_END("") \
40 "50: nop \n\t" \
41 "1: "code1 #reg code2" \n\t" \
42 " bx lr \n\t" \
43 ".thumb \n\t" \
44 "3: adr lr, 2f \n\t" \
45 " bx lr \n\t" \
46 ".arm \n\t" \
47 "2: nop \n\t" \
48 TESTCASE_END
49
50
51void kprobe_arm_test_cases(void)
52{
53 kprobe_test_flags = 0;
54
55 TEST_GROUP("Data-processing (register), (register-shifted register), (immediate)")
56
57#define _DATA_PROCESSING_DNM(op,s,val) \
58 TEST_RR( op "eq" s " r0, r",1, VAL1,", r",2, val, "") \
59 TEST_RR( op "ne" s " r1, r",1, VAL1,", r",2, val, ", lsl #3") \
60 TEST_RR( op "cs" s " r2, r",3, VAL1,", r",2, val, ", lsr #4") \
61 TEST_RR( op "cc" s " r3, r",3, VAL1,", r",2, val, ", asr #5") \
62 TEST_RR( op "mi" s " r4, r",5, VAL1,", r",2, N(val),", asr #6") \
63 TEST_RR( op "pl" s " r5, r",5, VAL1,", r",2, val, ", ror #7") \
64 TEST_RR( op "vs" s " r6, r",7, VAL1,", r",2, val, ", rrx") \
65 TEST_R( op "vc" s " r6, r",7, VAL1,", pc, lsl #3") \
66 TEST_R( op "vc" s " r6, r",7, VAL1,", sp, lsr #4") \
67 TEST_R( op "vc" s " r6, pc, r",7, VAL1,", asr #5") \
68 TEST_R( op "vc" s " r6, sp, r",7, VAL1,", ror #6") \
69 TEST_RRR( op "hi" s " r8, r",9, VAL1,", r",14,val, ", lsl r",0, 3,"")\
70 TEST_RRR( op "ls" s " r9, r",9, VAL1,", r",14,val, ", lsr r",7, 4,"")\
71 TEST_RRR( op "ge" s " r10, r",11,VAL1,", r",14,val, ", asr r",7, 5,"")\
72 TEST_RRR( op "lt" s " r11, r",11,VAL1,", r",14,N(val),", asr r",7, 6,"")\
73 TEST_RR( op "gt" s " r12, r13" ", r",14,val, ", ror r",14,7,"")\
74 TEST_RR( op "le" s " r14, r",0, val, ", r13" ", lsl r",14,8,"")\
75 TEST_RR( op s " r12, pc" ", r",14,val, ", ror r",14,7,"")\
76 TEST_RR( op s " r14, r",0, val, ", pc" ", lsl r",14,8,"")\
77 TEST_R( op "eq" s " r0, r",11,VAL1,", #0xf5") \
78 TEST_R( op "ne" s " r11, r",0, VAL1,", #0xf5000000") \
79 TEST_R( op s " r7, r",8, VAL2,", #0x000af000") \
80 TEST( op s " r4, pc" ", #0x00005a00")
81
82#define DATA_PROCESSING_DNM(op,val) \
83 _DATA_PROCESSING_DNM(op,"",val) \
84 _DATA_PROCESSING_DNM(op,"s",val)
85
86#define DATA_PROCESSING_NM(op,val) \
87 TEST_RR( op "ne r",1, VAL1,", r",2, val, "") \
88 TEST_RR( op "eq r",1, VAL1,", r",2, val, ", lsl #3") \
89 TEST_RR( op "cc r",3, VAL1,", r",2, val, ", lsr #4") \
90 TEST_RR( op "cs r",3, VAL1,", r",2, val, ", asr #5") \
91 TEST_RR( op "pl r",5, VAL1,", r",2, N(val),", asr #6") \
92 TEST_RR( op "mi r",5, VAL1,", r",2, val, ", ror #7") \
93 TEST_RR( op "vc r",7, VAL1,", r",2, val, ", rrx") \
94 TEST_R ( op "vs r",7, VAL1,", pc, lsl #3") \
95 TEST_R ( op "vs r",7, VAL1,", sp, lsr #4") \
96 TEST_R( op "vs pc, r",7, VAL1,", asr #5") \
97 TEST_R( op "vs sp, r",7, VAL1,", ror #6") \
98 TEST_RRR( op "ls r",9, VAL1,", r",14,val, ", lsl r",0, 3,"") \
99 TEST_RRR( op "hi r",9, VAL1,", r",14,val, ", lsr r",7, 4,"") \
100 TEST_RRR( op "lt r",11,VAL1,", r",14,val, ", asr r",7, 5,"") \
101 TEST_RRR( op "ge r",11,VAL1,", r",14,N(val),", asr r",7, 6,"") \
102 TEST_RR( op "le r13" ", r",14,val, ", ror r",14,7,"") \
103 TEST_RR( op "gt r",0, val, ", r13" ", lsl r",14,8,"") \
104 TEST_RR( op " pc" ", r",14,val, ", ror r",14,7,"") \
105 TEST_RR( op " r",0, val, ", pc" ", lsl r",14,8,"") \
106 TEST_R( op "eq r",11,VAL1,", #0xf5") \
107 TEST_R( op "ne r",0, VAL1,", #0xf5000000") \
108 TEST_R( op " r",8, VAL2,", #0x000af000")
109
110#define _DATA_PROCESSING_DM(op,s,val) \
111 TEST_R( op "eq" s " r0, r",1, val, "") \
112 TEST_R( op "ne" s " r1, r",1, val, ", lsl #3") \
113 TEST_R( op "cs" s " r2, r",3, val, ", lsr #4") \
114 TEST_R( op "cc" s " r3, r",3, val, ", asr #5") \
115 TEST_R( op "mi" s " r4, r",5, N(val),", asr #6") \
116 TEST_R( op "pl" s " r5, r",5, val, ", ror #7") \
117 TEST_R( op "vs" s " r6, r",10,val, ", rrx") \
118 TEST( op "vs" s " r7, pc, lsl #3") \
119 TEST( op "vs" s " r7, sp, lsr #4") \
120 TEST_RR( op "vc" s " r8, r",7, val, ", lsl r",0, 3,"") \
121 TEST_RR( op "hi" s " r9, r",9, val, ", lsr r",7, 4,"") \
122 TEST_RR( op "ls" s " r10, r",9, val, ", asr r",7, 5,"") \
123 TEST_RR( op "ge" s " r11, r",11,N(val),", asr r",7, 6,"") \
124 TEST_RR( op "lt" s " r12, r",11,val, ", ror r",14,7,"") \
125 TEST_R( op "gt" s " r14, r13" ", lsl r",14,8,"") \
126 TEST_R( op "le" s " r14, pc" ", lsl r",14,8,"") \
127 TEST( op "eq" s " r0, #0xf5") \
128 TEST( op "ne" s " r11, #0xf5000000") \
129 TEST( op s " r7, #0x000af000") \
130 TEST( op s " r4, #0x00005a00")
131
132#define DATA_PROCESSING_DM(op,val) \
133 _DATA_PROCESSING_DM(op,"",val) \
134 _DATA_PROCESSING_DM(op,"s",val)
135
136 DATA_PROCESSING_DNM("and",0xf00f00ff)
137 DATA_PROCESSING_DNM("eor",0xf00f00ff)
138 DATA_PROCESSING_DNM("sub",VAL2)
139 DATA_PROCESSING_DNM("rsb",VAL2)
140 DATA_PROCESSING_DNM("add",VAL2)
141 DATA_PROCESSING_DNM("adc",VAL2)
142 DATA_PROCESSING_DNM("sbc",VAL2)
143 DATA_PROCESSING_DNM("rsc",VAL2)
144 DATA_PROCESSING_NM("tst",0xf00f00ff)
145 DATA_PROCESSING_NM("teq",0xf00f00ff)
146 DATA_PROCESSING_NM("cmp",VAL2)
147 DATA_PROCESSING_NM("cmn",VAL2)
148 DATA_PROCESSING_DNM("orr",0xf00f00ff)
149 DATA_PROCESSING_DM("mov",VAL2)
150 DATA_PROCESSING_DNM("bic",0xf00f00ff)
151 DATA_PROCESSING_DM("mvn",VAL2)
152
153 TEST("mov ip, sp") /* This has special case emulation code */
154
155 TEST_SUPPORTED("mov pc, #0x1000");
156 TEST_SUPPORTED("mov sp, #0x1000");
157 TEST_SUPPORTED("cmp pc, #0x1000");
158 TEST_SUPPORTED("cmp sp, #0x1000");
159
160 /* Data-processing with PC as shift*/
161 TEST_UNSUPPORTED(".word 0xe15c0f1e @ cmp r12, r14, asl pc")
162 TEST_UNSUPPORTED(".word 0xe1a0cf1e @ mov r12, r14, asl pc")
163 TEST_UNSUPPORTED(".word 0xe08caf1e @ add r10, r12, r14, asl pc")
164
165 /* Data-processing with PC as shift*/
166 TEST_UNSUPPORTED("movs pc, r1")
167 TEST_UNSUPPORTED("movs pc, r1, lsl r2")
168 TEST_UNSUPPORTED("movs pc, #0x10000")
169 TEST_UNSUPPORTED("adds pc, lr, r1")
170 TEST_UNSUPPORTED("adds pc, lr, r1, lsl r2")
171 TEST_UNSUPPORTED("adds pc, lr, #4")
172
173 /* Data-processing with SP as target */
174 TEST("add sp, sp, #16")
175 TEST("sub sp, sp, #8")
176 TEST("bic sp, sp, #0x20")
177 TEST("orr sp, sp, #0x20")
178 TEST_PR( "add sp, r",10,0,", r",11,4,"")
179 TEST_PRR("add sp, r",10,0,", r",11,4,", asl r",12,1,"")
180 TEST_P( "mov sp, r",10,0,"")
181 TEST_PR( "mov sp, r",10,0,", asl r",12,0,"")
182
183 /* Data-processing with PC as target */
184 TEST_BF( "add pc, pc, #2f-1b-8")
185 TEST_BF_R ("add pc, pc, r",14,2f-1f-8,"")
186 TEST_BF_R ("add pc, r",14,2f-1f-8,", pc")
187 TEST_BF_R ("mov pc, r",0,2f,"")
188 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"")
189 TEST_BB( "sub pc, pc, #1b-2b+8")
190#if __LINUX_ARM_ARCH__ >= 6
191 TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before ARMv6 */
192#endif
193 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"")
194 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")
195 TEST_RR( "add pc, pc, r",10,-2,", asl r",11,1,"")
196#ifdef CONFIG_THUMB2_KERNEL
197 TEST_ARM_TO_THUMB_INTERWORK_R("add pc, pc, r",0,3f-1f-8+1,"")
198 TEST_ARM_TO_THUMB_INTERWORK_R("sub pc, r",0,3f+8+1,", #8")
199#endif
200 TEST_GROUP("Miscellaneous instructions")
201
202 TEST("mrs r0, cpsr")
203 TEST("mrspl r7, cpsr")
204 TEST("mrs r14, cpsr")
205 TEST_UNSUPPORTED(".word 0xe10ff000 @ mrs r15, cpsr")
206 TEST_UNSUPPORTED("mrs r0, spsr")
207 TEST_UNSUPPORTED("mrs lr, spsr")
208
209 TEST_UNSUPPORTED("msr cpsr, r0")
210 TEST_UNSUPPORTED("msr cpsr_f, lr")
211 TEST_UNSUPPORTED("msr spsr, r0")
212
213 TEST_BF_R("bx r",0,2f,"")
214 TEST_BB_R("bx r",7,2f,"")
215 TEST_BF_R("bxeq r",14,2f,"")
216
217 TEST_R("clz r0, r",0, 0x0,"")
218 TEST_R("clzeq r7, r",14,0x1,"")
219 TEST_R("clz lr, r",7, 0xffffffff,"")
220 TEST( "clz r4, sp")
221 TEST_UNSUPPORTED(".word 0x016fff10 @ clz pc, r0")
222 TEST_UNSUPPORTED(".word 0x016f0f1f @ clz r0, pc")
223
224#if __LINUX_ARM_ARCH__ >= 6
225 TEST_UNSUPPORTED("bxj r0")
226#endif
227
228 TEST_BF_R("blx r",0,2f,"")
229 TEST_BB_R("blx r",7,2f,"")
230 TEST_BF_R("blxeq r",14,2f,"")
231 TEST_UNSUPPORTED(".word 0x0120003f @ blx pc")
232
233 TEST_RR( "qadd r0, r",1, VAL1,", r",2, VAL2,"")
234 TEST_RR( "qaddvs lr, r",9, VAL2,", r",8, VAL1,"")
235 TEST_R( "qadd lr, r",9, VAL2,", r13")
236 TEST_RR( "qsub r0, r",1, VAL1,", r",2, VAL2,"")
237 TEST_RR( "qsubvs lr, r",9, VAL2,", r",8, VAL1,"")
238 TEST_R( "qsub lr, r",9, VAL2,", r13")
239 TEST_RR( "qdadd r0, r",1, VAL1,", r",2, VAL2,"")
240 TEST_RR( "qdaddvs lr, r",9, VAL2,", r",8, VAL1,"")
241 TEST_R( "qdadd lr, r",9, VAL2,", r13")
242 TEST_RR( "qdsub r0, r",1, VAL1,", r",2, VAL2,"")
243 TEST_RR( "qdsubvs lr, r",9, VAL2,", r",8, VAL1,"")
244 TEST_R( "qdsub lr, r",9, VAL2,", r13")
245 TEST_UNSUPPORTED(".word 0xe101f050 @ qadd pc, r0, r1")
246 TEST_UNSUPPORTED(".word 0xe121f050 @ qsub pc, r0, r1")
247 TEST_UNSUPPORTED(".word 0xe141f050 @ qdadd pc, r0, r1")
248 TEST_UNSUPPORTED(".word 0xe161f050 @ qdsub pc, r0, r1")
249 TEST_UNSUPPORTED(".word 0xe16f2050 @ qdsub r2, r0, pc")
250 TEST_UNSUPPORTED(".word 0xe161205f @ qdsub r2, pc, r1")
251
252 TEST_UNSUPPORTED("bkpt 0xffff")
253 TEST_UNSUPPORTED("bkpt 0x0000")
254
255 TEST_UNSUPPORTED(".word 0xe1600070 @ smc #0")
256
257 TEST_GROUP("Halfword multiply and multiply-accumulate")
258
259 TEST_RRR( "smlabb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
260 TEST_RRR( "smlabbge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
261 TEST_RR( "smlabb lr, r",1, VAL2,", r",2, VAL3,", r13")
262 TEST_UNSUPPORTED(".word 0xe10f3281 @ smlabb pc, r1, r2, r3")
263 TEST_RRR( "smlatb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
264 TEST_RRR( "smlatbge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
265 TEST_RR( "smlatb lr, r",1, VAL2,", r",2, VAL3,", r13")
266 TEST_UNSUPPORTED(".word 0xe10f32a1 @ smlatb pc, r1, r2, r3")
267 TEST_RRR( "smlabt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
268 TEST_RRR( "smlabtge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
269 TEST_RR( "smlabt lr, r",1, VAL2,", r",2, VAL3,", r13")
270 TEST_UNSUPPORTED(".word 0xe10f32c1 @ smlabt pc, r1, r2, r3")
271 TEST_RRR( "smlatt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
272 TEST_RRR( "smlattge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
273 TEST_RR( "smlatt lr, r",1, VAL2,", r",2, VAL3,", r13")
274 TEST_UNSUPPORTED(".word 0xe10f32e1 @ smlatt pc, r1, r2, r3")
275
276 TEST_RRR( "smlawb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
277 TEST_RRR( "smlawbge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
278 TEST_RR( "smlawb lr, r",1, VAL2,", r",2, VAL3,", r13")
279 TEST_UNSUPPORTED(".word 0xe12f3281 @ smlawb pc, r1, r2, r3")
280 TEST_RRR( "smlawt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
281 TEST_RRR( "smlawtge r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
282 TEST_RR( "smlawt lr, r",1, VAL2,", r",2, VAL3,", r13")
283 TEST_UNSUPPORTED(".word 0xe12f32c1 @ smlawt pc, r1, r2, r3")
284 TEST_UNSUPPORTED(".word 0xe12032cf @ smlawt r0, pc, r2, r3")
285 TEST_UNSUPPORTED(".word 0xe1203fc1 @ smlawt r0, r1, pc, r3")
286 TEST_UNSUPPORTED(".word 0xe120f2c1 @ smlawt r0, r1, r2, pc")
287
288 TEST_RR( "smulwb r0, r",1, VAL1,", r",2, VAL2,"")
289 TEST_RR( "smulwbge r7, r",8, VAL3,", r",9, VAL1,"")
290 TEST_R( "smulwb lr, r",1, VAL2,", r13")
291 TEST_UNSUPPORTED(".word 0xe12f02a1 @ smulwb pc, r1, r2")
292 TEST_RR( "smulwt r0, r",1, VAL1,", r",2, VAL2,"")
293 TEST_RR( "smulwtge r7, r",8, VAL3,", r",9, VAL1,"")
294 TEST_R( "smulwt lr, r",1, VAL2,", r13")
295 TEST_UNSUPPORTED(".word 0xe12f02e1 @ smulwt pc, r1, r2")
296
297 TEST_RRRR( "smlalbb r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
298 TEST_RRRR( "smlalbble r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
299 TEST_RRR( "smlalbb r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
300 TEST_UNSUPPORTED(".word 0xe14f1382 @ smlalbb pc, r1, r2, r3")
301 TEST_UNSUPPORTED(".word 0xe141f382 @ smlalbb r1, pc, r2, r3")
302 TEST_RRRR( "smlaltb r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
303 TEST_RRRR( "smlaltble r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
304 TEST_RRR( "smlaltb r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
305 TEST_UNSUPPORTED(".word 0xe14f13a2 @ smlaltb pc, r1, r2, r3")
306 TEST_UNSUPPORTED(".word 0xe141f3a2 @ smlaltb r1, pc, r2, r3")
307 TEST_RRRR( "smlalbt r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
308 TEST_RRRR( "smlalbtle r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
309 TEST_RRR( "smlalbt r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
310 TEST_UNSUPPORTED(".word 0xe14f13c2 @ smlalbt pc, r1, r2, r3")
311 TEST_UNSUPPORTED(".word 0xe141f3c2 @ smlalbt r1, pc, r2, r3")
312 TEST_RRRR( "smlaltt r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
313 TEST_RRRR( "smlalttle r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
314 TEST_RRR( "smlaltt r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
315 TEST_UNSUPPORTED(".word 0xe14f13e2 @ smlalbb pc, r1, r2, r3")
316 TEST_UNSUPPORTED(".word 0xe140f3e2 @ smlalbb r0, pc, r2, r3")
317 TEST_UNSUPPORTED(".word 0xe14013ef @ smlalbb r0, r1, pc, r3")
318 TEST_UNSUPPORTED(".word 0xe1401fe2 @ smlalbb r0, r1, r2, pc")
319
320 TEST_RR( "smulbb r0, r",1, VAL1,", r",2, VAL2,"")
321 TEST_RR( "smulbbge r7, r",8, VAL3,", r",9, VAL1,"")
322 TEST_R( "smulbb lr, r",1, VAL2,", r13")
323 TEST_UNSUPPORTED(".word 0xe16f0281 @ smulbb pc, r1, r2")
324 TEST_RR( "smultb r0, r",1, VAL1,", r",2, VAL2,"")
325 TEST_RR( "smultbge r7, r",8, VAL3,", r",9, VAL1,"")
326 TEST_R( "smultb lr, r",1, VAL2,", r13")
327 TEST_UNSUPPORTED(".word 0xe16f02a1 @ smultb pc, r1, r2")
328 TEST_RR( "smulbt r0, r",1, VAL1,", r",2, VAL2,"")
329 TEST_RR( "smulbtge r7, r",8, VAL3,", r",9, VAL1,"")
330 TEST_R( "smulbt lr, r",1, VAL2,", r13")
331 TEST_UNSUPPORTED(".word 0xe16f02c1 @ smultb pc, r1, r2")
332 TEST_RR( "smultt r0, r",1, VAL1,", r",2, VAL2,"")
333 TEST_RR( "smulttge r7, r",8, VAL3,", r",9, VAL1,"")
334 TEST_R( "smultt lr, r",1, VAL2,", r13")
335 TEST_UNSUPPORTED(".word 0xe16f02e1 @ smultt pc, r1, r2")
336 TEST_UNSUPPORTED(".word 0xe16002ef @ smultt r0, pc, r2")
337 TEST_UNSUPPORTED(".word 0xe1600fe1 @ smultt r0, r1, pc")
338
339 TEST_GROUP("Multiply and multiply-accumulate")
340
341 TEST_RR( "mul r0, r",1, VAL1,", r",2, VAL2,"")
342 TEST_RR( "mulls r7, r",8, VAL2,", r",9, VAL2,"")
343 TEST_R( "mul lr, r",4, VAL3,", r13")
344 TEST_UNSUPPORTED(".word 0xe00f0291 @ mul pc, r1, r2")
345 TEST_UNSUPPORTED(".word 0xe000029f @ mul r0, pc, r2")
346 TEST_UNSUPPORTED(".word 0xe0000f91 @ mul r0, r1, pc")
347 TEST_RR( "muls r0, r",1, VAL1,", r",2, VAL2,"")
348 TEST_RR( "mullss r7, r",8, VAL2,", r",9, VAL2,"")
349 TEST_R( "muls lr, r",4, VAL3,", r13")
350 TEST_UNSUPPORTED(".word 0xe01f0291 @ muls pc, r1, r2")
351
352 TEST_RRR( "mla r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
353 TEST_RRR( "mlahi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
354 TEST_RR( "mla lr, r",1, VAL2,", r",2, VAL3,", r13")
355 TEST_UNSUPPORTED(".word 0xe02f3291 @ mla pc, r1, r2, r3")
356 TEST_RRR( "mlas r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
357 TEST_RRR( "mlahis r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
358 TEST_RR( "mlas lr, r",1, VAL2,", r",2, VAL3,", r13")
359 TEST_UNSUPPORTED(".word 0xe03f3291 @ mlas pc, r1, r2, r3")
360
361#if __LINUX_ARM_ARCH__ >= 6
362 TEST_RR( "umaal r0, r1, r",2, VAL1,", r",3, VAL2,"")
363 TEST_RR( "umaalls r7, r8, r",9, VAL2,", r",10, VAL1,"")
364 TEST_R( "umaal lr, r12, r",11,VAL3,", r13")
365 TEST_UNSUPPORTED(".word 0xe041f392 @ umaal pc, r1, r2, r3")
366 TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
367 TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
368 TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
369
370 TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
371 TEST_RRR( "mlshi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
372 TEST_RR( "mls lr, r",1, VAL2,", r",2, VAL3,", r13")
373 TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
374 TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
375 TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
376 TEST_UNSUPPORTED(".word 0xe060f291 @ mls r0, r1, r2, pc")
377#endif
378
379 TEST_UNSUPPORTED(".word 0xe0700090 @ undef")
380 TEST_UNSUPPORTED(".word 0xe07fff9f @ undef")
381
382 TEST_RR( "umull r0, r1, r",2, VAL1,", r",3, VAL2,"")
383 TEST_RR( "umullls r7, r8, r",9, VAL2,", r",10, VAL1,"")
384 TEST_R( "umull lr, r12, r",11,VAL3,", r13")
385 TEST_UNSUPPORTED(".word 0xe081f392 @ umull pc, r1, r2, r3")
386 TEST_UNSUPPORTED(".word 0xe08f1392 @ umull r1, pc, r2, r3")
387 TEST_RR( "umulls r0, r1, r",2, VAL1,", r",3, VAL2,"")
388 TEST_RR( "umulllss r7, r8, r",9, VAL2,", r",10, VAL1,"")
389 TEST_R( "umulls lr, r12, r",11,VAL3,", r13")
390 TEST_UNSUPPORTED(".word 0xe091f392 @ umulls pc, r1, r2, r3")
391 TEST_UNSUPPORTED(".word 0xe09f1392 @ umulls r1, pc, r2, r3")
392
393 TEST_RRRR( "umlal r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
394 TEST_RRRR( "umlalle r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
395 TEST_RRR( "umlal r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
396 TEST_UNSUPPORTED(".word 0xe0af1392 @ umlal pc, r1, r2, r3")
397 TEST_UNSUPPORTED(".word 0xe0a1f392 @ umlal r1, pc, r2, r3")
398 TEST_RRRR( "umlals r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
399 TEST_RRRR( "umlalles r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
400 TEST_RRR( "umlals r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
401 TEST_UNSUPPORTED(".word 0xe0bf1392 @ umlals pc, r1, r2, r3")
402 TEST_UNSUPPORTED(".word 0xe0b1f392 @ umlals r1, pc, r2, r3")
403
404 TEST_RR( "smull r0, r1, r",2, VAL1,", r",3, VAL2,"")
405 TEST_RR( "smullls r7, r8, r",9, VAL2,", r",10, VAL1,"")
406 TEST_R( "smull lr, r12, r",11,VAL3,", r13")
407 TEST_UNSUPPORTED(".word 0xe0c1f392 @ smull pc, r1, r2, r3")
408 TEST_UNSUPPORTED(".word 0xe0cf1392 @ smull r1, pc, r2, r3")
409 TEST_RR( "smulls r0, r1, r",2, VAL1,", r",3, VAL2,"")
410 TEST_RR( "smulllss r7, r8, r",9, VAL2,", r",10, VAL1,"")
411 TEST_R( "smulls lr, r12, r",11,VAL3,", r13")
412 TEST_UNSUPPORTED(".word 0xe0d1f392 @ smulls pc, r1, r2, r3")
413 TEST_UNSUPPORTED(".word 0xe0df1392 @ smulls r1, pc, r2, r3")
414
415 TEST_RRRR( "smlal r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
416 TEST_RRRR( "smlalle r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
417 TEST_RRR( "smlal r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
418 TEST_UNSUPPORTED(".word 0xe0ef1392 @ smlal pc, r1, r2, r3")
419 TEST_UNSUPPORTED(".word 0xe0e1f392 @ smlal r1, pc, r2, r3")
420 TEST_RRRR( "smlals r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
421 TEST_RRRR( "smlalles r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
422 TEST_RRR( "smlals r",14,VAL3,", r",7, VAL4,", r",5, VAL1,", r13")
423 TEST_UNSUPPORTED(".word 0xe0ff1392 @ smlals pc, r1, r2, r3")
424 TEST_UNSUPPORTED(".word 0xe0f0f392 @ smlals r0, pc, r2, r3")
425 TEST_UNSUPPORTED(".word 0xe0f0139f @ smlals r0, r1, pc, r3")
426 TEST_UNSUPPORTED(".word 0xe0f01f92 @ smlals r0, r1, r2, pc")
427
428 TEST_GROUP("Synchronization primitives")
429
430 /*
431 * Use hard coded constants for SWP instructions to avoid warnings
432 * about deprecated instructions.
433 */
434 TEST_RP( ".word 0xe108e097 @ swp lr, r",7,VAL2,", [r",8,0,"]")
435 TEST_R( ".word 0x610d0091 @ swpvs r0, r",1,VAL1,", [sp]")
436 TEST_RP( ".word 0xe10cd09e @ swp sp, r",14,VAL2,", [r",12,13*4,"]")
437 TEST_UNSUPPORTED(".word 0xe102f091 @ swp pc, r1, [r2]")
438 TEST_UNSUPPORTED(".word 0xe102009f @ swp r0, pc, [r2]")
439 TEST_UNSUPPORTED(".word 0xe10f0091 @ swp r0, r1, [pc]")
440 TEST_RP( ".word 0xe148e097 @ swpb lr, r",7,VAL2,", [r",8,0,"]")
441 TEST_R( ".word 0x614d0091 @ swpvsb r0, r",1,VAL1,", [sp]")
442 TEST_UNSUPPORTED(".word 0xe142f091 @ swpb pc, r1, [r2]")
443
444 TEST_UNSUPPORTED(".word 0xe1100090") /* Unallocated space */
445 TEST_UNSUPPORTED(".word 0xe1200090") /* Unallocated space */
446 TEST_UNSUPPORTED(".word 0xe1300090") /* Unallocated space */
447 TEST_UNSUPPORTED(".word 0xe1500090") /* Unallocated space */
448 TEST_UNSUPPORTED(".word 0xe1600090") /* Unallocated space */
449 TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
450#if __LINUX_ARM_ARCH__ >= 6
451 TEST_UNSUPPORTED("ldrex r2, [sp]")
452 TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
453 TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
454 TEST_UNSUPPORTED("strexb r0, r2, [sp]")
455 TEST_UNSUPPORTED("ldrexb r2, [sp]")
456 TEST_UNSUPPORTED("strexh r0, r2, [sp]")
457 TEST_UNSUPPORTED("ldrexh r2, [sp]")
458#endif
459 TEST_GROUP("Extra load/store instructions")
460
461 TEST_RPR( "strh r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
462 TEST_RPR( "streqh r",14,VAL2,", [r",13,0, ", r",12, 48,"]")
463 TEST_RPR( "strh r",1, VAL1,", [r",2, 24,", r",3, 48,"]!")
464 TEST_RPR( "strneh r",12,VAL2,", [r",11,48,", -r",10,24,"]!")
465 TEST_RPR( "strh r",2, VAL1,", [r",3, 24,"], r",4, 48,"")
466 TEST_RPR( "strh r",10,VAL2,", [r",9, 48,"], -r",11,24,"")
467 TEST_UNSUPPORTED(".word 0xe1afc0ba @ strh r12, [pc, r10]!")
468 TEST_UNSUPPORTED(".word 0xe089f0bb @ strh pc, [r9], r11")
469 TEST_UNSUPPORTED(".word 0xe089a0bf @ strh r10, [r9], pc")
470
471 TEST_PR( "ldrh r0, [r",0, 48,", -r",2, 24,"]")
472 TEST_PR( "ldrcsh r14, [r",13,0, ", r",12, 48,"]")
473 TEST_PR( "ldrh r1, [r",2, 24,", r",3, 48,"]!")
474 TEST_PR( "ldrcch r12, [r",11,48,", -r",10,24,"]!")
475 TEST_PR( "ldrh r2, [r",3, 24,"], r",4, 48,"")
476 TEST_PR( "ldrh r10, [r",9, 48,"], -r",11,24,"")
477 TEST_UNSUPPORTED(".word 0xe1bfc0ba @ ldrh r12, [pc, r10]!")
478 TEST_UNSUPPORTED(".word 0xe099f0bb @ ldrh pc, [r9], r11")
479 TEST_UNSUPPORTED(".word 0xe099a0bf @ ldrh r10, [r9], pc")
480
481 TEST_RP( "strh r",0, VAL1,", [r",1, 24,", #-2]")
482 TEST_RP( "strmih r",14,VAL2,", [r",13,0, ", #2]")
483 TEST_RP( "strh r",1, VAL1,", [r",2, 24,", #4]!")
484 TEST_RP( "strplh r",12,VAL2,", [r",11,24,", #-4]!")
485 TEST_RP( "strh r",2, VAL1,", [r",3, 24,"], #48")
486 TEST_RP( "strh r",10,VAL2,", [r",9, 64,"], #-48")
487 TEST_UNSUPPORTED(".word 0xe1efc3b0 @ strh r12, [pc, #48]!")
488 TEST_UNSUPPORTED(".word 0xe0c9f3b0 @ strh pc, [r9], #48")
489
490 TEST_P( "ldrh r0, [r",0, 24,", #-2]")
491 TEST_P( "ldrvsh r14, [r",13,0, ", #2]")
492 TEST_P( "ldrh r1, [r",2, 24,", #4]!")
493 TEST_P( "ldrvch r12, [r",11,24,", #-4]!")
494 TEST_P( "ldrh r2, [r",3, 24,"], #48")
495 TEST_P( "ldrh r10, [r",9, 64,"], #-48")
496 TEST( "ldrh r0, [pc, #0]")
497 TEST_UNSUPPORTED(".word 0xe1ffc3b0 @ ldrh r12, [pc, #48]!")
498 TEST_UNSUPPORTED(".word 0xe0d9f3b0 @ ldrh pc, [r9], #48")
499
500 TEST_PR( "ldrsb r0, [r",0, 48,", -r",2, 24,"]")
501 TEST_PR( "ldrhisb r14, [r",13,0,", r",12, 48,"]")
502 TEST_PR( "ldrsb r1, [r",2, 24,", r",3, 48,"]!")
503 TEST_PR( "ldrlssb r12, [r",11,48,", -r",10,24,"]!")
504 TEST_PR( "ldrsb r2, [r",3, 24,"], r",4, 48,"")
505 TEST_PR( "ldrsb r10, [r",9, 48,"], -r",11,24,"")
506 TEST_UNSUPPORTED(".word 0xe1bfc0da @ ldrsb r12, [pc, r10]!")
507 TEST_UNSUPPORTED(".word 0xe099f0db @ ldrsb pc, [r9], r11")
508
509 TEST_P( "ldrsb r0, [r",0, 24,", #-1]")
510 TEST_P( "ldrgesb r14, [r",13,0, ", #1]")
511 TEST_P( "ldrsb r1, [r",2, 24,", #4]!")
512 TEST_P( "ldrltsb r12, [r",11,24,", #-4]!")
513 TEST_P( "ldrsb r2, [r",3, 24,"], #48")
514 TEST_P( "ldrsb r10, [r",9, 64,"], #-48")
515 TEST( "ldrsb r0, [pc, #0]")
516 TEST_UNSUPPORTED(".word 0xe1ffc3d0 @ ldrsb r12, [pc, #48]!")
517 TEST_UNSUPPORTED(".word 0xe0d9f3d0 @ ldrsb pc, [r9], #48")
518
519 TEST_PR( "ldrsh r0, [r",0, 48,", -r",2, 24,"]")
520 TEST_PR( "ldrgtsh r14, [r",13,0, ", r",12, 48,"]")
521 TEST_PR( "ldrsh r1, [r",2, 24,", r",3, 48,"]!")
522 TEST_PR( "ldrlesh r12, [r",11,48,", -r",10,24,"]!")
523 TEST_PR( "ldrsh r2, [r",3, 24,"], r",4, 48,"")
524 TEST_PR( "ldrsh r10, [r",9, 48,"], -r",11,24,"")
525 TEST_UNSUPPORTED(".word 0xe1bfc0fa @ ldrsh r12, [pc, r10]!")
526 TEST_UNSUPPORTED(".word 0xe099f0fb @ ldrsh pc, [r9], r11")
527
528 TEST_P( "ldrsh r0, [r",0, 24,", #-1]")
529 TEST_P( "ldreqsh r14, [r",13,0 ,", #1]")
530 TEST_P( "ldrsh r1, [r",2, 24,", #4]!")
531 TEST_P( "ldrnesh r12, [r",11,24,", #-4]!")
532 TEST_P( "ldrsh r2, [r",3, 24,"], #48")
533 TEST_P( "ldrsh r10, [r",9, 64,"], #-48")
534 TEST( "ldrsh r0, [pc, #0]")
535 TEST_UNSUPPORTED(".word 0xe1ffc3f0 @ ldrsh r12, [pc, #48]!")
536 TEST_UNSUPPORTED(".word 0xe0d9f3f0 @ ldrsh pc, [r9], #48")
537
538#if __LINUX_ARM_ARCH__ >= 7
539 TEST_UNSUPPORTED("strht r1, [r2], r3")
540 TEST_UNSUPPORTED("ldrht r1, [r2], r3")
541 TEST_UNSUPPORTED("strht r1, [r2], #48")
542 TEST_UNSUPPORTED("ldrht r1, [r2], #48")
543 TEST_UNSUPPORTED("ldrsbt r1, [r2], r3")
544 TEST_UNSUPPORTED("ldrsbt r1, [r2], #48")
545 TEST_UNSUPPORTED("ldrsht r1, [r2], r3")
546 TEST_UNSUPPORTED("ldrsht r1, [r2], #48")
547#endif
548
549 TEST_RPR( "strd r",0, VAL1,", [r",1, 48,", -r",2,24,"]")
550 TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]")
551 TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!")
552 TEST_RPR( "strcsd r",12,VAL2,", [r",11,48,", -r",10,24,"]!")
553 TEST_RPR( "strd r",2, VAL1,", [r",3, 24,"], r",4,48,"")
554 TEST_RPR( "strd r",10,VAL2,", [r",9, 48,"], -r",7,24,"")
555 TEST_UNSUPPORTED(".word 0xe1afc0fa @ strd r12, [pc, r10]!")
556
557 TEST_PR( "ldrd r0, [r",0, 48,", -r",2,24,"]")
558 TEST_PR( "ldrmid r8, [r",13,0, ", r",12,48,"]")
559 TEST_PR( "ldrd r4, [r",2, 24,", r",3, 48,"]!")
560 TEST_PR( "ldrpld r6, [r",11,48,", -r",10,24,"]!")
561 TEST_PR( "ldrd r2, [r",5, 24,"], r",4,48,"")
562 TEST_PR( "ldrd r10, [r",9,48,"], -r",7,24,"")
563 TEST_UNSUPPORTED(".word 0xe1afc0da @ ldrd r12, [pc, r10]!")
564 TEST_UNSUPPORTED(".word 0xe089f0db @ ldrd pc, [r9], r11")
565 TEST_UNSUPPORTED(".word 0xe089e0db @ ldrd lr, [r9], r11")
566 TEST_UNSUPPORTED(".word 0xe089c0df @ ldrd r12, [r9], pc")
567
568 TEST_RP( "strd r",0, VAL1,", [r",1, 24,", #-8]")
569 TEST_RP( "strvsd r",8, VAL2,", [r",13,0, ", #8]")
570 TEST_RP( "strd r",4, VAL1,", [r",2, 24,", #16]!")
571 TEST_RP( "strvcd r",12,VAL2,", [r",11,24,", #-16]!")
572 TEST_RP( "strd r",2, VAL1,", [r",4, 24,"], #48")
573 TEST_RP( "strd r",10,VAL2,", [r",9, 64,"], #-48")
574 TEST_UNSUPPORTED(".word 0xe1efc3f0 @ strd r12, [pc, #48]!")
575
576 TEST_P( "ldrd r0, [r",0, 24,", #-8]")
577 TEST_P( "ldrhid r8, [r",13,0, ", #8]")
578 TEST_P( "ldrd r4, [r",2, 24,", #16]!")
579 TEST_P( "ldrlsd r6, [r",11,24,", #-16]!")
580 TEST_P( "ldrd r2, [r",5, 24,"], #48")
581 TEST_P( "ldrd r10, [r",9,6,"], #-48")
582 TEST_UNSUPPORTED(".word 0xe1efc3d0 @ ldrd r12, [pc, #48]!")
583 TEST_UNSUPPORTED(".word 0xe0c9f3d0 @ ldrd pc, [r9], #48")
584 TEST_UNSUPPORTED(".word 0xe0c9e3d0 @ ldrd lr, [r9], #48")
585
586 TEST_GROUP("Miscellaneous")
587
588#if __LINUX_ARM_ARCH__ >= 7
589 TEST("movw r0, #0")
590 TEST("movw r0, #0xffff")
591 TEST("movw lr, #0xffff")
592 TEST_UNSUPPORTED(".word 0xe300f000 @ movw pc, #0")
593 TEST_R("movt r",0, VAL1,", #0")
594 TEST_R("movt r",0, VAL2,", #0xffff")
595 TEST_R("movt r",14,VAL1,", #0xffff")
596 TEST_UNSUPPORTED(".word 0xe340f000 @ movt pc, #0")
597#endif
598
599 TEST_UNSUPPORTED("msr cpsr, 0x13")
600 TEST_UNSUPPORTED("msr cpsr_f, 0xf0000000")
601 TEST_UNSUPPORTED("msr spsr, 0x13")
602
603#if __LINUX_ARM_ARCH__ >= 7
604 TEST_SUPPORTED("yield")
605 TEST("sev")
606 TEST("nop")
607 TEST("wfi")
608 TEST_SUPPORTED("wfe")
609 TEST_UNSUPPORTED("dbg #0")
610#endif
611
612 TEST_GROUP("Load/store word and unsigned byte")
613
614#define LOAD_STORE(byte) \
615 TEST_RP( "str"byte" r",0, VAL1,", [r",1, 24,", #-2]") \
616 TEST_RP( "str"byte" r",14,VAL2,", [r",13,0, ", #2]") \
617 TEST_RP( "str"byte" r",1, VAL1,", [r",2, 24,", #4]!") \
618 TEST_RP( "str"byte" r",12,VAL2,", [r",11,24,", #-4]!") \
619 TEST_RP( "str"byte" r",2, VAL1,", [r",3, 24,"], #48") \
620 TEST_RP( "str"byte" r",10,VAL2,", [r",9, 64,"], #-48") \
621 TEST_RPR("str"byte" r",0, VAL1,", [r",1, 48,", -r",2, 24,"]") \
622 TEST_RPR("str"byte" r",14,VAL2,", [r",13,0, ", r",12, 48,"]") \
623 TEST_RPR("str"byte" r",1, VAL1,", [r",2, 24,", r",3, 48,"]!") \
624 TEST_RPR("str"byte" r",12,VAL2,", [r",11,48,", -r",10,24,"]!") \
625 TEST_RPR("str"byte" r",2, VAL1,", [r",3, 24,"], r",4, 48,"") \
626 TEST_RPR("str"byte" r",10,VAL2,", [r",9, 48,"], -r",11,24,"") \
627 TEST_RPR("str"byte" r",0, VAL1,", [r",1, 24,", r",2, 32,", asl #1]")\
628 TEST_RPR("str"byte" r",14,VAL2,", [r",13,0, ", r",12, 32,", lsr #2]")\
629 TEST_RPR("str"byte" r",1, VAL1,", [r",2, 24,", r",3, 32,", asr #3]!")\
630 TEST_RPR("str"byte" r",12,VAL2,", [r",11,24,", r",10, 4,", ror #31]!")\
631 TEST_P( "ldr"byte" r0, [r",0, 24,", #-2]") \
632 TEST_P( "ldr"byte" r14, [r",13,0, ", #2]") \
633 TEST_P( "ldr"byte" r1, [r",2, 24,", #4]!") \
634 TEST_P( "ldr"byte" r12, [r",11,24,", #-4]!") \
635 TEST_P( "ldr"byte" r2, [r",3, 24,"], #48") \
636 TEST_P( "ldr"byte" r10, [r",9, 64,"], #-48") \
637 TEST_PR( "ldr"byte" r0, [r",0, 48,", -r",2, 24,"]") \
638 TEST_PR( "ldr"byte" r14, [r",13,0, ", r",12, 48,"]") \
639 TEST_PR( "ldr"byte" r1, [r",2, 24,", r",3, 48,"]!") \
640 TEST_PR( "ldr"byte" r12, [r",11,48,", -r",10,24,"]!") \
641 TEST_PR( "ldr"byte" r2, [r",3, 24,"], r",4, 48,"") \
642 TEST_PR( "ldr"byte" r10, [r",9, 48,"], -r",11,24,"") \
643 TEST_PR( "ldr"byte" r0, [r",0, 24,", r",2, 32,", asl #1]") \
644 TEST_PR( "ldr"byte" r14, [r",13,0, ", r",12, 32,", lsr #2]") \
645 TEST_PR( "ldr"byte" r1, [r",2, 24,", r",3, 32,", asr #3]!") \
646 TEST_PR( "ldr"byte" r12, [r",11,24,", r",10, 4,", ror #31]!") \
647 TEST( "ldr"byte" r0, [pc, #0]") \
648 TEST_R( "ldr"byte" r12, [pc, r",14,0,"]")
649
650 LOAD_STORE("")
651 TEST_P( "str pc, [r",0,0,", #15*4]")
652 TEST_R( "str pc, [sp, r",2,15*4,"]")
653 TEST_BF( "ldr pc, [sp, #15*4]")
654 TEST_BF_R("ldr pc, [sp, r",2,15*4,"]")
655
656 TEST_P( "str sp, [r",0,0,", #13*4]")
657 TEST_R( "str sp, [sp, r",2,13*4,"]")
658 TEST_BF( "ldr sp, [sp, #13*4]")
659 TEST_BF_R("ldr sp, [sp, r",2,13*4,"]")
660
661#ifdef CONFIG_THUMB2_KERNEL
662 TEST_ARM_TO_THUMB_INTERWORK_P("ldr pc, [r",0,0,", #15*4]")
663#endif
664 TEST_UNSUPPORTED(".word 0xe5af6008 @ str r6, [pc, #8]!")
665 TEST_UNSUPPORTED(".word 0xe7af6008 @ str r6, [pc, r8]!")
666 TEST_UNSUPPORTED(".word 0xe5bf6008 @ ldr r6, [pc, #8]!")
667 TEST_UNSUPPORTED(".word 0xe7bf6008 @ ldr r6, [pc, r8]!")
668 TEST_UNSUPPORTED(".word 0xe788600f @ str r6, [r8, pc]")
669 TEST_UNSUPPORTED(".word 0xe798600f @ ldr r6, [r8, pc]")
670
671 LOAD_STORE("b")
672 TEST_UNSUPPORTED(".word 0xe5f7f008 @ ldrb pc, [r7, #8]!")
673 TEST_UNSUPPORTED(".word 0xe7f7f008 @ ldrb pc, [r7, r8]!")
674 TEST_UNSUPPORTED(".word 0xe5ef6008 @ strb r6, [pc, #8]!")
675 TEST_UNSUPPORTED(".word 0xe7ef6008 @ strb r6, [pc, r3]!")
676 TEST_UNSUPPORTED(".word 0xe5ff6008 @ ldrb r6, [pc, #8]!")
677 TEST_UNSUPPORTED(".word 0xe7ff6008 @ ldrb r6, [pc, r3]!")
678
679 TEST_UNSUPPORTED("ldrt r0, [r1], #4")
680 TEST_UNSUPPORTED("ldrt r1, [r2], r3")
681 TEST_UNSUPPORTED("strt r2, [r3], #4")
682 TEST_UNSUPPORTED("strt r3, [r4], r5")
683 TEST_UNSUPPORTED("ldrbt r4, [r5], #4")
684 TEST_UNSUPPORTED("ldrbt r5, [r6], r7")
685 TEST_UNSUPPORTED("strbt r6, [r7], #4")
686 TEST_UNSUPPORTED("strbt r7, [r8], r9")
687
688#if __LINUX_ARM_ARCH__ >= 7
689 TEST_GROUP("Parallel addition and subtraction, signed")
690
691 TEST_UNSUPPORTED(".word 0xe6000010") /* Unallocated space */
692 TEST_UNSUPPORTED(".word 0xe60fffff") /* Unallocated space */
693
694 TEST_RR( "sadd16 r0, r",0, HH1,", r",1, HH2,"")
695 TEST_RR( "sadd16 r14, r",12,HH2,", r",10,HH1,"")
696 TEST_UNSUPPORTED(".word 0xe61cff1a @ sadd16 pc, r12, r10")
697 TEST_RR( "sasx r0, r",0, HH1,", r",1, HH2,"")
698 TEST_RR( "sasx r14, r",12,HH2,", r",10,HH1,"")
699 TEST_UNSUPPORTED(".word 0xe61cff3a @ sasx pc, r12, r10")
700 TEST_RR( "ssax r0, r",0, HH1,", r",1, HH2,"")
701 TEST_RR( "ssax r14, r",12,HH2,", r",10,HH1,"")
702 TEST_UNSUPPORTED(".word 0xe61cff5a @ ssax pc, r12, r10")
703 TEST_RR( "ssub16 r0, r",0, HH1,", r",1, HH2,"")
704 TEST_RR( "ssub16 r14, r",12,HH2,", r",10,HH1,"")
705 TEST_UNSUPPORTED(".word 0xe61cff7a @ ssub16 pc, r12, r10")
706 TEST_RR( "sadd8 r0, r",0, HH1,", r",1, HH2,"")
707 TEST_RR( "sadd8 r14, r",12,HH2,", r",10,HH1,"")
708 TEST_UNSUPPORTED(".word 0xe61cff9a @ sadd8 pc, r12, r10")
709 TEST_UNSUPPORTED(".word 0xe61000b0") /* Unallocated space */
710 TEST_UNSUPPORTED(".word 0xe61fffbf") /* Unallocated space */
711 TEST_UNSUPPORTED(".word 0xe61000d0") /* Unallocated space */
712 TEST_UNSUPPORTED(".word 0xe61fffdf") /* Unallocated space */
713 TEST_RR( "ssub8 r0, r",0, HH1,", r",1, HH2,"")
714 TEST_RR( "ssub8 r14, r",12,HH2,", r",10,HH1,"")
715 TEST_UNSUPPORTED(".word 0xe61cfffa @ ssub8 pc, r12, r10")
716
717 TEST_RR( "qadd16 r0, r",0, HH1,", r",1, HH2,"")
718 TEST_RR( "qadd16 r14, r",12,HH2,", r",10,HH1,"")
719 TEST_UNSUPPORTED(".word 0xe62cff1a @ qadd16 pc, r12, r10")
720 TEST_RR( "qasx r0, r",0, HH1,", r",1, HH2,"")
721 TEST_RR( "qasx r14, r",12,HH2,", r",10,HH1,"")
722 TEST_UNSUPPORTED(".word 0xe62cff3a @ qasx pc, r12, r10")
723 TEST_RR( "qsax r0, r",0, HH1,", r",1, HH2,"")
724 TEST_RR( "qsax r14, r",12,HH2,", r",10,HH1,"")
725 TEST_UNSUPPORTED(".word 0xe62cff5a @ qsax pc, r12, r10")
726 TEST_RR( "qsub16 r0, r",0, HH1,", r",1, HH2,"")
727 TEST_RR( "qsub16 r14, r",12,HH2,", r",10,HH1,"")
728 TEST_UNSUPPORTED(".word 0xe62cff7a @ qsub16 pc, r12, r10")
729 TEST_RR( "qadd8 r0, r",0, HH1,", r",1, HH2,"")
730 TEST_RR( "qadd8 r14, r",12,HH2,", r",10,HH1,"")
731 TEST_UNSUPPORTED(".word 0xe62cff9a @ qadd8 pc, r12, r10")
732 TEST_UNSUPPORTED(".word 0xe62000b0") /* Unallocated space */
733 TEST_UNSUPPORTED(".word 0xe62fffbf") /* Unallocated space */
734 TEST_UNSUPPORTED(".word 0xe62000d0") /* Unallocated space */
735 TEST_UNSUPPORTED(".word 0xe62fffdf") /* Unallocated space */
736 TEST_RR( "qsub8 r0, r",0, HH1,", r",1, HH2,"")
737 TEST_RR( "qsub8 r14, r",12,HH2,", r",10,HH1,"")
738 TEST_UNSUPPORTED(".word 0xe62cfffa @ qsub8 pc, r12, r10")
739
740 TEST_RR( "shadd16 r0, r",0, HH1,", r",1, HH2,"")
741 TEST_RR( "shadd16 r14, r",12,HH2,", r",10,HH1,"")
742 TEST_UNSUPPORTED(".word 0xe63cff1a @ shadd16 pc, r12, r10")
743 TEST_RR( "shasx r0, r",0, HH1,", r",1, HH2,"")
744 TEST_RR( "shasx r14, r",12,HH2,", r",10,HH1,"")
745 TEST_UNSUPPORTED(".word 0xe63cff3a @ shasx pc, r12, r10")
746 TEST_RR( "shsax r0, r",0, HH1,", r",1, HH2,"")
747 TEST_RR( "shsax r14, r",12,HH2,", r",10,HH1,"")
748 TEST_UNSUPPORTED(".word 0xe63cff5a @ shsax pc, r12, r10")
749 TEST_RR( "shsub16 r0, r",0, HH1,", r",1, HH2,"")
750 TEST_RR( "shsub16 r14, r",12,HH2,", r",10,HH1,"")
751 TEST_UNSUPPORTED(".word 0xe63cff7a @ shsub16 pc, r12, r10")
752 TEST_RR( "shadd8 r0, r",0, HH1,", r",1, HH2,"")
753 TEST_RR( "shadd8 r14, r",12,HH2,", r",10,HH1,"")
754 TEST_UNSUPPORTED(".word 0xe63cff9a @ shadd8 pc, r12, r10")
755 TEST_UNSUPPORTED(".word 0xe63000b0") /* Unallocated space */
756 TEST_UNSUPPORTED(".word 0xe63fffbf") /* Unallocated space */
757 TEST_UNSUPPORTED(".word 0xe63000d0") /* Unallocated space */
758 TEST_UNSUPPORTED(".word 0xe63fffdf") /* Unallocated space */
759 TEST_RR( "shsub8 r0, r",0, HH1,", r",1, HH2,"")
760 TEST_RR( "shsub8 r14, r",12,HH2,", r",10,HH1,"")
761 TEST_UNSUPPORTED(".word 0xe63cfffa @ shsub8 pc, r12, r10")
762
763 TEST_GROUP("Parallel addition and subtraction, unsigned")
764
765 TEST_UNSUPPORTED(".word 0xe6400010") /* Unallocated space */
766 TEST_UNSUPPORTED(".word 0xe64fffff") /* Unallocated space */
767
768 TEST_RR( "uadd16 r0, r",0, HH1,", r",1, HH2,"")
769 TEST_RR( "uadd16 r14, r",12,HH2,", r",10,HH1,"")
770 TEST_UNSUPPORTED(".word 0xe65cff1a @ uadd16 pc, r12, r10")
771 TEST_RR( "uasx r0, r",0, HH1,", r",1, HH2,"")
772 TEST_RR( "uasx r14, r",12,HH2,", r",10,HH1,"")
773 TEST_UNSUPPORTED(".word 0xe65cff3a @ uasx pc, r12, r10")
774 TEST_RR( "usax r0, r",0, HH1,", r",1, HH2,"")
775 TEST_RR( "usax r14, r",12,HH2,", r",10,HH1,"")
776 TEST_UNSUPPORTED(".word 0xe65cff5a @ usax pc, r12, r10")
777 TEST_RR( "usub16 r0, r",0, HH1,", r",1, HH2,"")
778 TEST_RR( "usub16 r14, r",12,HH2,", r",10,HH1,"")
779 TEST_UNSUPPORTED(".word 0xe65cff7a @ usub16 pc, r12, r10")
780 TEST_RR( "uadd8 r0, r",0, HH1,", r",1, HH2,"")
781 TEST_RR( "uadd8 r14, r",12,HH2,", r",10,HH1,"")
782 TEST_UNSUPPORTED(".word 0xe65cff9a @ uadd8 pc, r12, r10")
783 TEST_UNSUPPORTED(".word 0xe65000b0") /* Unallocated space */
784 TEST_UNSUPPORTED(".word 0xe65fffbf") /* Unallocated space */
785 TEST_UNSUPPORTED(".word 0xe65000d0") /* Unallocated space */
786 TEST_UNSUPPORTED(".word 0xe65fffdf") /* Unallocated space */
787 TEST_RR( "usub8 r0, r",0, HH1,", r",1, HH2,"")
788 TEST_RR( "usub8 r14, r",12,HH2,", r",10,HH1,"")
789 TEST_UNSUPPORTED(".word 0xe65cfffa @ usub8 pc, r12, r10")
790
791 TEST_RR( "uqadd16 r0, r",0, HH1,", r",1, HH2,"")
792 TEST_RR( "uqadd16 r14, r",12,HH2,", r",10,HH1,"")
793 TEST_UNSUPPORTED(".word 0xe66cff1a @ uqadd16 pc, r12, r10")
794 TEST_RR( "uqasx r0, r",0, HH1,", r",1, HH2,"")
795 TEST_RR( "uqasx r14, r",12,HH2,", r",10,HH1,"")
796 TEST_UNSUPPORTED(".word 0xe66cff3a @ uqasx pc, r12, r10")
797 TEST_RR( "uqsax r0, r",0, HH1,", r",1, HH2,"")
798 TEST_RR( "uqsax r14, r",12,HH2,", r",10,HH1,"")
799 TEST_UNSUPPORTED(".word 0xe66cff5a @ uqsax pc, r12, r10")
800 TEST_RR( "uqsub16 r0, r",0, HH1,", r",1, HH2,"")
801 TEST_RR( "uqsub16 r14, r",12,HH2,", r",10,HH1,"")
802 TEST_UNSUPPORTED(".word 0xe66cff7a @ uqsub16 pc, r12, r10")
803 TEST_RR( "uqadd8 r0, r",0, HH1,", r",1, HH2,"")
804 TEST_RR( "uqadd8 r14, r",12,HH2,", r",10,HH1,"")
805 TEST_UNSUPPORTED(".word 0xe66cff9a @ uqadd8 pc, r12, r10")
806 TEST_UNSUPPORTED(".word 0xe66000b0") /* Unallocated space */
807 TEST_UNSUPPORTED(".word 0xe66fffbf") /* Unallocated space */
808 TEST_UNSUPPORTED(".word 0xe66000d0") /* Unallocated space */
809 TEST_UNSUPPORTED(".word 0xe66fffdf") /* Unallocated space */
810 TEST_RR( "uqsub8 r0, r",0, HH1,", r",1, HH2,"")
811 TEST_RR( "uqsub8 r14, r",12,HH2,", r",10,HH1,"")
812 TEST_UNSUPPORTED(".word 0xe66cfffa @ uqsub8 pc, r12, r10")
813
814 TEST_RR( "uhadd16 r0, r",0, HH1,", r",1, HH2,"")
815 TEST_RR( "uhadd16 r14, r",12,HH2,", r",10,HH1,"")
816 TEST_UNSUPPORTED(".word 0xe67cff1a @ uhadd16 pc, r12, r10")
817 TEST_RR( "uhasx r0, r",0, HH1,", r",1, HH2,"")
818 TEST_RR( "uhasx r14, r",12,HH2,", r",10,HH1,"")
819 TEST_UNSUPPORTED(".word 0xe67cff3a @ uhasx pc, r12, r10")
820 TEST_RR( "uhsax r0, r",0, HH1,", r",1, HH2,"")
821 TEST_RR( "uhsax r14, r",12,HH2,", r",10,HH1,"")
822 TEST_UNSUPPORTED(".word 0xe67cff5a @ uhsax pc, r12, r10")
823 TEST_RR( "uhsub16 r0, r",0, HH1,", r",1, HH2,"")
824 TEST_RR( "uhsub16 r14, r",12,HH2,", r",10,HH1,"")
825 TEST_UNSUPPORTED(".word 0xe67cff7a @ uhsub16 pc, r12, r10")
826 TEST_RR( "uhadd8 r0, r",0, HH1,", r",1, HH2,"")
827 TEST_RR( "uhadd8 r14, r",12,HH2,", r",10,HH1,"")
828 TEST_UNSUPPORTED(".word 0xe67cff9a @ uhadd8 pc, r12, r10")
829 TEST_UNSUPPORTED(".word 0xe67000b0") /* Unallocated space */
830 TEST_UNSUPPORTED(".word 0xe67fffbf") /* Unallocated space */
831 TEST_UNSUPPORTED(".word 0xe67000d0") /* Unallocated space */
832 TEST_UNSUPPORTED(".word 0xe67fffdf") /* Unallocated space */
833 TEST_RR( "uhsub8 r0, r",0, HH1,", r",1, HH2,"")
834 TEST_RR( "uhsub8 r14, r",12,HH2,", r",10,HH1,"")
835 TEST_UNSUPPORTED(".word 0xe67cfffa @ uhsub8 pc, r12, r10")
836 TEST_UNSUPPORTED(".word 0xe67feffa @ uhsub8 r14, pc, r10")
837 TEST_UNSUPPORTED(".word 0xe67cefff @ uhsub8 r14, r12, pc")
838#endif /* __LINUX_ARM_ARCH__ >= 7 */
839
840#if __LINUX_ARM_ARCH__ >= 6
841 TEST_GROUP("Packing, unpacking, saturation, and reversal")
842
843 TEST_RR( "pkhbt r0, r",0, HH1,", r",1, HH2,"")
844 TEST_RR( "pkhbt r14,r",12, HH1,", r",10,HH2,", lsl #2")
845 TEST_UNSUPPORTED(".word 0xe68cf11a @ pkhbt pc, r12, r10, lsl #2")
846 TEST_RR( "pkhtb r0, r",0, HH1,", r",1, HH2,"")
847 TEST_RR( "pkhtb r14,r",12, HH1,", r",10,HH2,", asr #2")
848 TEST_UNSUPPORTED(".word 0xe68cf15a @ pkhtb pc, r12, r10, asr #2")
849 TEST_UNSUPPORTED(".word 0xe68fe15a @ pkhtb r14, pc, r10, asr #2")
850 TEST_UNSUPPORTED(".word 0xe68ce15f @ pkhtb r14, r12, pc, asr #2")
851 TEST_UNSUPPORTED(".word 0xe6900010") /* Unallocated space */
852 TEST_UNSUPPORTED(".word 0xe69fffdf") /* Unallocated space */
853
854 TEST_R( "ssat r0, #24, r",0, VAL1,"")
855 TEST_R( "ssat r14, #24, r",12, VAL2,"")
856 TEST_R( "ssat r0, #24, r",0, VAL1,", lsl #8")
857 TEST_R( "ssat r14, #24, r",12, VAL2,", asr #8")
858 TEST_UNSUPPORTED(".word 0xe6b7f01c @ ssat pc, #24, r12")
859
860 TEST_R( "usat r0, #24, r",0, VAL1,"")
861 TEST_R( "usat r14, #24, r",12, VAL2,"")
862 TEST_R( "usat r0, #24, r",0, VAL1,", lsl #8")
863 TEST_R( "usat r14, #24, r",12, VAL2,", asr #8")
864 TEST_UNSUPPORTED(".word 0xe6f7f01c @ usat pc, #24, r12")
865
866 TEST_RR( "sxtab16 r0, r",0, HH1,", r",1, HH2,"")
867 TEST_RR( "sxtab16 r14,r",12, HH2,", r",10,HH1,", ror #8")
868 TEST_R( "sxtb16 r8, r",7, HH1,"")
869 TEST_UNSUPPORTED(".word 0xe68cf47a @ sxtab16 pc,r12, r10, ror #8")
870
871 TEST_RR( "sel r0, r",0, VAL1,", r",1, VAL2,"")
872 TEST_RR( "sel r14, r",12,VAL1,", r",10, VAL2,"")
873 TEST_UNSUPPORTED(".word 0xe68cffba @ sel pc, r12, r10")
874 TEST_UNSUPPORTED(".word 0xe68fefba @ sel r14, pc, r10")
875 TEST_UNSUPPORTED(".word 0xe68cefbf @ sel r14, r12, pc")
876
877 TEST_R( "ssat16 r0, #12, r",0, HH1,"")
878 TEST_R( "ssat16 r14, #12, r",12, HH2,"")
879 TEST_UNSUPPORTED(".word 0xe6abff3c @ ssat16 pc, #12, r12")
880
881 TEST_RR( "sxtab r0, r",0, HH1,", r",1, HH2,"")
882 TEST_RR( "sxtab r14,r",12, HH2,", r",10,HH1,", ror #8")
883 TEST_R( "sxtb r8, r",7, HH1,"")
884 TEST_UNSUPPORTED(".word 0xe6acf47a @ sxtab pc,r12, r10, ror #8")
885
886 TEST_R( "rev r0, r",0, VAL1,"")
887 TEST_R( "rev r14, r",12, VAL2,"")
888 TEST_UNSUPPORTED(".word 0xe6bfff3c @ rev pc, r12")
889
890 TEST_RR( "sxtah r0, r",0, HH1,", r",1, HH2,"")
891 TEST_RR( "sxtah r14,r",12, HH2,", r",10,HH1,", ror #8")
892 TEST_R( "sxth r8, r",7, HH1,"")
893 TEST_UNSUPPORTED(".word 0xe6bcf47a @ sxtah pc,r12, r10, ror #8")
894
895 TEST_R( "rev16 r0, r",0, VAL1,"")
896 TEST_R( "rev16 r14, r",12, VAL2,"")
897 TEST_UNSUPPORTED(".word 0xe6bfffbc @ rev16 pc, r12")
898
899 TEST_RR( "uxtab16 r0, r",0, HH1,", r",1, HH2,"")
900 TEST_RR( "uxtab16 r14,r",12, HH2,", r",10,HH1,", ror #8")
901 TEST_R( "uxtb16 r8, r",7, HH1,"")
902 TEST_UNSUPPORTED(".word 0xe6ccf47a @ uxtab16 pc,r12, r10, ror #8")
903
904 TEST_R( "usat16 r0, #12, r",0, HH1,"")
905 TEST_R( "usat16 r14, #12, r",12, HH2,"")
906 TEST_UNSUPPORTED(".word 0xe6ecff3c @ usat16 pc, #12, r12")
907 TEST_UNSUPPORTED(".word 0xe6ecef3f @ usat16 r14, #12, pc")
908
909 TEST_RR( "uxtab r0, r",0, HH1,", r",1, HH2,"")
910 TEST_RR( "uxtab r14,r",12, HH2,", r",10,HH1,", ror #8")
911 TEST_R( "uxtb r8, r",7, HH1,"")
912 TEST_UNSUPPORTED(".word 0xe6ecf47a @ uxtab pc,r12, r10, ror #8")
913
914#if __LINUX_ARM_ARCH__ >= 7
915 TEST_R( "rbit r0, r",0, VAL1,"")
916 TEST_R( "rbit r14, r",12, VAL2,"")
917 TEST_UNSUPPORTED(".word 0xe6ffff3c @ rbit pc, r12")
918#endif
919
920 TEST_RR( "uxtah r0, r",0, HH1,", r",1, HH2,"")
921 TEST_RR( "uxtah r14,r",12, HH2,", r",10,HH1,", ror #8")
922 TEST_R( "uxth r8, r",7, HH1,"")
923 TEST_UNSUPPORTED(".word 0xe6fff077 @ uxth pc, r7")
924 TEST_UNSUPPORTED(".word 0xe6ff807f @ uxth r8, pc")
925 TEST_UNSUPPORTED(".word 0xe6fcf47a @ uxtah pc, r12, r10, ror #8")
926 TEST_UNSUPPORTED(".word 0xe6fce47f @ uxtah r14, r12, pc, ror #8")
927
928 TEST_R( "revsh r0, r",0, VAL1,"")
929 TEST_R( "revsh r14, r",12, VAL2,"")
930 TEST_UNSUPPORTED(".word 0xe6ffff3c @ revsh pc, r12")
931 TEST_UNSUPPORTED(".word 0xe6ffef3f @ revsh r14, pc")
932
933 TEST_UNSUPPORTED(".word 0xe6900070") /* Unallocated space */
934 TEST_UNSUPPORTED(".word 0xe69fff7f") /* Unallocated space */
935
936 TEST_UNSUPPORTED(".word 0xe6d00070") /* Unallocated space */
937 TEST_UNSUPPORTED(".word 0xe6dfff7f") /* Unallocated space */
938#endif /* __LINUX_ARM_ARCH__ >= 6 */
939
940#if __LINUX_ARM_ARCH__ >= 6
941 TEST_GROUP("Signed multiplies")
942
943 TEST_RRR( "smlad r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
944 TEST_RRR( "smlad r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
945 TEST_UNSUPPORTED(".word 0xe70f8a1c @ smlad pc, r12, r10, r8")
946 TEST_RRR( "smladx r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
947 TEST_RRR( "smladx r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
948 TEST_UNSUPPORTED(".word 0xe70f8a3c @ smladx pc, r12, r10, r8")
949
950 TEST_RR( "smuad r0, r",0, HH1,", r",1, HH2,"")
951 TEST_RR( "smuad r14, r",12,HH2,", r",10,HH1,"")
952 TEST_UNSUPPORTED(".word 0xe70ffa1c @ smuad pc, r12, r10")
953 TEST_RR( "smuadx r0, r",0, HH1,", r",1, HH2,"")
954 TEST_RR( "smuadx r14, r",12,HH2,", r",10,HH1,"")
955 TEST_UNSUPPORTED(".word 0xe70ffa3c @ smuadx pc, r12, r10")
956
957 TEST_RRR( "smlsd r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
958 TEST_RRR( "smlsd r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
959 TEST_UNSUPPORTED(".word 0xe70f8a5c @ smlsd pc, r12, r10, r8")
960 TEST_RRR( "smlsdx r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
961 TEST_RRR( "smlsdx r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
962 TEST_UNSUPPORTED(".word 0xe70f8a7c @ smlsdx pc, r12, r10, r8")
963
964 TEST_RR( "smusd r0, r",0, HH1,", r",1, HH2,"")
965 TEST_RR( "smusd r14, r",12,HH2,", r",10,HH1,"")
966 TEST_UNSUPPORTED(".word 0xe70ffa5c @ smusd pc, r12, r10")
967 TEST_RR( "smusdx r0, r",0, HH1,", r",1, HH2,"")
968 TEST_RR( "smusdx r14, r",12,HH2,", r",10,HH1,"")
969 TEST_UNSUPPORTED(".word 0xe70ffa7c @ smusdx pc, r12, r10")
970
971 TEST_RRRR( "smlald r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
972 TEST_RRRR( "smlald r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
973 TEST_UNSUPPORTED(".word 0xe74af819 @ smlald pc, r10, r9, r8")
974 TEST_UNSUPPORTED(".word 0xe74fb819 @ smlald r11, pc, r9, r8")
975 TEST_UNSUPPORTED(".word 0xe74ab81f @ smlald r11, r10, pc, r8")
976 TEST_UNSUPPORTED(".word 0xe74abf19 @ smlald r11, r10, r9, pc")
977
978 TEST_RRRR( "smlaldx r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
979 TEST_RRRR( "smlaldx r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
980 TEST_UNSUPPORTED(".word 0xe74af839 @ smlaldx pc, r10, r9, r8")
981 TEST_UNSUPPORTED(".word 0xe74fb839 @ smlaldx r11, pc, r9, r8")
982
983 TEST_RRR( "smmla r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
984 TEST_RRR( "smmla r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
985 TEST_UNSUPPORTED(".word 0xe75f8a1c @ smmla pc, r12, r10, r8")
986 TEST_RRR( "smmlar r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
987 TEST_RRR( "smmlar r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
988 TEST_UNSUPPORTED(".word 0xe75f8a3c @ smmlar pc, r12, r10, r8")
989
990 TEST_RR( "smmul r0, r",0, VAL1,", r",1, VAL2,"")
991 TEST_RR( "smmul r14, r",12,VAL2,", r",10,VAL1,"")
992 TEST_UNSUPPORTED(".word 0xe75ffa1c @ smmul pc, r12, r10")
993 TEST_RR( "smmulr r0, r",0, VAL1,", r",1, VAL2,"")
994 TEST_RR( "smmulr r14, r",12,VAL2,", r",10,VAL1,"")
995 TEST_UNSUPPORTED(".word 0xe75ffa3c @ smmulr pc, r12, r10")
996
997 TEST_RRR( "smmls r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
998 TEST_RRR( "smmls r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
999 TEST_UNSUPPORTED(".word 0xe75f8adc @ smmls pc, r12, r10, r8")
1000 TEST_RRR( "smmlsr r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
1001 TEST_RRR( "smmlsr r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
1002 TEST_UNSUPPORTED(".word 0xe75f8afc @ smmlsr pc, r12, r10, r8")
1003 TEST_UNSUPPORTED(".word 0xe75e8aff @ smmlsr r14, pc, r10, r8")
1004 TEST_UNSUPPORTED(".word 0xe75e8ffc @ smmlsr r14, r12, pc, r8")
1005 TEST_UNSUPPORTED(".word 0xe75efafc @ smmlsr r14, r12, r10, pc")
1006
1007 TEST_RR( "usad8 r0, r",0, VAL1,", r",1, VAL2,"")
1008 TEST_RR( "usad8 r14, r",12,VAL2,", r",10,VAL1,"")
1009 TEST_UNSUPPORTED(".word 0xe75ffa1c @ usad8 pc, r12, r10")
1010 TEST_UNSUPPORTED(".word 0xe75efa1f @ usad8 r14, pc, r10")
1011 TEST_UNSUPPORTED(".word 0xe75eff1c @ usad8 r14, r12, pc")
1012
1013 TEST_RRR( "usada8 r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL3,"")
1014 TEST_RRR( "usada8 r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL3,"")
1015 TEST_UNSUPPORTED(".word 0xe78f8a1c @ usada8 pc, r12, r10, r8")
1016 TEST_UNSUPPORTED(".word 0xe78e8a1f @ usada8 r14, pc, r10, r8")
1017 TEST_UNSUPPORTED(".word 0xe78e8f1c @ usada8 r14, r12, pc, r8")
1018#endif /* __LINUX_ARM_ARCH__ >= 6 */
1019
1020#if __LINUX_ARM_ARCH__ >= 7
1021 TEST_GROUP("Bit Field")
1022
1023 TEST_R( "sbfx r0, r",0 , VAL1,", #0, #31")
1024 TEST_R( "sbfxeq r14, r",12, VAL2,", #8, #16")
1025 TEST_R( "sbfx r4, r",10, VAL1,", #16, #15")
1026 TEST_UNSUPPORTED(".word 0xe7aff45c @ sbfx pc, r12, #8, #16")
1027
1028 TEST_R( "ubfx r0, r",0 , VAL1,", #0, #31")
1029 TEST_R( "ubfxcs r14, r",12, VAL2,", #8, #16")
1030 TEST_R( "ubfx r4, r",10, VAL1,", #16, #15")
1031 TEST_UNSUPPORTED(".word 0xe7eff45c @ ubfx pc, r12, #8, #16")
1032 TEST_UNSUPPORTED(".word 0xe7efc45f @ ubfx r12, pc, #8, #16")
1033
1034 TEST_R( "bfc r",0, VAL1,", #4, #20")
1035 TEST_R( "bfcvs r",14,VAL2,", #4, #20")
1036 TEST_R( "bfc r",7, VAL1,", #0, #31")
1037 TEST_R( "bfc r",8, VAL2,", #0, #31")
1038 TEST_UNSUPPORTED(".word 0xe7def01f @ bfc pc, #0, #31");
1039
1040 TEST_RR( "bfi r",0, VAL1,", r",0 , VAL2,", #0, #31")
1041 TEST_RR( "bfipl r",12,VAL1,", r",14 , VAL2,", #4, #20")
1042 TEST_UNSUPPORTED(".word 0xe7d7f21e @ bfi pc, r14, #4, #20")
1043
1044 TEST_UNSUPPORTED(".word 0x07f000f0") /* Permanently UNDEFINED */
1045 TEST_UNSUPPORTED(".word 0x07ffffff") /* Permanently UNDEFINED */
1046#endif /* __LINUX_ARM_ARCH__ >= 6 */
1047
1048 TEST_GROUP("Branch, branch with link, and block data transfer")
1049
1050 TEST_P( "stmda r",0, 16*4,", {r0}")
1051 TEST_P( "stmeqda r",4, 16*4,", {r0-r15}")
1052 TEST_P( "stmneda r",8, 16*4,"!, {r8-r15}")
1053 TEST_P( "stmda r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1054 TEST_P( "stmda r",13,0, "!, {pc}")
1055
1056 TEST_P( "ldmda r",0, 16*4,", {r0}")
1057 TEST_BF_P("ldmcsda r",4, 15*4,", {r0-r15}")
1058 TEST_BF_P("ldmccda r",7, 15*4,"!, {r8-r15}")
1059 TEST_P( "ldmda r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1060 TEST_BF_P("ldmda r",14,15*4,"!, {pc}")
1061
1062 TEST_P( "stmia r",0, 16*4,", {r0}")
1063 TEST_P( "stmmiia r",4, 16*4,", {r0-r15}")
1064 TEST_P( "stmplia r",8, 16*4,"!, {r8-r15}")
1065 TEST_P( "stmia r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1066 TEST_P( "stmia r",14,0, "!, {pc}")
1067
1068 TEST_P( "ldmia r",0, 16*4,", {r0}")
1069 TEST_BF_P("ldmvsia r",4, 0, ", {r0-r15}")
1070 TEST_BF_P("ldmvcia r",7, 8*4, "!, {r8-r15}")
1071 TEST_P( "ldmia r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1072 TEST_BF_P("ldmia r",14,15*4,"!, {pc}")
1073
1074 TEST_P( "stmdb r",0, 16*4,", {r0}")
1075 TEST_P( "stmhidb r",4, 16*4,", {r0-r15}")
1076 TEST_P( "stmlsdb r",8, 16*4,"!, {r8-r15}")
1077 TEST_P( "stmdb r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1078 TEST_P( "stmdb r",13,4, "!, {pc}")
1079
1080 TEST_P( "ldmdb r",0, 16*4,", {r0}")
1081 TEST_BF_P("ldmgedb r",4, 16*4,", {r0-r15}")
1082 TEST_BF_P("ldmltdb r",7, 16*4,"!, {r8-r15}")
1083 TEST_P( "ldmdb r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1084 TEST_BF_P("ldmdb r",14,16*4,"!, {pc}")
1085
1086 TEST_P( "stmib r",0, 16*4,", {r0}")
1087 TEST_P( "stmgtib r",4, 16*4,", {r0-r15}")
1088 TEST_P( "stmleib r",8, 16*4,"!, {r8-r15}")
1089 TEST_P( "stmib r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1090 TEST_P( "stmib r",13,-4, "!, {pc}")
1091
1092 TEST_P( "ldmib r",0, 16*4,", {r0}")
1093 TEST_BF_P("ldmeqib r",4, -4,", {r0-r15}")
1094 TEST_BF_P("ldmneib r",7, 7*4,"!, {r8-r15}")
1095 TEST_P( "ldmib r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
1096 TEST_BF_P("ldmib r",14,14*4,"!, {pc}")
1097
1098 TEST_P( "stmdb r",13,16*4,"!, {r3-r12,lr}")
1099 TEST_P( "stmeqdb r",13,16*4,"!, {r3-r12}")
1100 TEST_P( "stmnedb r",2, 16*4,", {r3-r12,lr}")
1101 TEST_P( "stmdb r",13,16*4,"!, {r2-r12,lr}")
1102 TEST_P( "stmdb r",0, 16*4,", {r0-r12}")
1103 TEST_P( "stmdb r",0, 16*4,", {r0-r12,lr}")
1104
1105 TEST_BF_P("ldmia r",13,5*4, "!, {r3-r12,pc}")
1106 TEST_P( "ldmccia r",13,5*4, "!, {r3-r12}")
1107 TEST_BF_P("ldmcsia r",2, 5*4, "!, {r3-r12,pc}")
1108 TEST_BF_P("ldmia r",13,4*4, "!, {r2-r12,pc}")
1109 TEST_P( "ldmia r",0, 16*4,", {r0-r12}")
1110 TEST_P( "ldmia r",0, 16*4,", {r0-r12,lr}")
1111
1112#ifdef CONFIG_THUMB2_KERNEL
1113 TEST_ARM_TO_THUMB_INTERWORK_P("ldmplia r",0,15*4,", {pc}")
1114 TEST_ARM_TO_THUMB_INTERWORK_P("ldmmiia r",13,0,", {r0-r15}")
1115#endif
1116 TEST_BF("b 2f")
1117 TEST_BF("bl 2f")
1118 TEST_BB("b 2b")
1119 TEST_BB("bl 2b")
1120
1121 TEST_BF("beq 2f")
1122 TEST_BF("bleq 2f")
1123 TEST_BB("bne 2b")
1124 TEST_BB("blne 2b")
1125
1126 TEST_BF("bgt 2f")
1127 TEST_BF("blgt 2f")
1128 TEST_BB("blt 2b")
1129 TEST_BB("bllt 2b")
1130
1131 TEST_GROUP("Supervisor Call, and coprocessor instructions")
1132
1133 /*
1134 * We can't really test these by executing them, so all
1135 * we can do is check that probes are, or are not allowed.
1136 * At the moment none are allowed...
1137 */
1138#define TEST_COPROCESSOR(code) TEST_UNSUPPORTED(code)
1139
1140#define COPROCESSOR_INSTRUCTIONS_ST_LD(two,cc) \
1141 TEST_COPROCESSOR("stc"two" 0, cr0, [r13, #4]") \
1142 TEST_COPROCESSOR("stc"two" 0, cr0, [r13, #-4]") \
1143 TEST_COPROCESSOR("stc"two" 0, cr0, [r13, #4]!") \
1144 TEST_COPROCESSOR("stc"two" 0, cr0, [r13, #-4]!") \
1145 TEST_COPROCESSOR("stc"two" 0, cr0, [r13], #4") \
1146 TEST_COPROCESSOR("stc"two" 0, cr0, [r13], #-4") \
1147 TEST_COPROCESSOR("stc"two" 0, cr0, [r13], {1}") \
1148 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13, #4]") \
1149 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13, #-4]") \
1150 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13, #4]!") \
1151 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13, #-4]!") \
1152 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13], #4") \
1153 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13], #-4") \
1154 TEST_COPROCESSOR("stc"two"l 0, cr0, [r13], {1}") \
1155 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13, #4]") \
1156 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13, #-4]") \
1157 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13, #4]!") \
1158 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13, #-4]!") \
1159 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13], #4") \
1160 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13], #-4") \
1161 TEST_COPROCESSOR("ldc"two" 0, cr0, [r13], {1}") \
1162 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13, #4]") \
1163 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13, #-4]") \
1164 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13, #4]!") \
1165 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13, #-4]!") \
1166 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13], #4") \
1167 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13], #-4") \
1168 TEST_COPROCESSOR("ldc"two"l 0, cr0, [r13], {1}") \
1169 \
1170 TEST_COPROCESSOR( "stc"two" 0, cr0, [r15, #4]") \
1171 TEST_COPROCESSOR( "stc"two" 0, cr0, [r15, #-4]") \
1172 TEST_UNSUPPORTED(".word 0x"cc"daf0001 @ stc"two" 0, cr0, [r15, #4]!") \
1173 TEST_UNSUPPORTED(".word 0x"cc"d2f0001 @ stc"two" 0, cr0, [r15, #-4]!") \
1174 TEST_UNSUPPORTED(".word 0x"cc"caf0001 @ stc"two" 0, cr0, [r15], #4") \
1175 TEST_UNSUPPORTED(".word 0x"cc"c2f0001 @ stc"two" 0, cr0, [r15], #-4") \
1176 TEST_COPROCESSOR( "stc"two" 0, cr0, [r15], {1}") \
1177 TEST_COPROCESSOR( "stc"two"l 0, cr0, [r15, #4]") \
1178 TEST_COPROCESSOR( "stc"two"l 0, cr0, [r15, #-4]") \
1179 TEST_UNSUPPORTED(".word 0x"cc"def0001 @ stc"two"l 0, cr0, [r15, #4]!") \
1180 TEST_UNSUPPORTED(".word 0x"cc"d6f0001 @ stc"two"l 0, cr0, [r15, #-4]!") \
1181 TEST_UNSUPPORTED(".word 0x"cc"cef0001 @ stc"two"l 0, cr0, [r15], #4") \
1182 TEST_UNSUPPORTED(".word 0x"cc"c6f0001 @ stc"two"l 0, cr0, [r15], #-4") \
1183 TEST_COPROCESSOR( "stc"two"l 0, cr0, [r15], {1}") \
1184 TEST_COPROCESSOR( "ldc"two" 0, cr0, [r15, #4]") \
1185 TEST_COPROCESSOR( "ldc"two" 0, cr0, [r15, #-4]") \
1186 TEST_UNSUPPORTED(".word 0x"cc"dbf0001 @ ldc"two" 0, cr0, [r15, #4]!") \
1187 TEST_UNSUPPORTED(".word 0x"cc"d3f0001 @ ldc"two" 0, cr0, [r15, #-4]!") \
1188 TEST_UNSUPPORTED(".word 0x"cc"cbf0001 @ ldc"two" 0, cr0, [r15], #4") \
1189 TEST_UNSUPPORTED(".word 0x"cc"c3f0001 @ ldc"two" 0, cr0, [r15], #-4") \
1190 TEST_COPROCESSOR( "ldc"two" 0, cr0, [r15], {1}") \
1191 TEST_COPROCESSOR( "ldc"two"l 0, cr0, [r15, #4]") \
1192 TEST_COPROCESSOR( "ldc"two"l 0, cr0, [r15, #-4]") \
1193 TEST_UNSUPPORTED(".word 0x"cc"dff0001 @ ldc"two"l 0, cr0, [r15, #4]!") \
1194 TEST_UNSUPPORTED(".word 0x"cc"d7f0001 @ ldc"two"l 0, cr0, [r15, #-4]!") \
1195 TEST_UNSUPPORTED(".word 0x"cc"cff0001 @ ldc"two"l 0, cr0, [r15], #4") \
1196 TEST_UNSUPPORTED(".word 0x"cc"c7f0001 @ ldc"two"l 0, cr0, [r15], #-4") \
1197 TEST_COPROCESSOR( "ldc"two"l 0, cr0, [r15], {1}")
1198
1199#define COPROCESSOR_INSTRUCTIONS_MC_MR(two,cc) \
1200 \
1201 TEST_COPROCESSOR( "mcrr"two" 0, 15, r0, r14, cr0") \
1202 TEST_COPROCESSOR( "mcrr"two" 15, 0, r14, r0, cr15") \
1203 TEST_UNSUPPORTED(".word 0x"cc"c4f00f0 @ mcrr"two" 0, 15, r0, r15, cr0") \
1204 TEST_UNSUPPORTED(".word 0x"cc"c40ff0f @ mcrr"two" 15, 0, r15, r0, cr15") \
1205 TEST_COPROCESSOR( "mrrc"two" 0, 15, r0, r14, cr0") \
1206 TEST_COPROCESSOR( "mrrc"two" 15, 0, r14, r0, cr15") \
1207 TEST_UNSUPPORTED(".word 0x"cc"c5f00f0 @ mrrc"two" 0, 15, r0, r15, cr0") \
1208 TEST_UNSUPPORTED(".word 0x"cc"c50ff0f @ mrrc"two" 15, 0, r15, r0, cr15") \
1209 TEST_COPROCESSOR( "cdp"two" 15, 15, cr15, cr15, cr15, 7") \
1210 TEST_COPROCESSOR( "cdp"two" 0, 0, cr0, cr0, cr0, 0") \
1211 TEST_COPROCESSOR( "mcr"two" 15, 7, r15, cr15, cr15, 7") \
1212 TEST_COPROCESSOR( "mcr"two" 0, 0, r0, cr0, cr0, 0") \
1213 TEST_COPROCESSOR( "mrc"two" 15, 7, r15, cr15, cr15, 7") \
1214 TEST_COPROCESSOR( "mrc"two" 0, 0, r0, cr0, cr0, 0")
1215
1216 COPROCESSOR_INSTRUCTIONS_ST_LD("","e")
1217 COPROCESSOR_INSTRUCTIONS_MC_MR("","e")
1218 TEST_UNSUPPORTED("svc 0")
1219 TEST_UNSUPPORTED("svc 0xffffff")
1220
1221 TEST_UNSUPPORTED("svc 0")
1222
1223 TEST_GROUP("Unconditional instruction")
1224
1225#if __LINUX_ARM_ARCH__ >= 6
1226 TEST_UNSUPPORTED("srsda sp, 0x13")
1227 TEST_UNSUPPORTED("srsdb sp, 0x13")
1228 TEST_UNSUPPORTED("srsia sp, 0x13")
1229 TEST_UNSUPPORTED("srsib sp, 0x13")
1230 TEST_UNSUPPORTED("srsda sp!, 0x13")
1231 TEST_UNSUPPORTED("srsdb sp!, 0x13")
1232 TEST_UNSUPPORTED("srsia sp!, 0x13")
1233 TEST_UNSUPPORTED("srsib sp!, 0x13")
1234
1235 TEST_UNSUPPORTED("rfeda sp")
1236 TEST_UNSUPPORTED("rfedb sp")
1237 TEST_UNSUPPORTED("rfeia sp")
1238 TEST_UNSUPPORTED("rfeib sp")
1239 TEST_UNSUPPORTED("rfeda sp!")
1240 TEST_UNSUPPORTED("rfedb sp!")
1241 TEST_UNSUPPORTED("rfeia sp!")
1242 TEST_UNSUPPORTED("rfeib sp!")
1243 TEST_UNSUPPORTED(".word 0xf81d0a00 @ rfeda pc")
1244 TEST_UNSUPPORTED(".word 0xf91d0a00 @ rfedb pc")
1245 TEST_UNSUPPORTED(".word 0xf89d0a00 @ rfeia pc")
1246 TEST_UNSUPPORTED(".word 0xf99d0a00 @ rfeib pc")
1247 TEST_UNSUPPORTED(".word 0xf83d0a00 @ rfeda pc!")
1248 TEST_UNSUPPORTED(".word 0xf93d0a00 @ rfedb pc!")
1249 TEST_UNSUPPORTED(".word 0xf8bd0a00 @ rfeia pc!")
1250 TEST_UNSUPPORTED(".word 0xf9bd0a00 @ rfeib pc!")
1251#endif /* __LINUX_ARM_ARCH__ >= 6 */
1252
1253#if __LINUX_ARM_ARCH__ >= 6
1254 TEST_X( "blx __dummy_thumb_subroutine_even",
1255 ".thumb \n\t"
1256 ".space 4 \n\t"
1257 ".type __dummy_thumb_subroutine_even, %%function \n\t"
1258 "__dummy_thumb_subroutine_even: \n\t"
1259 "mov r0, pc \n\t"
1260 "bx lr \n\t"
1261 ".arm \n\t"
1262 )
1263 TEST( "blx __dummy_thumb_subroutine_even")
1264
1265 TEST_X( "blx __dummy_thumb_subroutine_odd",
1266 ".thumb \n\t"
1267 ".space 2 \n\t"
1268 ".type __dummy_thumb_subroutine_odd, %%function \n\t"
1269 "__dummy_thumb_subroutine_odd: \n\t"
1270 "mov r0, pc \n\t"
1271 "bx lr \n\t"
1272 ".arm \n\t"
1273 )
1274 TEST( "blx __dummy_thumb_subroutine_odd")
1275#endif /* __LINUX_ARM_ARCH__ >= 6 */
1276
1277 COPROCESSOR_INSTRUCTIONS_ST_LD("2","f")
1278#if __LINUX_ARM_ARCH__ >= 6
1279 COPROCESSOR_INSTRUCTIONS_MC_MR("2","f")
1280#endif
1281
1282 TEST_GROUP("Miscellaneous instructions, memory hints, and Advanced SIMD instructions")
1283
1284#if __LINUX_ARM_ARCH__ >= 6
1285 TEST_UNSUPPORTED("cps 0x13")
1286 TEST_UNSUPPORTED("cpsie i")
1287 TEST_UNSUPPORTED("cpsid i")
1288 TEST_UNSUPPORTED("cpsie i,0x13")
1289 TEST_UNSUPPORTED("cpsid i,0x13")
1290 TEST_UNSUPPORTED("setend le")
1291 TEST_UNSUPPORTED("setend be")
1292#endif
1293
1294#if __LINUX_ARM_ARCH__ >= 7
1295 TEST_P("pli [r",0,0b,", #16]")
1296 TEST( "pli [pc, #0]")
1297 TEST_RR("pli [r",12,0b,", r",0, 16,"]")
1298 TEST_RR("pli [r",0, 0b,", -r",12,16,", lsl #4]")
1299#endif
1300
1301#if __LINUX_ARM_ARCH__ >= 5
1302 TEST_P("pld [r",0,32,", #-16]")
1303 TEST( "pld [pc, #0]")
1304 TEST_PR("pld [r",7, 24, ", r",0, 16,"]")
1305 TEST_PR("pld [r",8, 24, ", -r",12,16,", lsl #4]")
1306#endif
1307
1308#if __LINUX_ARM_ARCH__ >= 7
1309 TEST_SUPPORTED( ".word 0xf590f000 @ pldw [r0, #0]")
1310 TEST_SUPPORTED( ".word 0xf797f000 @ pldw [r7, r0]")
1311 TEST_SUPPORTED( ".word 0xf798f18c @ pldw [r8, r12, lsl #3]");
1312#endif
1313
1314#if __LINUX_ARM_ARCH__ >= 7
1315 TEST_UNSUPPORTED("clrex")
1316 TEST_UNSUPPORTED("dsb")
1317 TEST_UNSUPPORTED("dmb")
1318 TEST_UNSUPPORTED("isb")
1319#endif
1320
1321 verbose("\n");
1322}
1323
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 1cef0fa996e2..b12be0fe183c 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -1139,6 +1139,11 @@ static int __init run_all_tests(void)
1139 if (ret) 1139 if (ret)
1140 goto out; 1140 goto out;
1141 1141
1142 pr_info("ARM instruction simulation\n");
1143 ret = run_test_cases(kprobe_arm_test_cases);
1144 if (ret)
1145 goto out;
1146
1142#else /* CONFIG_THUMB2_KERNEL */ 1147#else /* CONFIG_THUMB2_KERNEL */
1143 1148
1144 pr_info("Probe 16-bit Thumb code\n"); 1149 pr_info("Probe 16-bit Thumb code\n");
diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h
index 7d982290908f..0dc5d77b9356 100644
--- a/arch/arm/kernel/kprobes-test.h
+++ b/arch/arm/kernel/kprobes-test.h
@@ -387,4 +387,6 @@ struct test_arg_end {
387#ifdef CONFIG_THUMB2_KERNEL 387#ifdef CONFIG_THUMB2_KERNEL
388void kprobe_thumb16_test_cases(void); 388void kprobe_thumb16_test_cases(void);
389void kprobe_thumb32_test_cases(void); 389void kprobe_thumb32_test_cases(void);
390#else
391void kprobe_arm_test_cases(void);
390#endif 392#endif