Add REP-prefix table

This commit is contained in:
Alexis Engelke
2019-11-02 19:01:23 +01:00
parent 7682541a00
commit 194a7d6831
3 changed files with 22 additions and 5 deletions

View File

@@ -38,6 +38,7 @@ typedef enum DecodeMode DecodeMode;
#define ENTRY_TABLE72 4
#define ENTRY_TABLE_PREFIX 5
#define ENTRY_TABLE_VEX 6
#define ENTRY_TABLE_PREFIX_REP 7
#define ENTRY_MASK 7
#define ENTRY_UNPACK(table,kind,entry) do { \
@@ -388,6 +389,13 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address,
prefixes &= ~(PREFIX_OPSZ | PREFIX_REPNZ | PREFIX_REP);
ENTRY_UNPACK(table, kind, table[index]);
}
else if (kind == ENTRY_TABLE_PREFIX_REP)
{
// Discard 66h mandatory prefix
uint8_t index = mandatory_prefix != 1 ? mandatory_prefix : 0;
prefixes &= ~(PREFIX_REPNZ | PREFIX_REP);
ENTRY_UNPACK(table, kind, table[index]);
}
// For VEX prefix, we have to distinguish between VEX.W and VEX.L which may
// be part of the opcode.