@@ -2809,7 +2809,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
28092809 }
28102810
28112811 // Mask
2812- instruction -> avx .mask .reg = ZYDIS_REGISTER_K0 + instruction -> raw . evex . aaa ;
2812+ instruction -> avx .mask .reg = ZYDIS_REGISTER_K0 + context -> vector_unified . mask ;
28132813 switch (def -> mask_override )
28142814 {
28152815 case ZYDIS_MASK_OVERRIDE_DEFAULT :
@@ -2824,7 +2824,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
28242824 default :
28252825 ZYAN_UNREACHABLE ;
28262826 }
2827- if (!instruction -> raw . evex . aaa )
2827+ if (!context -> vector_unified . mask )
28282828 {
28292829 instruction -> avx .mask .mode = ZYDIS_MASK_MODE_DISABLED ;
28302830 }
@@ -3129,8 +3129,17 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
31293129 }
31303130
31313131 // Mask
3132- instruction -> avx .mask .mode = ZYDIS_MASK_MODE_MERGING ;
3133- instruction -> avx .mask .reg = ZYDIS_REGISTER_K0 + instruction -> raw .mvex .kkk ;
3132+ if (def -> mask_policy == ZYDIS_MASK_POLICY_ALLOWED )
3133+ {
3134+ instruction -> avx .mask .mode = ZYDIS_MASK_MODE_MERGING ;
3135+ instruction -> avx .mask .reg = ZYDIS_REGISTER_K0 + context -> vector_unified .mask ;
3136+ }
3137+ else
3138+ {
3139+ ZYAN_ASSERT (def -> mask_policy == ZYDIS_MASK_POLICY_INVALID );
3140+ instruction -> avx .mask .mode = ZYDIS_MASK_MODE_NONE ;
3141+ instruction -> avx .mask .reg = ZYDIS_REGISTER_K0 ;
3142+ }
31343143#else
31353144 ZYAN_UNREACHABLE ;
31363145#endif
@@ -4379,6 +4388,8 @@ static ZyanStatus ZydisNodeHandlerEvexNF(ZydisDecoderContext* context,
43794388 return ZYDIS_STATUS_DECODING_ERROR ;
43804389 }
43814390
4391+ context -> vector_unified .mask = 0 ;
4392+
43824393 * index = instruction -> raw .evex .NF ;
43834394 return ZYAN_STATUS_SUCCESS ;
43844395}
@@ -4409,6 +4420,7 @@ static ZyanStatus ZydisNodeHandlerEvexSCC(ZydisDecoderContext* context,
44094420
44104421 context -> vector_unified .vvvv = (~context -> vector_unified .vvvv ) & 0x0F ;
44114422 context -> vector_unified .V4 = 0 ;
4423+ context -> vector_unified .mask = 0 ;
44124424
44134425 instruction -> apx .scc = ZYDIS_SCC_O + instruction -> raw .evex .SCC ;
44144426
0 commit comments