From e15279ed1f02d5a4a44cc6d57a4053390002376a Mon Sep 17 00:00:00 2001 From: flobernd Date: Mon, 26 Jun 2017 00:02:00 +0200 Subject: [PATCH] Fixed operand-action for EVEX/MVEX instructions with write-mask (again) --- src/Decoder.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Decoder.c b/src/Decoder.c index f728493..c05e7b5 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -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; } }