mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Add callout for tracking segment register changes.
This commit is contained in:
parent
79b126e6bb
commit
e61dc0466f
@ -256,7 +256,7 @@ template <
|
||||
case Operation::MOV:
|
||||
Primitive::mov<IntT>(destination_w(), source_r());
|
||||
if constexpr (std::is_same_v<IntT, uint16_t>) {
|
||||
context.registers.did_update(instruction.destination.source());
|
||||
context.registers.did_update(instruction.destination().source());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -327,7 +327,7 @@ template <
|
||||
case Operation::POP:
|
||||
destination_w() = Primitive::pop<IntT, false>(context);
|
||||
if constexpr (std::is_same_v<IntT, uint16_t>) {
|
||||
context.registers.did_update(instruction.destination.source());
|
||||
context.registers.did_update(instruction.destination().source());
|
||||
}
|
||||
break;
|
||||
case Operation::PUSH:
|
||||
|
@ -249,15 +249,13 @@ struct Memory {
|
||||
}
|
||||
|
||||
uint32_t segment_base(InstructionSet::x86::Source segment) {
|
||||
uint32_t physical_address;
|
||||
using Source = InstructionSet::x86::Source;
|
||||
switch(segment) {
|
||||
default: physical_address = registers_.ds_; break;
|
||||
case Source::ES: physical_address = registers_.es_; break;
|
||||
case Source::CS: physical_address = registers_.cs_; break;
|
||||
case Source::SS: physical_address = registers_.ss_; break;
|
||||
default: return registers_.ds_base_;
|
||||
case Source::ES: return registers_.es_base_;
|
||||
case Source::CS: return registers_.cs_base_;
|
||||
case Source::SS: return registers_.ss_base_;
|
||||
}
|
||||
return physical_address << 4;
|
||||
}
|
||||
|
||||
uint32_t address(InstructionSet::x86::Source segment, uint16_t offset) {
|
||||
@ -556,6 +554,11 @@ struct FailedExecution {
|
||||
registers.ss_ = [value[@"ss"] intValue];
|
||||
registers.ip_ = [value[@"ip"] intValue];
|
||||
|
||||
registers.did_update(Registers::Source::ES);
|
||||
registers.did_update(Registers::Source::CS);
|
||||
registers.did_update(Registers::Source::DS);
|
||||
registers.did_update(Registers::Source::SS);
|
||||
|
||||
const uint16_t flags_value = [value[@"flags"] intValue];
|
||||
flags.set(flags_value);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user