@@ -4450,7 +4450,7 @@ static ZyanStatus ZydisNodeHandlerMvexE(const ZydisDecodedInstruction* instructi
4450
4450
* - `def_vvvv` -> `ZydisRegisterKind`
4451
4451
*/
4452
4452
static ZyanStatus ZydisPopulateRegisterIds (ZydisDecoderContext * context ,
4453
- const ZydisDecodedInstruction * instruction , ZyanU8 def_reg , ZyanU8 def_rm , ZyanU8 def_vvvv )
4453
+ ZydisDecodedInstruction * instruction , ZyanU8 def_reg , ZyanU8 def_rm , ZyanU8 def_vvvv )
4454
4454
{
4455
4455
ZYAN_ASSERT (context );
4456
4456
ZYAN_ASSERT (instruction );
@@ -4673,6 +4673,19 @@ static ZyanStatus ZydisPopulateRegisterIds(ZydisDecoderContext* context,
4673
4673
context -> reg_info .id_base = !is_mod_reg ? id_base : -1 ;
4674
4674
context -> reg_info .id_index = !is_mod_reg ? id_index : -1 ;
4675
4675
4676
+ // Update APX info
4677
+
4678
+ const ZyanBool has_egpr_reg = (def_reg == ZYDIS_REGKIND_GPR ) && (id_reg >= 16 );
4679
+ const ZyanBool has_egpr_rm = is_mod_reg && (def_rm == ZYDIS_REGKIND_GPR ) && (id_rm >= 16 );
4680
+ const ZyanBool has_egpr_vvvv = (def_vvvv == ZYDIS_REGKIND_GPR ) && (id_vvvv >= 16 );
4681
+ const ZyanBool has_egpr_base = !is_mod_reg && (id_base >= 16 );
4682
+ const ZyanBool has_egpr_index = !is_mod_reg && !has_vsib && (id_index >= 16 );
4683
+
4684
+ if (has_egpr_reg || has_egpr_rm || has_egpr_vvvv || has_egpr_base || has_egpr_index )
4685
+ {
4686
+ instruction -> apx .uses_egpr = ZYAN_TRUE ;
4687
+ }
4688
+
4676
4689
return ZYAN_STATUS_SUCCESS ;
4677
4690
}
4678
4691
@@ -4688,7 +4701,7 @@ static ZyanStatus ZydisPopulateRegisterIds(ZydisDecoderContext* context,
4688
4701
* This function is called immediately after a valid instruction-definition was found.
4689
4702
*/
4690
4703
static ZyanStatus ZydisCheckErrorConditions (ZydisDecoderState * state ,
4691
- const ZydisDecodedInstruction * instruction , const ZydisInstructionDefinition * definition )
4704
+ ZydisDecodedInstruction * instruction , const ZydisInstructionDefinition * definition )
4692
4705
{
4693
4706
ZYAN_ASSERT (state );
4694
4707
ZYAN_ASSERT (instruction );
0 commit comments