@@ -5,7 +5,7 @@ use libc::c_uint;
5
5
pub use crate :: arch:: arch_builder:: arm64:: * ;
6
6
use crate :: arch:: DetailsArchInsn ;
7
7
use crate :: instruction:: { RegId , RegIdInt } ;
8
- use capstone_sys:: { arm64_op_mem, arm64_op_type, cs_arm64, cs_arm64_op} ;
8
+ use capstone_sys:: { arm64_op_mem, arm64_op_sme_index , arm64_op_type, cs_arm64, cs_arm64_op} ;
9
9
use core:: convert:: From ;
10
10
use core:: { cmp, fmt, mem, slice} ;
11
11
@@ -19,6 +19,7 @@ pub use capstone_sys::arm64_insn_group as Arm64InsnGroup;
19
19
pub use capstone_sys:: arm64_prefetch_op as ArmPrefetchOp ;
20
20
pub use capstone_sys:: arm64_pstate as Arm64Pstate ;
21
21
pub use capstone_sys:: arm64_reg as Arm64Reg ;
22
+ pub use capstone_sys:: arm64_svcr_op as Arm64SvcrOp ;
22
23
pub use capstone_sys:: arm64_sys_op as Arm64SysOp ;
23
24
pub use capstone_sys:: arm64_sysreg as Arm64Sysreg ;
24
25
pub use capstone_sys:: arm64_vas as Arm64Vas ;
@@ -51,7 +52,11 @@ pub enum Arm64Shift {
51
52
}
52
53
53
54
impl Arm64OperandType {
54
- fn new ( op_type : arm64_op_type , value : cs_arm64_op__bindgen_ty_2 ) -> Arm64OperandType {
55
+ fn new (
56
+ op_type : arm64_op_type ,
57
+ value : cs_arm64_op__bindgen_ty_2 ,
58
+ svcr : Arm64SvcrOp ,
59
+ ) -> Arm64OperandType {
55
60
use self :: arm64_op_type:: * ;
56
61
use self :: Arm64OperandType :: * ;
57
62
@@ -72,6 +77,8 @@ impl Arm64OperandType {
72
77
ARM64_OP_SYS => Sys ( unsafe { value. sys } ) ,
73
78
ARM64_OP_PREFETCH => Prefetch ( unsafe { value. prefetch } ) ,
74
79
ARM64_OP_BARRIER => Barrier ( unsafe { value. barrier } ) ,
80
+ ARM64_OP_SVCR => SVCR ( svcr) ,
81
+ ARM64_OP_SME_INDEX => SMEIndex ( Arm64OpSmeIndex ( unsafe { value. sme_index } ) ) ,
75
82
}
76
83
}
77
84
}
@@ -131,6 +138,12 @@ pub enum Arm64OperandType {
131
138
/// Memory barrier operation (ISB/DMB/DSB instructions)
132
139
Barrier ( Arm64BarrierOp ) ,
133
140
141
+ /// SMSTART/SMSTOP mode (Streaming SVE & ZA storage)
142
+ SVCR ( Arm64SvcrOp ) ,
143
+
144
+ /// SME index
145
+ SMEIndex ( Arm64OpSmeIndex ) ,
146
+
134
147
/// Invalid
135
148
Invalid ,
136
149
}
@@ -183,6 +196,31 @@ impl_PartialEq_repr_fields!(Arm64OpMem;
183
196
184
197
impl cmp:: Eq for Arm64OpMem { }
185
198
199
+ /// ARM64 sme index operand
200
+ #[ derive( Debug , Copy , Clone ) ]
201
+ pub struct Arm64OpSmeIndex ( pub ( crate ) arm64_op_sme_index ) ;
202
+
203
+ impl Arm64OpSmeIndex {
204
+ /// Register being indexed
205
+ pub fn reg ( & self ) -> RegId {
206
+ RegId ( self . 0 . reg as RegIdInt )
207
+ }
208
+
209
+ /// Base register
210
+ pub fn base ( & self ) -> RegId {
211
+ RegId ( self . 0 . base as RegIdInt )
212
+ }
213
+
214
+ /// Disp value
215
+ pub fn disp ( & self ) -> i32 {
216
+ self . 0 . disp as i32
217
+ }
218
+ }
219
+
220
+ impl_PartialEq_repr_fields ! ( Arm64OpSmeIndex ;
221
+ reg, base, disp
222
+ ) ;
223
+
186
224
impl Default for Arm64Operand {
187
225
fn default ( ) -> Self {
188
226
Arm64Operand {
@@ -227,7 +265,7 @@ impl Arm64Shift {
227
265
impl From < & cs_arm64_op > for Arm64Operand {
228
266
fn from ( op : & cs_arm64_op ) -> Arm64Operand {
229
267
let shift = Arm64Shift :: new ( op. shift . type_ , op. shift . value ) ;
230
- let op_type = Arm64OperandType :: new ( op. type_ , op. __bindgen_anon_1 ) ;
268
+ let op_type = Arm64OperandType :: new ( op. type_ , op. __bindgen_anon_1 , op . svcr ) ;
231
269
let vector_index = if op. vector_index >= 0 {
232
270
Some ( op. vector_index as u32 )
233
271
} else {
@@ -279,27 +317,40 @@ mod test {
279
317
use super :: Arm64Sysreg :: * ;
280
318
use capstone_sys:: arm64_prefetch_op:: * ;
281
319
use capstone_sys:: arm64_pstate:: * ;
320
+ use capstone_sys:: arm64_svcr_op:: * ;
282
321
use capstone_sys:: * ;
283
322
284
323
fn t (
285
- op_type_value : ( arm64_op_type , cs_arm64_op__bindgen_ty_2 ) ,
324
+ op_type_value : ( arm64_op_type , cs_arm64_op__bindgen_ty_2 , arm64_svcr_op ) ,
286
325
expected_op_type : Arm64OperandType ,
287
326
) {
288
- let ( op_type, op_value) = op_type_value;
289
- let op_type = Arm64OperandType :: new ( op_type, op_value) ;
327
+ let ( op_type, op_value, op_svcr ) = op_type_value;
328
+ let op_type = Arm64OperandType :: new ( op_type, op_value, op_svcr ) ;
290
329
assert_eq ! ( expected_op_type, op_type) ;
291
330
}
292
331
293
332
t (
294
- ( ARM64_OP_INVALID , cs_arm64_op__bindgen_ty_2 { reg : 0 } ) ,
333
+ (
334
+ ARM64_OP_INVALID ,
335
+ cs_arm64_op__bindgen_ty_2 { reg : 0 } ,
336
+ ARM64_SVCR_INVALID ,
337
+ ) ,
295
338
Invalid ,
296
339
) ;
297
340
t (
298
- ( ARM64_OP_REG , cs_arm64_op__bindgen_ty_2 { reg : 0 } ) ,
341
+ (
342
+ ARM64_OP_REG ,
343
+ cs_arm64_op__bindgen_ty_2 { reg : 0 } ,
344
+ ARM64_SVCR_INVALID ,
345
+ ) ,
299
346
Reg ( RegId ( 0 ) ) ,
300
347
) ;
301
348
t (
302
- ( ARM64_OP_IMM , cs_arm64_op__bindgen_ty_2 { imm : 42 } ) ,
349
+ (
350
+ ARM64_OP_IMM ,
351
+ cs_arm64_op__bindgen_ty_2 { imm : 42 } ,
352
+ ARM64_SVCR_INVALID ,
353
+ ) ,
303
354
Imm ( 42 ) ,
304
355
) ;
305
356
t (
@@ -308,6 +359,7 @@ mod test {
308
359
cs_arm64_op__bindgen_ty_2 {
309
360
reg : ARM64_SYSREG_MDRAR_EL1 as arm64_reg:: Type ,
310
361
} ,
362
+ ARM64_SVCR_INVALID ,
311
363
) ,
312
364
RegMrs ( ARM64_SYSREG_MDRAR_EL1 ) ,
313
365
) ;
@@ -317,15 +369,24 @@ mod test {
317
369
cs_arm64_op__bindgen_ty_2 {
318
370
pstate : ARM64_PSTATE_SPSEL ,
319
371
} ,
372
+ ARM64_SVCR_INVALID ,
320
373
) ,
321
374
Pstate ( Arm64Pstate :: ARM64_PSTATE_SPSEL ) ,
322
375
) ;
323
376
t (
324
- ( ARM64_OP_FP , cs_arm64_op__bindgen_ty_2 { fp : 0.0 } ) ,
377
+ (
378
+ ARM64_OP_FP ,
379
+ cs_arm64_op__bindgen_ty_2 { fp : 0.0 } ,
380
+ ARM64_SVCR_INVALID ,
381
+ ) ,
325
382
Fp ( 0.0 ) ,
326
383
) ;
327
384
t (
328
- ( ARM64_OP_CIMM , cs_arm64_op__bindgen_ty_2 { imm : 42 } ) ,
385
+ (
386
+ ARM64_OP_CIMM ,
387
+ cs_arm64_op__bindgen_ty_2 { imm : 42 } ,
388
+ ARM64_SVCR_INVALID ,
389
+ ) ,
329
390
Cimm ( 42 ) ,
330
391
) ;
331
392
t (
@@ -334,6 +395,7 @@ mod test {
334
395
cs_arm64_op__bindgen_ty_2 {
335
396
reg : arm64_sysreg:: ARM64_SYSREG_ICC_EOIR1_EL1 as arm64_reg:: Type ,
336
397
} ,
398
+ ARM64_SVCR_INVALID ,
337
399
) ,
338
400
RegMsr ( arm64_sysreg:: ARM64_SYSREG_ICC_EOIR1_EL1 ) ,
339
401
) ;
@@ -343,6 +405,7 @@ mod test {
343
405
cs_arm64_op__bindgen_ty_2 {
344
406
sys : arm64_sys_op:: ARM64_AT_S1E0R ,
345
407
} ,
408
+ ARM64_SVCR_INVALID ,
346
409
) ,
347
410
Sys ( arm64_sys_op:: ARM64_AT_S1E0R ) ,
348
411
) ;
@@ -352,8 +415,35 @@ mod test {
352
415
cs_arm64_op__bindgen_ty_2 {
353
416
prefetch : ARM64_PRFM_PLDL2KEEP ,
354
417
} ,
418
+ ARM64_SVCR_INVALID ,
355
419
) ,
356
420
Prefetch ( ARM64_PRFM_PLDL2KEEP ) ,
357
421
) ;
422
+ t (
423
+ (
424
+ ARM64_OP_SVCR ,
425
+ cs_arm64_op__bindgen_ty_2 { reg : 0 } ,
426
+ ARM64_SVCR_SVCRSM ,
427
+ ) ,
428
+ SVCR ( ARM64_SVCR_SVCRSM ) ,
429
+ ) ;
430
+ t (
431
+ (
432
+ ARM64_OP_SME_INDEX ,
433
+ cs_arm64_op__bindgen_ty_2 {
434
+ sme_index : arm64_op_sme_index {
435
+ reg : 1 ,
436
+ base : 2 ,
437
+ disp : 3 ,
438
+ } ,
439
+ } ,
440
+ ARM64_SVCR_INVALID ,
441
+ ) ,
442
+ SMEIndex ( Arm64OpSmeIndex ( arm64_op_sme_index {
443
+ reg : 1 ,
444
+ base : 2 ,
445
+ disp : 3 ,
446
+ } ) ) ,
447
+ ) ;
358
448
}
359
449
}
0 commit comments