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