Skip to content

Commit c51ca2f

Browse files
committed
[AArch64] Update disassembler based on 2025-06 ARM ISA data
Alongside this I also added support for decoding: * LDR / STR (table) * PMULLB / PMULLT * ABS / CNT / CTZ * SMIN / SMAX / UMIN / UMAX * RPRFM * PSEL Note that while these instructions will now be disassembled, they are not yet lifted to LLIL. Additionally, I fixed a number of errors in the decoding of some less commonly occurring instructions.
1 parent 00566fc commit c51ca2f

29 files changed

+78543
-44424
lines changed

arch/arm64/disassembler/decode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ int aarch64_decompose(uint32_t instructionValue, Instruction* instr, uint64_t ad
1010
ctx.halted = 1; // enable disassembly of exception instructions like DCPS1
1111
ctx.insword = instructionValue;
1212
ctx.address = address;
13-
ctx.features0 = ARCH_FEATURES_ALL;
14-
ctx.features1 = ARCH_FEATURES_ALL;
13+
ARCH_FEATURES_ENABLE_ALL(ctx.decode_features);
14+
ARCH_FEATURES_ENABLE_ALL(ctx.pcode_features);
1515
ctx.EDSCR_HDE = 1;
1616

1717
/* have the spec-generated code populate all the pcode variables */

arch/arm64/disassembler/decode.h

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ typedef struct context_
136136
{
137137
uint32_t insword;
138138
uint64_t address;
139-
uint64_t features0; // bitmask of ARCH_FEATURE_XXX
140-
uint64_t features1; // bitmask of ARCH_FEATURE_XXX
139+
uint64_t decode_features[2]; // bitmask of ARCH_FEATURE_XXX
140+
uint64_t pcode_features[2]; // bitmask of ARCH_FEATURE_XXX
141141
// uint32_t exception_level; // used by AArch64.CheckSystemAccess()
142142
// uint32_t security_state;
143143
uint8_t pstate_btype; // used by BTypeCompatible_BTI()
@@ -193,19 +193,28 @@ typedef struct context_
193193
uint64_t acc;
194194
uint64_t acctype;
195195
uint64_t accumulate;
196+
bool acqrel;
197+
bool acquire;
198+
bool acquirepc;
196199
uint64_t alias;
197200
uint64_t amount;
198201
uint64_t and_test;
199202
uint64_t asimdimm;
203+
bool auth_combined;
204+
bool auth_then_branch;
205+
bool autia1716;
206+
bool autib1716;
200207
uint64_t b;
201208
uint64_t b40;
202209
uint64_t b5;
203210
uint64_t bit_pos;
204211
uint64_t bit_val;
205212
uint64_t branch_type;
206213
uint64_t c;
214+
uint64_t cc;
207215
uint64_t cmode;
208216
uint64_t cmp, cmph, cmpl, cmp_eq, cmp_with_zero;
217+
uint64_t cmp_op;
209218
uint64_t comment;
210219
uint64_t comparison;
211220
uint64_t cond; /* careful! this is the pcode scratchpad .cond, NOT the .cond field of a struct
@@ -216,16 +225,20 @@ typedef struct context_
216225
uint64_t countop;
217226
uint64_t crc32c;
218227
uint64_t csize;
228+
uint64_t d0;
229+
uint64_t d1;
219230
uint64_t d, da, data, datasize, double_table;
220231
uint64_t dtype, dtypeh, dtypel;
221232
uint64_t d_esize;
233+
uint64_t decode_fltsize;
222234
uint64_t decrypt;
223235
uint64_t destsize;
224236
uint64_t dm;
225237
uint64_t dn;
226238
uint64_t domain;
227239
uint64_t dst_index;
228240
uint64_t dst_unsigned;
241+
uint64_t dstride;
229242
uint64_t dstsize;
230243
uint64_t e;
231244
uint64_t elements;
@@ -240,6 +253,7 @@ typedef struct context_
240253
uint64_t extend_type;
241254
uint64_t f, ff;
242255
uint64_t field;
256+
uint64_t flagmask;
243257
uint64_t flags;
244258
uint64_t fltsize;
245259
uint64_t fpop;
@@ -252,6 +266,13 @@ typedef struct context_
252266
uint64_t hw;
253267
uint64_t i, i1, i2, i2h, i2l, i3h, i3l;
254268
uint64_t idxdsize;
269+
uint64_t i3;
270+
uint64_t i4;
271+
uint64_t i4A;
272+
uint64_t i4B;
273+
uint64_t i4C;
274+
uint64_t i4h;
275+
uint64_t i4l;
255276
uint64_t imm;
256277
uint64_t imm1;
257278
uint64_t imm12;
@@ -288,7 +309,11 @@ typedef struct context_
288309
uint64_t inzero;
289310
uint64_t isBefore;
290311
uint64_t is_tbl;
312+
bool ispair;
313+
bool issrc2;
314+
uint64_t isize;
291315
uint64_t iszero;
316+
uint64_t K;
292317
uint64_t ldacctype;
293318
uint64_t len;
294319
uint64_t level;
@@ -298,10 +323,19 @@ typedef struct context_
298323
uint64_t mask;
299324
uint64_t mbytes;
300325
uint64_t memop;
326+
uint64_t memcpy_d;
327+
uint64_t memcpy_n;
328+
uint64_t memcpy_s;
329+
uint64_t memcpy_stage;
330+
uint64_t memset_stage;
331+
uint64_t memset_d;
332+
uint64_t memset_n;
333+
uint64_t memset_s;
301334
uint64_t merging;
302335
uint64_t min;
303336
uint64_t min_EL;
304337
uint64_t minimum;
338+
uint64_t mreg;
305339
uint64_t msb;
306340
uint64_t msize;
307341
uint64_t msz;
@@ -313,13 +347,21 @@ typedef struct context_
313347
uint64_t neg_i;
314348
uint64_t neg_r;
315349
uint64_t negated;
350+
uint64_t ngrp;
351+
uint64_t nvec;
352+
bool nontemporal;
316353
uint64_t nreg;
354+
uint64_t ntblr;
355+
uint64_t num;
317356
uint64_t nzcv;
318357
uint64_t nXS;
319358
uint64_t o0, o1, o2, o3;
320359
uint64_t offs_size;
321360
uint64_t offs_unsigned;
322361
uint64_t offset;
362+
uint64_t off2;
363+
uint64_t off3;
364+
uint64_t off4;
323365
uint64_t op1_neg;
324366
uint64_t op1_unsigned;
325367
uint64_t op, op0, op1, op2, op3, op4, op21, op31, op54;
@@ -328,32 +370,43 @@ typedef struct context_
328370
uint64_t opa_neg;
329371
uint64_t opc;
330372
uint64_t opc2;
373+
uint64_t opc3;
331374
uint64_t opcode, opcode2;
332375
uint64_t operand;
333376
uint64_t operation_;
334377
uint64_t opt, option;
378+
uint64_t options;
335379
uint64_t osize;
336380
uint64_t pac;
381+
bool pacia1716;
382+
bool pacib1716;
337383
uint64_t page;
338384
uint64_t pair;
339385
uint64_t pairs;
340386
uint64_t part;
341387
uint64_t part1;
342388
uint64_t pat;
343389
uint64_t pattern;
390+
uint64_t PNd;
391+
uint64_t PNg;
392+
uint64_t PNn;
393+
uint64_t Pv;
344394
uint64_t poly;
345395
uint64_t pos;
346396
uint64_t position;
347397
uint64_t postindex;
348398
uint64_t pref_hint;
349399
uint64_t prfop;
350400
uint64_t ptype;
401+
uint64_t r;
351402
uint64_t rd;
352403
uint64_t read;
353404
uint64_t regs;
354405
uint64_t regsize;
406+
bool release;
355407
uint64_t replicate;
356408
uint64_t rmode;
409+
bool rnontemporal;
357410
uint64_t rot;
358411
uint64_t round;
359412
uint64_t rounding;
@@ -379,6 +432,7 @@ typedef struct context_
379432
uint64_t signed_;
380433
uint64_t simm7;
381434
uint64_t size;
435+
bool soft;
382436
uint64_t source_is_sp;
383437
uint64_t src_index;
384438
uint64_t src_unsigned;
@@ -395,16 +449,20 @@ typedef struct context_
395449
uint64_t sys_op0;
396450
uint64_t sys_op1;
397451
uint64_t sys_op2;
452+
uint64_t sys_L;
398453
uint64_t sz;
399454
uint64_t t, t2, tb;
455+
uint64_t tagchecked;
400456
uint64_t tag_checked;
401457
uint64_t tag_offset;
402458
uint64_t target_level;
403459
uint64_t tmask;
404460
uint64_t tsize;
461+
uint64_t tstride;
405462
uint64_t tsz;
406463
uint64_t tszh;
407464
uint64_t tszl;
465+
uint64_t TT;
408466
uint64_t types;
409467
uint64_t u0, u1;
410468
uint64_t uimm4;
@@ -416,9 +474,15 @@ typedef struct context_
416474
uint64_t use_key_a;
417475
uint64_t user_access_override;
418476
uint64_t v, vertical;
477+
uint64_t value2;
478+
uint64_t vl;
479+
uint64_t VR;
419480
uint64_t wback;
420481
uint64_t wb_unknown;
482+
uint64_t width;
483+
bool withstatus;
421484
uint64_t wmask;
485+
bool wnontemporal;
422486
uint64_t writeback;
423487
uint64_t xs;
424488
uint64_t ZAda, ZAd, ZAn, ZAt, Zk, zero_data;
@@ -837,7 +901,6 @@ extern "C"
837901

838902
int aarch64_decompose(uint32_t instructionValue, Instruction* instr, uint64_t address);
839903
size_t get_register_size(enum Register);
840-
// const char* tlbi_op(int32_t op);
841904

842905
#ifdef __cplusplus
843906
}

0 commit comments

Comments
 (0)