Improved encoder-table

This commit is contained in:
flobernd 2017-07-06 21:49:38 +02:00
parent 6bd79283e0
commit 5c07598a2d
4 changed files with 6959 additions and 6960 deletions

View File

@ -361,14 +361,14 @@ typedef uint8_t ZydisOpcodeMap;
*/
enum ZydisOpcodeMaps
{
ZYDIS_OPCODE_MAP_DEFAULT = 0x00,
ZYDIS_OPCODE_MAP_EX0 = 0x01,
ZYDIS_OPCODE_MAP_0F = 0x02,
ZYDIS_OPCODE_MAP_0F38 = 0x03,
ZYDIS_OPCODE_MAP_0F3A = 0x04,
ZYDIS_OPCODE_MAP_XOP8 = 0x05,
ZYDIS_OPCODE_MAP_XOP9 = 0x06,
ZYDIS_OPCODE_MAP_XOPA = 0x07
ZYDIS_OPCODE_MAP_DEFAULT,
ZYDIS_OPCODE_MAP_0F,
ZYDIS_OPCODE_MAP_0F38,
ZYDIS_OPCODE_MAP_0F3A,
ZYDIS_OPCODE_MAP_0F0F,
ZYDIS_OPCODE_MAP_XOP8,
ZYDIS_OPCODE_MAP_XOP9,
ZYDIS_OPCODE_MAP_XOPA
};
/* ---------------------------------------------------------------------------------------------- */

View File

@ -3583,7 +3583,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_VEX;
ZYDIS_CHECK(ZydisDecodeVEX(context, instruction, prefixBytes));
instruction->opcodeMap =
ZYDIS_OPCODE_MAP_EX0 + instruction->raw.vex.m_mmmm;
ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.vex.m_mmmm;
break;
case 0x62:
switch ((prefixBytes[2] >> 2) & 0x01)
@ -3593,14 +3593,14 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_MVEX;
ZYDIS_CHECK(ZydisDecodeMVEX(context, instruction, prefixBytes));
instruction->opcodeMap =
ZYDIS_OPCODE_MAP_EX0 + instruction->raw.mvex.mmmm;
ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.mvex.mmmm;
break;
case 1:
// Decode EVEX-prefix
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_EVEX;
ZYDIS_CHECK(ZydisDecodeEVEX(context, instruction, prefixBytes));
instruction->opcodeMap =
ZYDIS_OPCODE_MAP_EX0 + instruction->raw.evex.mm;
ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.evex.mm;
break;
default:
ZYDIS_UNREACHABLE;
@ -3649,7 +3649,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
{
case 0x0F:
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_3DNOW;
instruction->opcodeMap = ZYDIS_OPCODE_MAP_DEFAULT;
instruction->opcodeMap = ZYDIS_OPCODE_MAP_0F0F;
break;
case 0x38:
instruction->opcodeMap = ZYDIS_OPCODE_MAP_0F38;

View File

@ -56,24 +56,23 @@ extern "C" {
*/
typedef struct ZydisEncodableInstruction_
{
ZydisInstructionEncoding encoding ZYDIS_BITFIELD( 3);
uint16_t definitionReference ZYDIS_BITFIELD(13);
struct
{
uint8_t mode ZYDIS_BITFIELD( 2);
uint8_t modrmMod ZYDIS_BITFIELD( 3);
uint8_t modrmReg ZYDIS_BITFIELD( 4);
uint8_t modrmRm ZYDIS_BITFIELD( 4);
uint8_t mandatoryPrefix ZYDIS_BITFIELD( 3);
uint8_t operandSize ZYDIS_BITFIELD( 2);
uint8_t addressSize ZYDIS_BITFIELD( 2);
uint8_t vectorLength ZYDIS_BITFIELD( 2);
uint8_t rexW ZYDIS_BITFIELD( 2);
uint8_t rexB ZYDIS_BITFIELD( 2);
uint8_t evexB ZYDIS_BITFIELD( 2);
uint8_t evexZ ZYDIS_BITFIELD( 2);
uint8_t mvexE ZYDIS_BITFIELD( 2);
} filters;
ZydisInstructionEncoding encoding ZYDIS_BITFIELD( 3);
uint8_t opcode ZYDIS_BITFIELD( 8);
ZydisOpcodeMap opcodeMap ZYDIS_BITFIELD( 3);
uint8_t mode ZYDIS_BITFIELD( 3);
uint8_t modrmMod ZYDIS_BITFIELD( 4);
ZydisBool forceModrmReg ZYDIS_BITFIELD( 1);
uint8_t modrmReg ZYDIS_BITFIELD( 8);
ZydisBool forceModrmRm ZYDIS_BITFIELD( 1);
uint8_t modrmRm ZYDIS_BITFIELD( 8);
uint8_t mandatoryPrefix ZYDIS_BITFIELD( 3);
uint8_t vectorLength ZYDIS_BITFIELD( 2);
uint8_t rexW ZYDIS_BITFIELD( 1);
uint8_t rexB ZYDIS_BITFIELD( 2);
uint8_t evexB ZYDIS_BITFIELD( 1);
uint8_t evexZ ZYDIS_BITFIELD( 2);
uint8_t mvexE ZYDIS_BITFIELD( 2);
} ZydisEncodableInstruction;
/* ---------------------------------------------------------------------------------------------- */

File diff suppressed because it is too large Load Diff