Fixed operand-action for EVEX/MVEX instructions with write-mask (again)

This commit is contained in:
flobernd 2017-06-26 00:02:00 +02:00
parent 0c38e08306
commit e15279ed1f
1 changed files with 9 additions and 7 deletions

View File

@ -1927,21 +1927,23 @@ FinalizeOperand:
// 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))
{
switch (info->operands[0].action)
switch (info->operands[0].type)
{
case ZYDIS_OPERAND_ACTION_WRITE:
info->operands[0].action = ZYDIS_OPERAND_ACTION_CONDWRITE;
break;
case ZYDIS_OPERAND_ACTION_READWRITE:
case ZYDIS_OPERAND_TYPE_REGISTER:
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;
break;
case ZYDIS_OPERAND_TYPE_MEMORY:
ZYDIS_ASSERT(info->operands[0].action == ZYDIS_OPERAND_ACTION_WRITE);
info->operands[0].action = ZYDIS_OPERAND_ACTION_CONDWRITE;
break;
default:
ZYDIS_UNREACHABLE;
break;
}
}