parseinstrs: Respect mem-only/reg-only encodings
This commit is contained in:
3
decode.c
3
decode.c
@@ -358,9 +358,6 @@ prefix_end:
|
||||
|
||||
if (mod == 3 || is_cr || is_dr)
|
||||
{
|
||||
if (op_modrm->misc == FD_RT_MEM)
|
||||
return FD_ERR_UD;
|
||||
|
||||
uint8_t reg_idx = rm;
|
||||
if (LIKELY(op_modrm->misc == FD_RT_GPL || op_modrm->misc == FD_RT_VEC))
|
||||
reg_idx += prefix_rex & PREFIX_REXB ? 8 : 0;
|
||||
|
||||
@@ -285,8 +285,8 @@ class Opcode(NamedTuple):
|
||||
if self.opcext:
|
||||
opcode.append((EntryKind.TABLE16, [((self.opcext - 0xc0) >> 3) | 8]))
|
||||
opcode.append((EntryKind.TABLE8E, [self.opcext & 7]))
|
||||
if self.modreg and self.modreg[0] is not None:
|
||||
# TODO: support for /r and /m specifiers, currently adds ~1.9kiB size
|
||||
if self.modreg:
|
||||
# TODO: optimize for /r and /m specifiers to reduce size
|
||||
mod = {"m": [0], "r": [1<<3], "rm": [0, 1<<3]}[self.modreg[1]]
|
||||
reg = [self.modreg[0]] if self.modreg[0] is not None else list(range(8))
|
||||
opcode.append((EntryKind.TABLE16, [x + y for x in mod for y in reg]))
|
||||
|
||||
Reference in New Issue
Block a user