decode: Simplify ModRM reg vs. mem distiction

This commit is contained in:
Alexis Engelke
2023-03-24 11:30:49 +01:00
parent 513cc709a4
commit c5f5fa1f75

View File

@@ -179,7 +179,7 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address,
if (table_entry & 1) {
if (UNLIKELY(off >= len))
return FD_ERR_PARTIAL;
unsigned isreg = (buffer[off] & 0xc0) == 0xc0 ? 8 : 0;
unsigned isreg = buffer[off] >= 0xc0 ? 8 : 0;
table_entry = table_walk(table_entry, ((buffer[off] >> 3) & 7) | isreg);
// table_entry kinds: INSTR(0), T8E(1)
if (table_entry & 1)
@@ -314,7 +314,7 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address,
if (table_entry & 1) {
if (UNLIKELY(off >= len))
return FD_ERR_PARTIAL;
unsigned isreg = (buffer[off] & 0xc0) == 0xc0 ? 8 : 0;
unsigned isreg = buffer[off] >= 0xc0 ? 8 : 0;
table_entry = table_walk(table_entry, ((buffer[off] >> 3) & 7) | isreg);
// table_entry kinds: INSTR(0), T8E(1), TVEX(2)
if (table_entry & 1)