1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 23:32:28 +00:00

Include missing context on JMP/CALL far.

Zero failing tests amongst official opcodes.
This commit is contained in:
Thomas Harte 2023-09-29 14:57:08 -04:00
parent 1a6c8a2aed
commit ef5ee8cf94
4 changed files with 17 additions and 12 deletions

View File

@ -95,6 +95,7 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
SetOperation(Operation::op); \
phase_ = Phase::DisplacementOrOperand; \
operand_size_ = DataSize::Word; \
destination_ = Source::Immediate; \
displacement_size_ = data_size(default_address_size_)
/// Handles ENTER — a fixed three-byte operation.

View File

@ -62,13 +62,13 @@ std::string InstructionSet::x86::to_string(Operation operation, DataSize size) {
case Operation::CALLabs: return "call";
case Operation::CALLrel: return "call";
case Operation::CALLfar: return "callf far";
case Operation::CALLfar: return "callf";
case Operation::IRET: return "iret";
case Operation::RETfar: return "retf";
case Operation::RETnear: return "retn";
case Operation::JMPabs: return "jmp";
case Operation::JMPrel: return "jmp";
case Operation::JMPfar: return "jmpf far";
case Operation::JMPfar: return "jmpf";
case Operation::JCXZ: return "jcxz";
case Operation::INT: return "int";
case Operation::INTO: return "into";
@ -155,7 +155,6 @@ bool InstructionSet::x86::mnemonic_implies_data_size(Operation operation) {
case Operation::SCAS:
case Operation::STOS:
case Operation::JMPrel:
case Operation::JMPfar:
case Operation::LEA:
return true;
}

View File

@ -94,7 +94,7 @@ enum class Operation: uint8_t {
CALLabs,
/// Relative call; see displacement().
CALLrel,
/// Far call; see the segment() and offset() fields.
/// Far call; if destination is Source::Immediate then see the segment() and offset() fields; otherwise take segment and offset by indirection.
CALLfar,
/// Return from interrupt.
IRET,
@ -106,7 +106,7 @@ enum class Operation: uint8_t {
JMPabs,
/// Near jump with a relative destination.
JMPrel,
/// Far jump to the indicated segment and offset.
/// Far jump; if destination is Source::Immediate then see the segment() and offset() fields; otherwise take segment and offset by indirection.
JMPfar,
/// Relative jump performed only if CX = 0; see the displacement.
JCXZ,

View File

@ -146,9 +146,6 @@ std::string to_string(
- (NSArray<NSString *> *)testFiles {
NSString *path = [NSString stringWithUTF8String:TestSuiteHome];
NSSet *allowList = [NSSet setWithArray:@[
// Failing CALL and JMP.
// @"FF.3.json.gz",
// @"FF.5.json.gz",
]];
// Unofficial opcodes; ignored for now.
@ -237,10 +234,18 @@ std::string to_string(
case Operation::CALLfar:
case Operation::JMPfar: {
operation += " 0x";
operation += to_hex(instruction.segment(), 4, false);
operation += ":0x";
operation += to_hex(instruction.offset(), 4, false);
switch(instruction.destination().source()) {
case Source::Immediate:
operation += " far 0x";
operation += to_hex(instruction.segment(), 4, false);
operation += ":0x";
operation += to_hex(instruction.offset(), 4, false);
break;
default:
operation += " ";
operation += to_string(instruction.destination(), instruction, offsetLength, immediateLength);
break;
}
} break;
case Operation::LDS: