From 4cdd37b5b930e44ae4729e1e9ce0c524a117b466 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 8 Aug 2020 21:41:25 -0700 Subject: special-case lea validity check better --- src/long_mode/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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>(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)? } } -- cgit v1.1