From d7c81e5104aaa6e5af391afb0a006da59e7588c4 Mon Sep 17 00:00:00 2001 From: flobernd Date: Thu, 29 Jun 2017 20:40:48 +0200 Subject: [PATCH] Fixed operand-size of some special MVEX instructions --- .../Zydis/Internal/InstructionDefinitions.inc | 16 ++++++++-------- src/Decoder.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/Zydis/Internal/InstructionDefinitions.inc b/include/Zydis/Internal/InstructionDefinitions.inc index 12b62b7..cb37ab6 100644 --- a/include/Zydis/Internal/InstructionDefinitions.inc +++ b/include/Zydis/Internal/InstructionDefinitions.inc @@ -6695,8 +6695,8 @@ const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[] = /*0094*/ { ZYDIS_MNEMONIC_VFNMSUB231PS, 4, 0x0890, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0095*/ { ZYDIS_MNEMONIC_VFNMSUB231PS, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SWIZZLE_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0096*/ { ZYDIS_MNEMONIC_VFNMSUB231PS, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_RC, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*0097*/ { ZYDIS_MNEMONIC_VGATHERDPD, 3, 0x11D1, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*0098*/ { ZYDIS_MNEMONIC_VGATHERDPS, 3, 0x11D4, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, + /*0097*/ { ZYDIS_MNEMONIC_VGATHERDPD, 3, 0x11D1, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, + /*0098*/ { ZYDIS_MNEMONIC_VGATHERDPS, 3, 0x11D4, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, /*0099*/ { ZYDIS_MNEMONIC_VGATHERPF0DPS, 2, 0x16E4, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*009A*/ { ZYDIS_MNEMONIC_VGATHERPF0HINTDPD, 2, 0x16E4, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*009B*/ { ZYDIS_MNEMONIC_VGATHERPF0HINTDPS, 2, 0x16E4, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, @@ -6825,8 +6825,8 @@ const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[] = /*0116*/ { ZYDIS_MNEMONIC_VPERMF32X4, 4, 0x08D4, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_F_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0117*/ { ZYDIS_MNEMONIC_VPERMF32X4, 4, 0x08D8, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0118*/ { ZYDIS_MNEMONIC_VPERMF32X4, 4, 0x08D8, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*0119*/ { ZYDIS_MNEMONIC_VPGATHERDD, 3, 0x11F2, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*011A*/ { ZYDIS_MNEMONIC_VPGATHERDQ, 3, 0x11F5, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UI_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, + /*0119*/ { ZYDIS_MNEMONIC_VPGATHERDD, 3, 0x11F2, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, + /*011A*/ { ZYDIS_MNEMONIC_VPGATHERDQ, 3, 0x11F5, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UI_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, /*011B*/ { ZYDIS_MNEMONIC_VPMADD231D, 4, 0x0890, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*011C*/ { ZYDIS_MNEMONIC_VPMADD231D, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SWIZZLE_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*011D*/ { ZYDIS_MNEMONIC_VPMADD231D, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, @@ -6874,8 +6874,8 @@ const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[] = /*0147*/ { ZYDIS_MNEMONIC_VPSBBRD, 4, 0x08CC, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0148*/ { ZYDIS_MNEMONIC_VPSBBRD, 4, 0x08D0, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SWIZZLE_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0149*/ { ZYDIS_MNEMONIC_VPSBBRD, 4, 0x08D0, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*014A*/ { ZYDIS_MNEMONIC_VPSCATTERDD, 3, 0x11F8, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*014B*/ { ZYDIS_MNEMONIC_VPSCATTERDQ, 3, 0x11FB, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DI_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, + /*014A*/ { ZYDIS_MNEMONIC_VPSCATTERDD, 3, 0x11F8, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, + /*014B*/ { ZYDIS_MNEMONIC_VPSCATTERDQ, 3, 0x11FB, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DI_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, /*014C*/ { ZYDIS_MNEMONIC_VPSHUFD, 4, 0x08D4, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_F_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*014D*/ { ZYDIS_MNEMONIC_VPSHUFD, 4, 0x08D8, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*014E*/ { ZYDIS_MNEMONIC_VPSHUFD, 4, 0x08D8, 0x00, ZYDIS_FALSE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, @@ -6933,8 +6933,8 @@ const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[] = /*0182*/ { ZYDIS_MNEMONIC_VSCALEPS, 4, 0x0890, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SI_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0183*/ { ZYDIS_MNEMONIC_VSCALEPS, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_SWIZZLE_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0184*/ { ZYDIS_MNEMONIC_VSCALEPS, 4, 0x039B, 0x00, ZYDIS_TRUE, ZYDIS_FALSE, ZYDIS_MVEX_FUNC_INVALID, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*0185*/ { ZYDIS_MNEMONIC_VSCATTERDPD, 3, 0x11FE, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DF_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, - /*0186*/ { ZYDIS_MNEMONIC_VSCATTERDPS, 3, 0x1201, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, + /*0185*/ { ZYDIS_MNEMONIC_VSCATTERDPD, 3, 0x11FE, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DF_64, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, + /*0186*/ { ZYDIS_MNEMONIC_VSCATTERDPS, 3, 0x1201, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_DF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16 }, /*0187*/ { ZYDIS_MNEMONIC_VSCATTERPF0DPS, 2, 0x11F8, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0188*/ { ZYDIS_MNEMONIC_VSCATTERPF0HINTDPD, 2, 0x11F8, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, /*0189*/ { ZYDIS_MNEMONIC_VSCATTERPF0HINTDPS, 2, 0x11F8, 0x00, ZYDIS_FALSE, ZYDIS_TRUE, ZYDIS_MVEX_FUNC_UF_32, ZYDIS_MASK_POLICY_ALLOWED, ZYDIS_FALSE, ZYDIS_MVEX_STATIC_BROADCAST_NONE }, diff --git a/src/Decoder.c b/src/Decoder.c index c905616..72e8af6 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -1114,21 +1114,29 @@ static void ZydisSetOperandSizeAndElementInfo(ZydisDecoderContext* context, switch (context->mvex.functionality) { case ZYDIS_MVEX_FUNC_SF_32: - case ZYDIS_MVEX_FUNC_SF_32_BCST: case ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16: case ZYDIS_MVEX_FUNC_UF_32: case ZYDIS_MVEX_FUNC_DF_32: operand->elementType = ZYDIS_ELEMENT_TYPE_FLOAT32; operand->elementSize = 32; break; + case ZYDIS_MVEX_FUNC_SF_32_BCST: + operand->size = 256; + operand->elementType = ZYDIS_ELEMENT_TYPE_FLOAT32; + operand->elementSize = 32; + break; case ZYDIS_MVEX_FUNC_SI_32: - case ZYDIS_MVEX_FUNC_SI_32_BCST: case ZYDIS_MVEX_FUNC_SI_32_BCST_4TO16: case ZYDIS_MVEX_FUNC_UI_32: case ZYDIS_MVEX_FUNC_DI_32: operand->elementType = ZYDIS_ELEMENT_TYPE_INT; operand->elementSize = 32; break; + case ZYDIS_MVEX_FUNC_SI_32_BCST: + operand->size = 256; + operand->elementType = ZYDIS_ELEMENT_TYPE_INT; + operand->elementSize = 32; + break; case ZYDIS_MVEX_FUNC_SF_64: case ZYDIS_MVEX_FUNC_UF_64: case ZYDIS_MVEX_FUNC_DF_64: