1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Add test for switch to Source::IndirectNoBase.

This commit is contained in:
Thomas Harte 2022-03-10 15:45:56 -05:00
parent 673ffc50da
commit a2ae3771eb
2 changed files with 8 additions and 3 deletions

View File

@ -830,7 +830,6 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
if(expects_sib && (source_ == Source::Indirect | destination_ == Source::Indirect)) {
phase_ = Phase::ScaleIndexBase;
// TODO: test for IndirectNoBase.
} else {
phase_ = (displacement_size_ != DataSize::None || operand_size_ != DataSize::None) ? Phase::DisplacementOrOperand : Phase::ReadyToPost;
}
@ -845,6 +844,12 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
++source;
++consumed_;
// Potentially record the lack of a base.
if(displacement_size_ == DataSize::None && (uint8_t(sib_)&7) == 5) {
source_ = (source_ == Source::Indirect) ? Source::IndirectNoBase : source_;
destination_ = (destination_ == Source::Indirect) ? Source::IndirectNoBase : destination_;
}
phase_ = (displacement_size_ != DataSize::None || operand_size_ != DataSize::None) ? Phase::DisplacementOrOperand : Phase::ReadyToPost;
}

View File

@ -539,7 +539,7 @@ std::vector<typename InstructionSet::x86::Decoder<model>::InstructionT> decode(c
test(instructions[63], Operation::JPCX, 0, 0xd4 - 0x9d);
}
- (void)testSourceSIB1 {
- (void)testSourceModRegRM1 {
const auto instructions = decode<Model::i80386>({
0x62, 0x90, 0x90, 0xdf, 0xcd, 0xf9
}, true);
@ -548,7 +548,7 @@ std::vector<typename InstructionSet::x86::Decoder<model>::InstructionT> decode(c
test(instructions[0], DataSize::DWord, Operation::BOUND, ScaleIndexBase(Source::eAX), Source::eDX, 0, -0x6322070);
}
- (void)testSourceSIB2 {
- (void)testSourceModRegRM2 {
const auto instructions = decode<Model::i80386>({
0x81, 0x47, 0xbe, 0xa9, 0x3a, 0x68, 0x9f
}, true);