VirtualBox

source: vbox/trunk/src/VBox/Disassembler/testcase/tstDisasmArmv8-1-asm.S@ 105810

Last change on this file since 105810 was 105810, checked in by vboxsync, 6 months ago

Disassembler/ARMv8: Implement disassembly of ccmp/ccmn register variants and add testcases, bugref:10394

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.2 KB
Line 
1/* $Id: tstDisasmArmv8-1-asm.S 105810 2024-08-22 08:26:22Z vboxsync $ */
2/** @file
3 * VBox disassembler - Tables for ARMv8 A64.
4 */
5
6/*
7 * Copyright (C) 2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28.private_extern _TestProcA64
29_TestProcA64:
30 ; Miscellaneous instructions without a parameter
31 nop
32 yield
33 wfe
34 wfi
35 sev
36 sevl
37 dgh
38 xpaclri
39
40 ; Control flow instructions
41 svc #0xfefe
42 hvc #0xdead
43 smc #0xcafe
44 brk #0xd0d0
45 hlt #0xc0de
46; tcancel #0xd00f Requires FEAT_TME
47 dcps1 #0xdeca
48 dcps2 #0xdec0
49 dcps3 #0xfeed
50 b #0x100
51 b #-0x100
52 bl #0x100
53 bl #-0x100
54 b.ne #+0x1000
55 b.eq #-0x1000
56; bc.ne #+0x1000 Requires FEAT_HBC
57; bc.eq #-0x1000 Requires FEAT_HBC
58 cbz x0, #+0x100
59 cbz x0, #-0x100
60 cbz w0, #+0x100
61 cbnz x0, #+0x100
62 cbnz x0, #-0x100
63 cbnz w0, #+0x100
64 tbz w0, #13, #+0x100
65 tbz x0, #63, #-0x100
66 tbz w0, #8, #+0x100
67 ret x30
68 ret x1
69 ret x2
70 ret x15
71 br x15
72 blr x15
73
74 ; System register access instructions
75 msr ttbr0_el1, x0
76 mrs x0, ttbr0_el1
77
78 ; Arithmetic instructions
79 add x0, x0, #0x0
80 add x0, x1, #0x10000
81 add x0, x1, #65536
82 add x0, x0, x0
83 add x0, x1, x29
84 add x0, x1, x28, LSL #1
85 add x0, x1, x28, LSL #63
86 add x0, x1, x28, LSR #1
87 add x0, x1, x28, LSR #63
88 add x0, x1, x28, ASR #1
89 add x0, x1, x28, ASR #63
90 ; ROR is reserved
91
92 add w0, w1, #0x0
93 add w0, w1, #0x10000
94 add w0, w1, #65536
95 add w0, w1, w29
96 add w0, w1, w28, LSL #1
97 add w0, w1, w28, LSL #31
98 add w0, w1, w28, LSR #1
99 add w0, w1, w28, LSR #31
100 add w0, w1, w28, ASR #1
101 add w0, w1, w28, ASR #31
102 ; ROR is reserved
103
104 adds x0, x0, #0x0
105 adds x0, x1, #0x10000
106 adds x0, x1, #65536
107 adds x0, x0, x0
108 adds x0, x1, x29
109 adds x0, x1, x28, LSL #1
110 adds x0, x1, x28, LSL #63
111 adds x0, x1, x28, LSR #1
112 adds x0, x1, x28, LSR #63
113 adds x0, x1, x28, ASR #1
114 adds x0, x1, x28, ASR #63
115 ; ROR is reserved
116
117 adds w0, w1, #0x0
118 adds w0, w1, #0x10000
119 adds w0, w1, #65536
120 adds w0, w1, w29
121 adds w0, w1, w28, LSL #1
122 adds w0, w1, w28, LSL #31
123 adds w0, w1, w28, LSR #1
124 adds w0, w1, w28, LSR #31
125 adds w0, w1, w28, ASR #1
126 adds w0, w1, w28, ASR #31
127 ; ROR is reserved
128
129 sub x0, x0, #0x0
130 sub x0, x1, #0x10000
131 sub x0, x1, #65536
132 sub x0, x0, x0
133 sub x0, x1, x29
134 sub x0, x1, x28, LSL #1
135 sub x0, x1, x28, LSL #63
136 sub x0, x1, x28, LSR #1
137 sub x0, x1, x28, LSR #63
138 sub x0, x1, x28, ASR #1
139 sub x0, x1, x28, ASR #63
140 ; ROR is reserved
141
142 sub w0, w1, #0x0
143 sub w0, w1, #0x10000
144 sub w0, w1, #65536
145 sub w0, w1, w29
146 sub w0, w1, w28, LSL #1
147 sub w0, w1, w28, LSL #31
148 sub w0, w1, w28, LSR #1
149 sub w0, w1, w28, LSR #31
150 sub w0, w1, w28, ASR #1
151 sub w0, w1, w28, ASR #31
152 ; ROR is reserved
153
154 subs x0, x0, #0x0
155 subs x0, x1, #0x10000
156 subs x0, x1, #65536
157 subs x0, x0, x0
158 subs x0, x1, x29
159 subs x0, x1, x28, LSL #1
160 subs x0, x1, x28, LSL #63
161 subs x0, x1, x28, LSR #1
162 subs x0, x1, x28, LSR #63
163 subs x0, x1, x28, ASR #1
164 subs x0, x1, x28, ASR #63
165 ; ROR is reserved
166
167 subs w0, w1, #0x0
168 subs w0, w1, #0x10000
169 subs w0, w1, #65536
170 subs w0, w1, w29
171 subs w0, w1, w28, LSL #1
172 subs w0, w1, w28, LSL #31
173 subs w0, w1, w28, LSR #1
174 subs w0, w1, w28, LSR #31
175 subs w0, w1, w28, ASR #1
176 subs w0, w1, w28, ASR #31
177 ; ROR is reserved
178
179 ; Aliases of subs -> cmp
180 cmp x0, x1
181 cmp w0, w1
182 cmp x0, x1, LSL #1
183 cmp w0, w1, LSL #1
184
185 ; Logical instructions
186 and x0, x0, #0xffff
187 and w0, wzr, #0xffff
188
189 ands x0, x0, #0x00ffff00
190 ands w10, w23, #0x55555555
191
192 orr x0, x0, #0xffff
193 orr w0, wzr, #0xffff
194
195 mov x0, x1 ; Alias of orr
196 mov w0, w1 ; Alias of orr
197
198 eor x0, x0, #0x00ffff00
199 eor w10, w23, #0x55555555
200
201 sbfm x0, x0, #0x1, #0x2
202 sbfm w0, w0, #0xf, #0x9
203 bfm x0, x0, #0x1, #0x2
204 bfm w0, w0, #0xf, #0x9
205 ubfm x0, x0, #0x1, #0x2
206 ubfm w0, w0, #0xf, #0x9
207
208 movn x0, #0xffff
209 movn x0, #0xffff, LSL #16
210 movn w0, #0xffff
211 movn w0, #0xffff, LSL #16
212
213 movz x0, #0xffff
214 movz x0, #0xffff, LSL #48
215 movz w0, #0xffff
216 movz w0, #0xffff, LSL #16
217
218 movk x0, #0xffff
219 movk x0, #0xffff, LSL #32
220 movk w0, #0xffff
221 movk w0, #0xffff, LSL #16
222
223 ; Logical instructions with a shifted register
224 and w0, w0, w27
225 and w0, w1, w28, LSL #1
226 and w0, w1, w28, LSL #31
227 and w0, w1, w28, LSR #1
228 and w0, w1, w28, LSR #31
229 and w0, w1, w28, ASR #1
230 and w0, w1, w28, ASR #31
231 and w0, w1, w28, ROR #1
232 and w0, w1, w28, ROR #31
233
234 and x0, x0, x27
235 and x0, x1, x28, LSL #1
236 and x0, x1, x28, LSL #63
237 and x0, x1, x28, LSR #1
238 and x0, x1, x28, LSR #63
239 and x0, x1, x28, ASR #1
240 and x0, x1, x28, ASR #63
241 and x0, x1, x28, ROR #1
242 and x0, x1, x28, ROR #63
243
244 orr w0, w0, w27
245 orr w0, w1, w28, LSL #1
246 orr w0, w1, w28, LSL #31
247 orr w0, w1, w28, LSR #1
248 orr w0, w1, w28, LSR #31
249 orr w0, w1, w28, ASR #1
250 orr w0, w1, w28, ASR #31
251 orr w0, w1, w28, ROR #1
252 orr w0, w1, w28, ROR #31
253
254 orr x0, x0, x27
255 orr x0, x1, x28, LSL #1
256 orr x0, x1, x28, LSL #63
257 orr x0, x1, x28, LSR #1
258 orr x0, x1, x28, LSR #63
259 orr x0, x1, x28, ASR #1
260 orr x0, x1, x28, ASR #63
261 orr x0, x1, x28, ROR #1
262 orr x0, x1, x28, ROR #63
263
264 eor w0, w0, w27
265 eor w0, w1, w28, LSL #1
266 eor w0, w1, w28, LSL #31
267 eor w0, w1, w28, LSR #1
268 eor w0, w1, w28, LSR #31
269 eor w0, w1, w28, ASR #1
270 eor w0, w1, w28, ASR #31
271 eor w0, w1, w28, ROR #1
272 eor w0, w1, w28, ROR #31
273
274 eor x0, x0, x27
275 eor x0, x1, x28, LSL #1
276 eor x0, x1, x28, LSL #63
277 eor x0, x1, x28, LSR #1
278 eor x0, x1, x28, LSR #63
279 eor x0, x1, x28, ASR #1
280 eor x0, x1, x28, ASR #63
281 eor x0, x1, x28, ROR #1
282 eor x0, x1, x28, ROR #63
283
284 ands x0, x0, x27
285 ands x0, x1, x28, LSL #1
286 ands x0, x1, x28, LSL #63
287 ands x0, x1, x28, LSR #1
288 ands x0, x1, x28, LSR #63
289 ands x0, x1, x28, ASR #1
290 ands x0, x1, x28, ASR #63
291 ands x0, x1, x28, ROR #1
292 ands x0, x1, x28, ROR #63
293
294 bic w0, w0, w27
295 bic w0, w1, w28, LSL #1
296 bic w0, w1, w28, LSL #31
297 bic w0, w1, w28, LSR #1
298 bic w0, w1, w28, LSR #31
299 bic w0, w1, w28, ASR #1
300 bic w0, w1, w28, ASR #31
301 bic w0, w1, w28, ROR #1
302 bic w0, w1, w28, ROR #31
303
304 bic x0, x0, x27
305 bic x0, x1, x28, LSL #1
306 bic x0, x1, x28, LSL #63
307 bic x0, x1, x28, LSR #1
308 bic x0, x1, x28, LSR #63
309 bic x0, x1, x28, ASR #1
310 bic x0, x1, x28, ASR #63
311 bic x0, x1, x28, ROR #1
312 bic x0, x1, x28, ROR #63
313
314 orn w0, w0, w27
315 orn w0, w1, w28, LSL #1
316 orn w0, w1, w28, LSL #31
317 orn w0, w1, w28, LSR #1
318 orn w0, w1, w28, LSR #31
319 orn w0, w1, w28, ASR #1
320 orn w0, w1, w28, ASR #31
321 orn w0, w1, w28, ROR #1
322 orn w0, w1, w28, ROR #31
323
324 orn x0, x0, x27
325 orn x0, x1, x28, LSL #1
326 orn x0, x1, x28, LSL #63
327 orn x0, x1, x28, LSR #1
328 orn x0, x1, x28, LSR #63
329 orn x0, x1, x28, ASR #1
330 orn x0, x1, x28, ASR #63
331 orn x0, x1, x28, ROR #1
332 orn x0, x1, x28, ROR #63
333
334 eon w0, w0, w27
335 eon w0, w1, w28, LSL #1
336 eon w0, w1, w28, LSL #31
337 eon w0, w1, w28, LSR #1
338 eon w0, w1, w28, LSR #31
339 eon w0, w1, w28, ASR #1
340 eon w0, w1, w28, ASR #31
341 eon w0, w1, w28, ROR #1
342 eon w0, w1, w28, ROR #31
343
344 eon x0, x0, x27
345 eon x0, x1, x28, LSL #1
346 eon x0, x1, x28, LSL #63
347 eon x0, x1, x28, LSR #1
348 eon x0, x1, x28, LSR #63
349 eon x0, x1, x28, ASR #1
350 eon x0, x1, x28, ASR #63
351 eon x0, x1, x28, ROR #1
352 eon x0, x1, x28, ROR #63
353
354 bics w0, w0, w27
355 bics w0, w1, w28, LSL #1
356 bics w0, w1, w28, LSL #31
357 bics w0, w1, w28, LSR #1
358 bics w0, w1, w28, LSR #31
359 bics w0, w1, w28, ASR #1
360 bics w0, w1, w28, ASR #31
361 bics w0, w1, w28, ROR #1
362 bics w0, w1, w28, ROR #31
363
364 bics x0, x0, x27
365 bics x0, x1, x28, LSL #1
366 bics x0, x1, x28, LSL #63
367 bics x0, x1, x28, LSR #1
368 bics x0, x1, x28, LSR #63
369 bics x0, x1, x28, ASR #1
370 bics x0, x1, x28, ASR #63
371 bics x0, x1, x28, ROR #1
372 bics x0, x1, x28, ROR #63
373
374 ; Memory loads
375 ldr x0, [x28]
376 ldr x0, [x28, #8]
377 ldr x0, [x28, #32760]
378
379 ldr w0, [x28]
380 ldr w0, [x28, #4]
381 ldr w0, [x28, #16380]
382
383 ; Memory stores
384 str x0, [x28]
385 str x0, [x28, #8]
386 str x0, [x28, #32760]
387
388 str w0, [x28]
389 str w0, [x28, #4]
390 str w0, [x28, #16380]
391
392 ; Conditional compare
393 ccmp x0, x1, #0x3, eq
394 ccmp w0, w1, #0xf, eq
395 ccmp x0, x1, #0x3, ne
396 ccmp w0, w1, #0xf, ne
397 ccmp x0, x1, #0x3, cs
398 ccmp w0, w1, #0xf, cc
399 ccmp x0, x1, #0x3, mi
400 ccmp w0, w1, #0xf, mi
401 ccmp x0, x1, #0x3, pl
402 ccmp w0, w1, #0xf, vs
403 ccmp x0, x1, #0x3, vc
404 ccmp w0, w1, #0xf, vc
405 ccmp x0, x1, #0x3, hi
406 ccmp w0, w1, #0xf, hi
407 ccmp x0, x1, #0x3, ls
408 ccmp w0, w1, #0xf, ls
409 ccmp x0, x1, #0x3, ge
410 ccmp w0, w1, #0xf, ge
411 ccmp x0, x1, #0x3, lt
412 ccmp w0, w1, #0xf, lt
413 ccmp x0, x1, #0x3, gt
414 ccmp w0, w1, #0xf, gt
415 ccmp x0, x1, #0x3, le
416 ccmp w0, w1, #0xf, le
417 ccmp x0, x1, #0x3, al
418 ccmp w0, w1, #0xf, al
419
420 ccmn x0, x1, #0x3, eq
421 ccmn w0, w1, #0xf, eq
422 ccmn x0, x1, #0x3, ne
423 ccmn w0, w1, #0xf, ne
424 ccmn x0, x1, #0x3, cs
425 ccmn w0, w1, #0xf, cc
426 ccmn x0, x1, #0x3, mi
427 ccmn w0, w1, #0xf, mi
428 ccmn x0, x1, #0x3, pl
429 ccmn w0, w1, #0xf, vs
430 ccmn x0, x1, #0x3, vc
431 ccmn w0, w1, #0xf, vc
432 ccmn x0, x1, #0x3, hi
433 ccmn w0, w1, #0xf, hi
434 ccmn x0, x1, #0x3, ls
435 ccmn w0, w1, #0xf, ls
436 ccmn x0, x1, #0x3, ge
437 ccmn w0, w1, #0xf, ge
438 ccmn x0, x1, #0x3, lt
439 ccmn w0, w1, #0xf, lt
440 ccmn x0, x1, #0x3, gt
441 ccmn w0, w1, #0xf, gt
442 ccmn x0, x1, #0x3, le
443 ccmn w0, w1, #0xf, le
444 ccmn x0, x1, #0x3, al
445 ccmn w0, w1, #0xf, al
446
447 ;
448 ; Keep last so the testcase can catch errors in
449 ; the disassembly of the last instruction.
450 ;
451 nop
452
453.private_extern _TestProcA64_EndProc
454_TestProcA64_EndProc:
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette