@@ -240,197 +240,126 @@ typedef struct ZydisDecodedOperand_
240
240
/* ============================================================================================== */
241
241
242
242
/* ---------------------------------------------------------------------------------------------- */
243
- /* R/E/FLAGS info */
243
+ /* CPU/FPU flags */
244
244
/* ---------------------------------------------------------------------------------------------- */
245
245
246
246
/**
247
- * Defines the `ZydisCPUFlags ` data-type.
247
+ * Defines the `ZydisAccessedFlagsMask ` data-type.
248
248
*/
249
- typedef ZyanU32 ZydisCPUFlags ;
250
-
251
- /**
252
- * Defines the `ZydisCPUFlag` data-type.
253
- */
254
- typedef ZyanU8 ZydisCPUFlag ;
249
+ typedef ZyanU32 ZydisAccessedFlagsMask ;
255
250
256
251
/**
257
252
* Carry flag.
258
253
*/
259
- #define ZYDIS_CPUFLAG_CF 0
254
+ #define ZYDIS_CPUFLAG_CF (1ul << 0)
260
255
/**
261
256
* Parity flag.
262
257
*/
263
- #define ZYDIS_CPUFLAG_PF 2
258
+ #define ZYDIS_CPUFLAG_PF (1ul << 2)
264
259
/**
265
260
* Adjust flag.
266
261
*/
267
- #define ZYDIS_CPUFLAG_AF 4
262
+ #define ZYDIS_CPUFLAG_AF (1ul << 4)
268
263
/**
269
264
* Zero flag.
270
265
*/
271
- #define ZYDIS_CPUFLAG_ZF 6
266
+ #define ZYDIS_CPUFLAG_ZF (1ul << 6)
272
267
/**
273
268
* Sign flag.
274
269
*/
275
- #define ZYDIS_CPUFLAG_SF 7
270
+ #define ZYDIS_CPUFLAG_SF (1ul << 7)
276
271
/**
277
272
* Trap flag.
278
273
*/
279
- #define ZYDIS_CPUFLAG_TF 8
274
+ #define ZYDIS_CPUFLAG_TF (1ul << 8)
280
275
/**
281
276
* Interrupt enable flag.
282
277
*/
283
- #define ZYDIS_CPUFLAG_IF 9
278
+ #define ZYDIS_CPUFLAG_IF (1ul << 9)
284
279
/**
285
280
* Direction flag.
286
281
*/
287
- #define ZYDIS_CPUFLAG_DF 10
282
+ #define ZYDIS_CPUFLAG_DF (1ul << 10)
288
283
/**
289
284
* Overflow flag.
290
285
*/
291
- #define ZYDIS_CPUFLAG_OF 11
286
+ #define ZYDIS_CPUFLAG_OF (1ul << 11)
292
287
/**
293
288
* I/O privilege level flag.
294
289
*/
295
- #define ZYDIS_CPUFLAG_IOPL 12
290
+ #define ZYDIS_CPUFLAG_IOPL (1ul << 12)
296
291
/**
297
292
* Nested task flag.
298
293
*/
299
- #define ZYDIS_CPUFLAG_NT 14
294
+ #define ZYDIS_CPUFLAG_NT (1ul << 14)
300
295
/**
301
296
* Resume flag.
302
297
*/
303
- #define ZYDIS_CPUFLAG_RF 16
298
+ #define ZYDIS_CPUFLAG_RF (1ul << 16)
304
299
/**
305
300
* Virtual 8086 mode flag.
306
301
*/
307
- #define ZYDIS_CPUFLAG_VM 17
302
+ #define ZYDIS_CPUFLAG_VM (1ul << 17)
308
303
/**
309
304
* Alignment check.
310
305
*/
311
- #define ZYDIS_CPUFLAG_AC 18
306
+ #define ZYDIS_CPUFLAG_AC (1ul << 18)
312
307
/**
313
308
* Virtual interrupt flag.
314
309
*/
315
- #define ZYDIS_CPUFLAG_VIF 19
310
+ #define ZYDIS_CPUFLAG_VIF (1ul << 19)
316
311
/**
317
312
* Virtual interrupt pending.
318
313
*/
319
- #define ZYDIS_CPUFLAG_VIP 20
314
+ #define ZYDIS_CPUFLAG_VIP (1ul << 20)
320
315
/**
321
316
* Able to use CPUID instruction.
322
317
*/
323
- #define ZYDIS_CPUFLAG_ID 21
324
-
325
- ///////////////////////////////////////////////////////////////////////////////////////////////////
326
-
327
- /**
328
- * FPU condition-code flag 0.
329
- *
330
- * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
331
- * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
332
- * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
333
- */
334
- #define ZYDIS_CPUFLAG_C0 22
335
- /**
336
- * FPU condition-code flag 1.
337
- *
338
- * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
339
- * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
340
- * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
341
- */
342
- #define ZYDIS_CPUFLAG_C1 23
343
- /**
344
- * FPU condition-code flag 2.
345
- *
346
- * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
347
- * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
348
- * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
349
- */
350
- #define ZYDIS_CPUFLAG_C2 24
351
- /**
352
- * FPU condition-code flag 3.
353
- *
354
- * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
355
- * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
356
- * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
357
- */
358
- #define ZYDIS_CPUFLAG_C3 25
359
-
360
- /**
361
- * DEPRECATED. This define will be removed in the next major release.
362
- */
363
- #define ZYDIS_CPUFLAG_MAX_VALUE ZYDIS_CPUFLAG_C3
364
-
365
- ///////////////////////////////////////////////////////////////////////////////////////////////////
366
-
367
- /**
368
- * Defines the `ZydisFPUFlags` data-type.
369
- */
370
- typedef ZyanU8 ZydisFPUFlags ;
318
+ #define ZYDIS_CPUFLAG_ID (1ul << 21)
371
319
372
320
/**
373
321
* FPU condition-code flag 0.
374
322
*/
375
- #define ZYDIS_FPUFLAG_C0 0x00 // (1 << 0)
323
+ #define ZYDIS_FPUFLAG_C0 (1ul << 0)
376
324
/**
377
325
* FPU condition-code flag 1.
378
326
*/
379
- #define ZYDIS_FPUFLAG_C1 0x01 // (1 << 1)
327
+ #define ZYDIS_FPUFLAG_C1 (1ul << 1)
380
328
/**
381
329
* FPU condition-code flag 2.
382
330
*/
383
- #define ZYDIS_FPUFLAG_C2 0x02 // (1 << 2)
331
+ #define ZYDIS_FPUFLAG_C2 (1ul << 2)
384
332
/**
385
333
* FPU condition-code flag 3.
386
334
*/
387
- #define ZYDIS_FPUFLAG_C3 0x04 // (1 << 3)
335
+ #define ZYDIS_FPUFLAG_C3 (1ul << 3)
388
336
389
- /**
390
- * Defines the `ZydisCPUFlagAction` enum.
391
- *
392
- * DEPRECATED. This enum will be removed in the next major release.
337
+ /*
338
+ * Information about CPU/FPU flags accessed by the instruction.
393
339
*/
394
- typedef enum ZydisCPUFlagAction_
340
+ typedef struct ZydisAccessedFlags_
395
341
{
396
- /**
397
- * The CPU flag is not touched by the instruction.
398
- */
399
- ZYDIS_CPUFLAG_ACTION_NONE ,
400
- /**
401
- * The CPU flag is tested (read).
402
- */
403
- ZYDIS_CPUFLAG_ACTION_TESTED ,
404
- /**
405
- * The CPU flag is tested and modified afterwards (read-write).
406
- */
407
- ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED ,
408
- /**
409
- * The CPU flag is modified (write).
410
- */
411
- ZYDIS_CPUFLAG_ACTION_MODIFIED ,
412
- /**
413
- * The CPU flag is set to 0 (write).
342
+ /*
343
+ * As mask containing the flags `TESTED` by the instruction.
414
344
*/
415
- ZYDIS_CPUFLAG_ACTION_SET_0 ,
416
- /**
417
- * The CPU flag is set to 1 (write) .
345
+ ZydisAccessedFlagsMask tested ;
346
+ /*
347
+ * As mask containing the flags `MODIFIED` by the instruction .
418
348
*/
419
- ZYDIS_CPUFLAG_ACTION_SET_1 ,
420
- /**
421
- * The CPU flag is undefined (write) .
349
+ ZydisAccessedFlagsMask modified ;
350
+ /*
351
+ * As mask containing the flags `SET_0` by the instruction .
422
352
*/
423
- ZYDIS_CPUFLAG_ACTION_UNDEFINED ,
424
-
425
- /**
426
- * Maximum value of this enum.
353
+ ZydisAccessedFlagsMask set_0 ;
354
+ /*
355
+ * As mask containing the flags `SET_1` by the instruction.
427
356
*/
428
- ZYDIS_CPUFLAG_ACTION_MAX_VALUE = ZYDIS_CPUFLAG_ACTION_UNDEFINED ,
429
- /**
430
- * The minimum number of bits required to represent all values of this enum .
357
+ ZydisAccessedFlagsMask set_1 ;
358
+ /*
359
+ * As mask containing the flags `UNDEFINED` by the instruction .
431
360
*/
432
- ZYDIS_CPUFLAG_ACTION_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT ( ZYDIS_CPUFLAG_ACTION_MAX_VALUE )
433
- } ZydisCPUFlagAction ;
361
+ ZydisAccessedFlagsMask undefined ;
362
+ } ZydisAccessedFlags ;
434
363
435
364
/* ---------------------------------------------------------------------------------------------- */
436
365
/* Branch types */
@@ -803,48 +732,16 @@ typedef struct ZydisDecodedInstruction_
803
732
*/
804
733
ZydisInstructionAttributes attributes ;
805
734
/**
806
- * Information about accessed CPU flags.
807
- *
808
- * DEPRECATED. This field will be removed in the next major release. Please use the
809
- * `cpu_flags_read`/`cpu_flags_written` or `fpu_flags_read`/`fpu_flags_written` fields
810
- * instead.
811
- */
812
- struct ZydisDecodedInstructionAccessedFlags_
813
- {
814
- /**
815
- * The CPU-flag action.
816
- *
817
- * Use `ZydisGetAccessedFlagsByAction` to get a mask with all flags matching a specific
818
- * action.
819
- */
820
- ZydisCPUFlagAction action ;
821
- } accessed_flags [ZYDIS_CPUFLAG_MAX_VALUE + 1 ];
822
- /**
823
- * A mask containing the CPU flags read by the instruction.
735
+ * Information about CPU flags accessed by the instruction.
824
736
*
825
- * The bits in this mask correspond to the actual bits in the `FLAGS/EFLAGS/RFLAGS`
737
+ * The bits in the masks correspond to the actual bits in the `FLAGS/EFLAGS/RFLAGS`
826
738
* register.
827
- *
828
- * This mask includes the actions `TESTED` and `TESTED_MODIFIED`.
829
- */
830
- ZydisCPUFlags cpu_flags_read ;
831
- /**
832
- * A mask containing the CPU flags written by the instruction.
833
- *
834
- * The bits in this mask correspond to the actual bits in the `FLAGS/EFLAGS/RFLAGS`
835
- * register.
836
- *
837
- * This mask includes the actions `TESTED_MODIFIED`, `SET_0`, `SET_1` and `UNDEFINED`.
838
- */
839
- ZydisCPUFlags cpu_flags_written ;
840
- /**
841
- * A mask containing the FPU flags read by the instruction.
842
739
*/
843
- ZydisFPUFlags fpu_flags_read ;
740
+ const ZydisAccessedFlags * cpu_flags ;
844
741
/**
845
- * A mask containing the FPU flags written by the instruction.
742
+ * Information about FPU flags accessed by the instruction.
846
743
*/
847
- ZydisFPUFlags fpu_flags_written ;
744
+ const ZydisAccessedFlags * fpu_flags ;
848
745
/**
849
746
* Extended info for `AVX` instructions.
850
747
*/
0 commit comments