diff options
author | iximeow <me@iximeow.net> | 2020-08-08 21:41:25 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-08-09 01:38:57 -0700 |
commit | 4cdd37b5b930e44ae4729e1e9ce0c524a117b466 (patch) | |
tree | 871cd077dd4490506f64b28bd20d67e9d89a6854 /src/long_mode/mod.rs | |
parent | 1b47026b5c108e87b7233736aa67506ef32e3713 (diff) |
special-case lea validity check better
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r-- | src/long_mode/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 80398e7..8148ef9 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -5723,11 +5723,13 @@ fn read_operands<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T, instruction.modrm_rrr.bank = bank; instruction.modrm_rrr.num = ((modrm >> 3) & 7) + if instruction.prefixes.rex().r() { 0b1000 } else { 0 }; - mem_oper = read_E(&mut bytes_iter, instruction, modrm, opwidth, length)?; - if operand_code.bits() == (OperandCode::Gv_M as u16) { - if mem_oper == OperandSpec::RegMMM { + mem_oper = if modrm >= 0b11000000 { + if operand_code.bits() == (OperandCode::Gv_M as u16) { return Err(DecodeError::InvalidOperand); } + read_modrm_reg(instruction, modrm, bank)? + } else { + read_M(&mut bytes_iter, instruction, modrm, length)? } } |