mirror of https://github.com/x64dbg/zydis
Formatter does now print the `far` modifier for the respective instructions
This commit is contained in:
parent
6315e29aa5
commit
2145c399b5
|
@ -70,16 +70,16 @@ typedef uint32_t ZydisFormatterFlags;
|
||||||
/**
|
/**
|
||||||
* @brief Formats the instruction in uppercase instead of lowercase.
|
* @brief Formats the instruction in uppercase instead of lowercase.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_FMTFLAG_UPPERCASE 0x00000001
|
#define ZYDIS_FMTFLAG_UPPERCASE 0x00000001 // (1 << 0)
|
||||||
/**
|
/**
|
||||||
* @brief Forces the formatter to always print the segment register of memory-operands, instead
|
* @brief Forces the formatter to always print the segment register of memory-operands, instead
|
||||||
* of ommiting implicit DS/SS segments.
|
* of ommiting implicit DS/SS segments.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_FMTFLAG_FORCE_SEGMENTS 0x00000002
|
#define ZYDIS_FMTFLAG_FORCE_SEGMENTS 0x00000002 // (1 << 1)
|
||||||
/**
|
/**
|
||||||
* @brief Forces the formatter to always print the size of memory-operands.
|
* @brief Forces the formatter to always print the size of memory-operands.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_FMTFLAG_FORCE_OPERANDSIZE 0x00000004
|
#define ZYDIS_FMTFLAG_FORCE_OPERANDSIZE 0x00000004 // (1 << 2)
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -2032,6 +2032,10 @@ static void ZydisSetAttributes(ZydisDecoderContext* context, ZydisDecodedInstruc
|
||||||
}
|
}
|
||||||
if (def->isFarBranch)
|
if (def->isFarBranch)
|
||||||
{
|
{
|
||||||
|
ZYDIS_ASSERT((instruction->meta.category == ZYDIS_CATEGORY_CALL) ||
|
||||||
|
(instruction->meta.category == ZYDIS_CATEGORY_COND_BR) ||
|
||||||
|
(instruction->meta.category == ZYDIS_CATEGORY_UNCOND_BR) ||
|
||||||
|
(instruction->meta.category == ZYDIS_CATEGORY_RET));
|
||||||
instruction->attributes |= ZYDIS_ATTRIB_IS_FAR_BRANCH;
|
instruction->attributes |= ZYDIS_ATTRIB_IS_FAR_BRANCH;
|
||||||
}
|
}
|
||||||
if (def->acceptsLock)
|
if (def->acceptsLock)
|
||||||
|
|
|
@ -97,12 +97,21 @@ static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* format
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* bufEnd = *buffer + bufferLen;
|
||||||
|
|
||||||
const char* mnemonic = ZydisMnemonicGetString(instruction->mnemonic);
|
const char* mnemonic = ZydisMnemonicGetString(instruction->mnemonic);
|
||||||
if (!mnemonic)
|
if (!mnemonic)
|
||||||
{
|
{
|
||||||
mnemonic = "invalid";
|
mnemonic = "invalid";
|
||||||
}
|
}
|
||||||
return ZydisPrintStr(buffer, bufferLen, mnemonic, ZYDIS_LETTER_CASE);
|
ZYDIS_CHECK(ZydisPrintStr(buffer, bufferLen, mnemonic, ZYDIS_LETTER_CASE));
|
||||||
|
|
||||||
|
if (instruction->attributes & ZYDIS_ATTRIB_IS_FAR_BRANCH)
|
||||||
|
{
|
||||||
|
return ZydisPrintStr(buffer, bufEnd - *buffer, " far", ZYDIS_LETTER_CASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
Loading…
Reference in New Issue