encode: Fix encoding of memory operand

When a modrm_idx is used without a ModRM being present, the encoder
attempted to encode memory operands using O/OA/AO encodings.
This commit is contained in:
Alexis Engelke
2021-04-02 10:54:04 +02:00
parent 51ffe2598e
commit 2d9587bc16
2 changed files with 5 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ class InstrDesc(NamedTuple):
def optype_str(self):
optypes = ["", "", "", ""]
flags = ENCODINGS[self.encoding]
if flags.modrm_idx: optypes[flags.modrm_idx^3] = "M"
if flags.modrm_idx: optypes[flags.modrm_idx^3] = "rM"[flags.modrm]
if flags.modreg_idx: optypes[flags.modreg_idx^3] = "r"
if flags.vexreg_idx: optypes[flags.vexreg_idx^3] = "r"
if flags.zeroreg_idx: optypes[flags.zeroreg_idx^3] = "r"