From fd046c8c7afd24c20b33b8717866845299602079 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 8 Aug 2020 13:59:38 -0700 Subject: more speed hole! --- src/long_mode/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 57f5d08..c2dc8f7 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -5317,7 +5317,7 @@ fn read_sib>(bytes_iter: &mut T, instr: &mut Instruction, m OperandSpec::RegIndexBaseScaleDisp } } else { - instr.modrm_mmm.num = 0b101 + if instr.prefixes.rex().b() { 0b1000 } else { 0 }; + instr.modrm_mmm.num |= 0b101; if disp == 0 { OperandSpec::Deref @@ -5328,7 +5328,7 @@ fn read_sib>(bytes_iter: &mut T, instr: &mut Instruction, m } } } else { - instr.modrm_mmm.num = 0b101 + if instr.prefixes.rex().b() { 0b1000 } else { 0 }; + instr.modrm_mmm.num |= 0b101; instr.sib_index.num = ((sibbyte >> 3) & 7) + if instr.prefixes.rex().x() { 0b1000 } else { 0 }; let scale = 1u8 << (sibbyte >> 6); @@ -5350,7 +5350,7 @@ fn read_sib>(bytes_iter: &mut T, instr: &mut Instruction, m } } } else { - instr.modrm_mmm.num = (sibbyte & 7) + if instr.prefixes.rex().b() { 0b1000 } else { 0 }; + instr.modrm_mmm.num |= sibbyte & 7; if ((sibbyte >> 3) & 7) == 0b100 { if instr.prefixes.rex().x() { @@ -5392,6 +5392,11 @@ fn read_M>(bytes_iter: &mut T, instr: &mut Instruction, mod let modbits = modrm >> 6; let mmm = modrm & 7; let op_spec = if mmm == 4 { + if instr.prefixes.rex().b() { + instr.modrm_mmm.num = 0b1000; + } else { + instr.modrm_mmm.num = 0; + } return read_sib(bytes_iter, instr, modrm, length); } else if mmm == 5 && modbits == 0b00 { *length += 4; -- cgit v1.1