Minor improvements to the instruction-decoder

- Set mask-mode to "merge" for all MVEX instructions
- Set operand-action of EVEX dest-operands to RCW, if a merge write-mask is specified
This commit is contained in:
flobernd 2017-06-24 03:20:45 +02:00
parent e04adf2b8d
commit 7d77e0747f
1 changed files with 17 additions and 0 deletions

View File

@ -1908,6 +1908,19 @@ FinalizeOperand:
++operand;
}
// Fix operand-action for EVEX instructions with merge-mask
if ((info->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) &&
(info->avx.maskMode == ZYDIS_MASK_MODE_MERGE) &&
(info->operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
(info->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
(info->operands[1].reg >= ZYDIS_REGISTER_K1) &&
(info->operands[1].reg <= ZYDIS_REGISTER_K7))
{
ZYDIS_ASSERT(info->operands[0].action == ZYDIS_OPERAND_ACTION_WRITE ||
info->operands[0].action == ZYDIS_OPERAND_ACTION_READWRITE);
info->operands[0].action = ZYDIS_OPERAND_ACTION_READ_CONDWRITE;
}
return ZYDIS_STATUS_SUCCESS;
}
@ -2727,6 +2740,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
// Mask mode
info->avx.maskMode = ZYDIS_MASK_MODE_MERGE + info->details.evex.z;
break;
}
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
@ -3019,6 +3033,9 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
info->avx.hasEvictionHint = ZYDIS_TRUE;
}
// Mask mode
info->avx.maskMode = ZYDIS_MASK_MODE_MERGE;
break;
}
default: