mirror of https://github.com/x64dbg/zydis
Allowed custom operand-sizes for register operands
This commit is contained in:
parent
4487d1b252
commit
17358016d9
|
@ -522,6 +522,10 @@ enum ZydisOpcodeMaps
|
||||||
*/
|
*/
|
||||||
typedef uint64_t ZydisInstructionAttributes;
|
typedef uint64_t ZydisInstructionAttributes;
|
||||||
|
|
||||||
|
// TODO: Update values
|
||||||
|
|
||||||
|
// TODO: Add IsAtomic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the ModRM byte.
|
* @brief The instruction has the ModRM byte.
|
||||||
*/
|
*/
|
||||||
|
@ -553,8 +557,7 @@ typedef uint64_t ZydisInstructionAttributes;
|
||||||
/**
|
/**
|
||||||
* @brief The instruction is privileged.
|
* @brief The instruction is privileged.
|
||||||
*
|
*
|
||||||
* Priviliged instructions are any instructions that require a current ring
|
* Priviliged instructions are any instructions that require a current ring level below 3.
|
||||||
* level below 3 or even SMM.
|
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_IS_PRIVILEGED 0x0000000000000080
|
#define ZYDIS_ATTRIB_IS_PRIVILEGED 0x0000000000000080
|
||||||
/**
|
/**
|
||||||
|
@ -606,14 +609,6 @@ typedef uint64_t ZydisInstructionAttributes;
|
||||||
* @brief The instruction accepts segment prefixes (0x2E, 0x36, 0x3E, 0x26, 0x64, 0x65).
|
* @brief The instruction accepts segment prefixes (0x2E, 0x36, 0x3E, 0x26, 0x64, 0x65).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000020000
|
#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000020000
|
||||||
/**
|
|
||||||
* @brief The instruction accepts the operand-size prefix (0x66).
|
|
||||||
*/
|
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_OPERANDSIZE 0x0000000000040000 // TODO: Remove
|
|
||||||
/**
|
|
||||||
* @brief The instruction accepts the address-size prefix (0x67).
|
|
||||||
*/
|
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_ADDRESSSIZE 0x0000000000080000 // TODO: Remove
|
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the lock prefix (0xF0).
|
* @brief The instruction has the lock prefix (0xF0).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -933,8 +933,14 @@ static void ZydisSetOperandSizeAndElementInfo(ZydisDecoderContext* context,
|
||||||
{
|
{
|
||||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||||
{
|
{
|
||||||
operand->size = (context->decoder->machineMode == 64) ?
|
if (definition->size[context->eoszIndex])
|
||||||
ZydisRegisterGetWidth64(operand->reg) : ZydisRegisterGetWidth(operand->reg);
|
{
|
||||||
|
operand->size = definition->size[context->eoszIndex] * 8;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
operand->size = (context->decoder->machineMode == 64) ?
|
||||||
|
ZydisRegisterGetWidth64(operand->reg) : ZydisRegisterGetWidth(operand->reg);
|
||||||
|
}
|
||||||
operand->elementType = ZYDIS_ELEMENT_TYPE_INT;
|
operand->elementType = ZYDIS_ELEMENT_TYPE_INT;
|
||||||
operand->elementSize = operand->size;
|
operand->elementSize = operand->size;
|
||||||
break;
|
break;
|
||||||
|
@ -2055,6 +2061,10 @@ static void ZydisSetPrefixRelatedAttributes(ZydisDecoderContext* context,
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
if (def->acceptsSegment)
|
||||||
|
{
|
||||||
|
info->attributes |= ZYDIS_ATTRIB_ACCEPTS_SEGMENT;
|
||||||
|
}
|
||||||
if (context->lastSegmentPrefix && def->acceptsSegment)
|
if (context->lastSegmentPrefix && def->acceptsSegment)
|
||||||
{
|
{
|
||||||
switch (context->lastSegmentPrefix)
|
switch (context->lastSegmentPrefix)
|
||||||
|
|
|
@ -500,11 +500,11 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(ZydisInstructionFormatter
|
||||||
uint32_t typecast = 0;
|
uint32_t typecast = 0;
|
||||||
if (formatter->flags & ZYDIS_FMTFLAG_FORCE_OPERANDSIZE)
|
if (formatter->flags & ZYDIS_FMTFLAG_FORCE_OPERANDSIZE)
|
||||||
{
|
{
|
||||||
if (info->operands[operand->id].type == ZYDIS_OPERAND_TYPE_MEMORY)
|
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) && (!operand->mem.isAddressGenOnly))
|
||||||
{
|
{
|
||||||
typecast = info->operands[operand->id].size;
|
typecast = info->operands[operand->id].size;
|
||||||
}
|
}
|
||||||
} else if (info->operands[operand->id].type == ZYDIS_OPERAND_TYPE_MEMORY)
|
} else if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) && (!operand->mem.isAddressGenOnly))
|
||||||
{
|
{
|
||||||
switch (operand->id)
|
switch (operand->id)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue