From 0957a57ab472c4396113c456d738a09d84b6cae7 Mon Sep 17 00:00:00 2001 From: flobernd Date: Sat, 24 Jun 2017 00:01:21 +0200 Subject: [PATCH] Fixed vector-length for EVEX instructions with fixed vector-length --- src/Decoder.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Decoder.c b/src/Decoder.c index 661143b..6c9f27c 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -2248,6 +2248,29 @@ static void ZydisSetPrefixRelatedAttributes(ZydisDecoderContext* context, * @param context A pointer to the @c ZydisDecoderContext struct. * @param info A pointer to the @c ZydisInstructionInfo struct. * @param definition A pointer to the @c ZydisInstructionDefinition struct. + * + * Information set for XOP: + * - Vector Length + * + * Information set for VEX: + * - Vector length + * - Static broadcast-factor + * + * Information set for EVEX: + * - Vector length + * - Broadcast-factor (static and dynamic) + * - Rounding-mode and SAE + * - Mask mode + * - Compressed 8-bit displacement scale-factor + * + * Information set for MVEX: + * - Vector length + * - Broadcast-factor (static and dynamic) + * - Rounding-mode and SAE + * - Swizzle- and conversion-mode + * - Mask mode + * - Eviction hint + * - Compressed 8-bit displacement scale-factor */ static void ZydisSetAVXInformation(ZydisDecoderContext* context, ZydisInstructionInfo* info, const ZydisInstructionDefinition* definition) @@ -2324,7 +2347,6 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context, { vectorLength = def->vectorLength - 1; } - // Vector length static const ZydisVectorLength lookup[3] = { ZYDIS_VECTOR_LENGTH_128, @@ -2332,7 +2354,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context, ZYDIS_VECTOR_LENGTH_512 }; ZYDIS_ASSERT(context->cache.LL < ZYDIS_ARRAY_SIZE(lookup)); - info->avx.vectorLength = lookup[context->cache.LL]; + info->avx.vectorLength = lookup[vectorLength]; context->evex.tupleType = def->tupleType; if (def->tupleType)