Cleaned up register-decoding code

This commit is contained in:
flobernd 2017-06-28 19:50:33 +02:00
parent 55400e9206
commit b118637dae
5 changed files with 787 additions and 579 deletions

View File

@ -258,7 +258,7 @@ enum ZydisFormatterHookTypes
ZYDIS_FORMATTER_HOOK_PRINT_SEGMENT,
/**
* @brief This function is called right after formatting an operand to print the optional
* avx-512 operand decorator.
* EVEX/MVEX operand-decorator.
*/
ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR,
/**

View File

@ -792,23 +792,7 @@ enum ZydisRoundingModes
/**
* @brief Round towards zero.
*/
ZYDIS_ROUNDING_MODE_RZ,
/**
* @brief Round to nearest and suppress all exceptions.
*/
ZYDIS_ROUNDING_MODE_RN_SAE,
/**
* @brief Round down and suppress all exceptions.
*/
ZYDIS_ROUNDING_MODE_RD_SAE,
/**
* @brief Round up and suppress all exceptions.
*/
ZYDIS_ROUNDING_MODE_RU_SAE,
/**
* @brief Round towards zero and suppress all exceptions.
*/
ZYDIS_ROUNDING_MODE_RZ_SAE
ZYDIS_ROUNDING_MODE_RZ
};
/* ---------------------------------------------------------------------------------------------- */

View File

@ -646,7 +646,7 @@ enum ZydisMaskPolicies
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR \
ZYDIS_INSTRUCTION_DEFINITION_BASE; \
ZydisBool hasNDSOperand ZYDIS_BITFIELD( 1)
ZydisBool hasNDSNDDOperand ZYDIS_BITFIELD( 1)
/**
* @brief Defines the @c ZydisInstructionDefinition struct.

File diff suppressed because it is too large Load Diff

View File

@ -720,15 +720,39 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisInstructionForma
if ((operand->id == (info->operandCount - 1)) ||
((operand->id != (info->operandCount - 1)) &&
(info->operands[operand->id + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE)))
{
if (info->avx.hasSAE)
{
switch (info->avx.roundingMode)
{
case ZYDIS_ROUNDING_MODE_INVALID:
if (info->avx.hasSAE)
{
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {sae}"));
break;
case ZYDIS_ROUNDING_MODE_RN:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rn-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RD:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rd-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RU:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {ru-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RZ:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rz-sae}"));
break;
default:
return ZYDIS_STATUS_INVALID_PARAMETER;
}
} else
{
switch (info->avx.roundingMode)
{
case ZYDIS_ROUNDING_MODE_INVALID:
break;
case ZYDIS_ROUNDING_MODE_RN:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
@ -746,25 +770,10 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisInstructionForma
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rz}"));
break;
case ZYDIS_ROUNDING_MODE_RN_SAE:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rn-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RD_SAE:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rd-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RU_SAE:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {ru-sae}"));
break;
case ZYDIS_ROUNDING_MODE_RZ_SAE:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {rz-sae}"));
break;
default:
return ZYDIS_STATUS_INVALID_PARAMETER;
}
}
switch (info->avx.swizzleMode)
{