From 78d0c21c475fce65c36e64a36c26c689bee0faae Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 16 Feb 2020 02:02:32 -0800 Subject: embarassingly had OperandSpec variants for modrm displacement == 0 backwards --- src/long_mode/mod.rs | 8 ++++---- test/test.rs | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index d74ebe4..954ae95 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -4457,16 +4457,16 @@ fn read_sib>(bytes_iter: &mut T, instr: &mut Instruction, m if disp == 0 { if modbits == 0 { - OperandSpec::RegScaleDisp + OperandSpec::RegScale } else { - OperandSpec::RegIndexBaseScaleDisp + OperandSpec::RegIndexBaseScale } } else { instr.disp = disp as i64 as u64; if modbits == 0 { - OperandSpec::RegScale + OperandSpec::RegScaleDisp } else { - OperandSpec::RegIndexBaseScale + OperandSpec::RegIndexBaseScaleDisp } } } diff --git a/test/test.rs b/test/test.rs index 896ffaa..1bac590 100644 --- a/test/test.rs +++ b/test/test.rs @@ -476,6 +476,7 @@ fn test_control_flow() { test_display(&[0x0f, 0x86, 0x8b, 0x01, 0x00, 0x00], "jna 0x18b"); test_display(&[0x74, 0x47], "jz 0x47"); test_display(&[0xff, 0x15, 0x7e, 0x72, 0x24, 0x00], "call [rip + 0x24727e]"); + test_display(&[0xff, 0x24, 0xcd, 0x70, 0xa0, 0xbc, 0x01], "jmp [rcx * 8 + 0x1bca070]"); test_display(&[0xc3], "ret"); } -- cgit v1.1