diff options
author | iximeow <me@iximeow.net> | 2024-06-23 15:15:50 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-23 15:15:50 -0700 |
commit | 2002347272391dc6a70d83fe8293f2ce35ed26ee (patch) | |
tree | 2afdfc0e24a07237752377f2cd30d243c465488b /src | |
parent | 2ac46a98585b93f62961fdd82a1f2d1266761305 (diff) |
add additional `call` test cases
fix 32-bit 66-prefixed ff /2 call not having 16-bit operands
fix momentary regression in rendering `call` instructions to string
Diffstat (limited to 'src')
-rw-r--r-- | src/long_mode/display.rs | 5 | ||||
-rw-r--r-- | src/long_mode/mod.rs | 2 | ||||
-rw-r--r-- | src/protected_mode/display.rs | 5 | ||||
-rw-r--r-- | src/protected_mode/mod.rs | 7 | ||||
-rw-r--r-- | src/real_mode/display.rs | 5 |
5 files changed, 10 insertions, 14 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index f765fb7..4f4e739 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -4245,9 +4245,8 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St } } -// TODO: should include CALL -static RELATIVE_BRANCHES: [Opcode; 21] = [ - Opcode::JMP, Opcode::JRCXZ, +static RELATIVE_BRANCHES: [Opcode; 22] = [ + Opcode::JMP, Opcode::CALL, Opcode::JRCXZ, Opcode::LOOP, Opcode::LOOPZ, Opcode::LOOPNZ, Opcode::JO, Opcode::JNO, Opcode::JB, Opcode::JNB, diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index fab8fde..3c25506 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -7660,6 +7660,8 @@ fn read_operands< .with_id(modrm_start - 8) ); if instruction.operands[0] == OperandSpec::RegMMM { + // in 64-bit mode, operand size overrides do not actually shink the operand for + // `call`/`jmp`. if opcode == Opcode::CALL || opcode == Opcode::JMP { instruction.regs[1].bank = RegisterBank::Q; if opcode == Opcode::CALL { diff --git a/src/protected_mode/display.rs b/src/protected_mode/display.rs index 38b5891..1db34cb 100644 --- a/src/protected_mode/display.rs +++ b/src/protected_mode/display.rs @@ -2797,9 +2797,8 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St } } -// TODO: should include CALL -static RELATIVE_BRANCHES: [Opcode; 21] = [ - Opcode::JMP, Opcode::JECXZ, +static RELATIVE_BRANCHES: [Opcode; 22] = [ + Opcode::JMP, Opcode::CALL, Opcode::JECXZ, Opcode::LOOP, Opcode::LOOPZ, Opcode::LOOPNZ, Opcode::JO, Opcode::JNO, Opcode::JB, Opcode::JNB, diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs index f2b10f5..38f8310 100644 --- a/src/protected_mode/mod.rs +++ b/src/protected_mode/mod.rs @@ -7529,11 +7529,8 @@ fn read_operands< .with_id(modrm_start - 8) ); if instruction.operands[0] == OperandSpec::RegMMM { - if opcode == Opcode::CALL || opcode == Opcode::JMP { - instruction.regs[1].bank = RegisterBank::D; - if opcode == Opcode::CALL { - instruction.mem_size = 4; - } + if opcode == Opcode::CALL { + instruction.mem_size = 4; } else if opcode == Opcode::PUSH || opcode == Opcode::POP { if instruction.prefixes.operand_size() { instruction.mem_size = 2; diff --git a/src/real_mode/display.rs b/src/real_mode/display.rs index b76f47e..90b4f0a 100644 --- a/src/real_mode/display.rs +++ b/src/real_mode/display.rs @@ -2797,9 +2797,8 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St } } -// TODO: should include CALL -static RELATIVE_BRANCHES: [Opcode; 21] = [ - Opcode::JMP, Opcode::JCXZ, +static RELATIVE_BRANCHES: [Opcode; 22] = [ + Opcode::JMP, Opcode::CALL, Opcode::JCXZ, Opcode::LOOP, Opcode::LOOPZ, Opcode::LOOPNZ, Opcode::JO, Opcode::JNO, Opcode::JB, Opcode::JNB, |