You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] (cosmetic): Operand_Size returns 16 when 66 is present for VEX or EVEX (not a size override per se) #124
<definition name="Operand_Size" kind="Function"><shortdesc><phrase>Size of operands</phrase></shortdesc>
<category>operands</category>
<longdesc/>
<operation>
<code>function Operand_Size(context : Instruction_Context) -> {16, 32, 64}</code>
<code>begin</code>
<code> if In_64Bit_Mode() then</code>
<code> if context.rex_prefix_present</code>
<code> or context.rex2_prefix_present</code>
<code> or context.vex_prefix_present</code>
<code> or context.evex_prefix_present</code>
<code> then</code>
<code> if context.rex_w == 0b0 then</code>
<code> return if context.osz_prefix_present or context.vex_pp == 0b01 then 16 else 32;</code>
<code> else</code>
<code> return 64;</code>
<code> endif;</code>
<code> else</code>
<code> return if context.osz_prefix_present then 16 else 32;</code>
<code> endif;</code>
<code> else</code>
<code> if CS.descriptor.D == 0b0 then</code>
<code> return if context.osz_prefix_present then 32 else 16;</code>
<code> else</code>
<code> return if context.osz_prefix_present then 16 else 32;</code>
<code> endif;</code>
<code> endif;</code>
<code>end</code>
This block in particular looks questionable
<code> if context.rex_w == 0b0 then</code>
<code> return if context.osz_prefix_present or context.vex_pp == 0b01 then 16 else 32;</code>
<code> else</code>
I believe vex_pp in this case is a 66 prefix that's just part of the encoding, not a size override? For example, XED finds xed_operand_values_get_effective_operand_width() == 32 for c4 e3 79 32 c1 01 (KSHIFTLB k0, k1, 1), while the logic above returns 16.
All the cases I've found so far were cosmetic (correct value computed either way), but it's a bit unnerving when the SDM disagrees with XED on an instruction's operand size.
This might be related to #94 ? Either way, PCMPESTRM also has a mandatory 66 that's not a size override prefix.
Activity