Skip to content

Commit

Permalink
Fix has_egpr flag
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Nov 5, 2024
1 parent 0848597 commit 58acf3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -4676,10 +4676,16 @@ static ZyanStatus ZydisPopulateRegisterIds(ZydisDecoderContext* context,

// Update APX info

if (!is_64_bit)
{
return ZYAN_STATUS_SUCCESS;
}

const ZyanBool has_egpr_reg = (def_reg == ZYDIS_REGKIND_GPR) && (id_reg >= 16);
const ZyanBool has_egpr_rm = is_mod_reg && (def_rm == ZYDIS_REGKIND_GPR) && (id_rm >= 16);
const ZyanBool has_egpr_vvvv = (def_vvvv == ZYDIS_REGKIND_GPR) && (id_vvvv >= 16);
const ZyanBool has_egpr_base = !is_mod_reg && (id_base >= 16);
const ZyanBool has_egpr_base = !is_mod_reg && (id_base >= 16) &&
((instruction->raw.modrm.mod != 0) || (instruction->raw.modrm.rm != 5));
const ZyanBool has_egpr_index = !is_mod_reg && !has_vsib && (id_index >= 16);

if (has_egpr_reg || has_egpr_rm || has_egpr_vvvv || has_egpr_base || has_egpr_index)
Expand Down

0 comments on commit 58acf3c

Please sign in to comment.