mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 23:32:28 +00:00
Fix DataPointer reference.
Down from 4521 to 1248 failures within 00.json.gz
This commit is contained in:
parent
6808f2c778
commit
dbfaef632a
@ -319,8 +319,8 @@ template <
|
|||||||
using AddressT = typename AddressT<is_32bit(model)>::type;
|
using AddressT = typename AddressT<is_32bit(model)>::type;
|
||||||
|
|
||||||
// Establish source() and destination() shorthand to fetch data if necessary.
|
// Establish source() and destination() shorthand to fetch data if necessary.
|
||||||
auto source = [&]() -> IntT& { return *resolve<model, data_size>(instruction, instruction.source().template source<false>(), instruction.source(), registers, memory); };
|
auto source = [&]() -> IntT& { return *resolve<model, data_size>(instruction, instruction.source().template source<false>(), instruction.source(), registers, memory); };
|
||||||
auto destination = [&]() -> IntT& { return *resolve<model, data_size>(instruction, instruction.destination().template source<false>(), instruction.source(), registers, memory); };
|
auto destination = [&]() -> IntT& { return *resolve<model, data_size>(instruction, instruction.destination().template source<false>(), instruction.destination(), registers, memory); };
|
||||||
|
|
||||||
// Guide to the below:
|
// Guide to the below:
|
||||||
//
|
//
|
||||||
|
@ -96,6 +96,7 @@ struct Registers {
|
|||||||
struct Memory {
|
struct Memory {
|
||||||
enum class Tag {
|
enum class Tag {
|
||||||
Seeded,
|
Seeded,
|
||||||
|
AccessExpected,
|
||||||
Accessed,
|
Accessed,
|
||||||
FlagsL,
|
FlagsL,
|
||||||
FlagsH
|
FlagsH
|
||||||
@ -118,6 +119,10 @@ struct Memory {
|
|||||||
tags[address] = Tag::Seeded;
|
tags[address] = Tag::Seeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void touch(uint32_t address) {
|
||||||
|
tags[address] = Tag::AccessExpected;
|
||||||
|
}
|
||||||
|
|
||||||
// Entry point used by the flow controller so that it can mark up locations at which the flags were written,
|
// Entry point used by the flow controller so that it can mark up locations at which the flags were written,
|
||||||
// so that defined-flag-only masks can be applied while verifying RAM contents.
|
// so that defined-flag-only masks can be applied while verifying RAM contents.
|
||||||
template <typename IntT> IntT &access([[maybe_unused]] InstructionSet::x86::Source segment, uint16_t address, Tag tag) {
|
template <typename IntT> IntT &access([[maybe_unused]] InstructionSet::x86::Source segment, uint16_t address, Tag tag) {
|
||||||
@ -136,15 +141,15 @@ struct Memory {
|
|||||||
// An additional entry point for the flow controller; on the original 8086 interrupt vectors aren't relative
|
// An additional entry point for the flow controller; on the original 8086 interrupt vectors aren't relative
|
||||||
// to a selector, they're just at an absolute location.
|
// to a selector, they're just at an absolute location.
|
||||||
template <typename IntT> IntT &access(uint32_t address, Tag tag) {
|
template <typename IntT> IntT &access(uint32_t address, Tag tag) {
|
||||||
|
if(tags.find(address) == tags.end()) {
|
||||||
|
// printf("Access to unexpected RAM address");
|
||||||
|
}
|
||||||
tags[address] = tag;
|
tags[address] = tag;
|
||||||
return *reinterpret_cast<IntT *>(&memory[address]);
|
return *reinterpret_cast<IntT *>(&memory[address]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry point for the 8086; simply notes that memory was accessed.
|
// Entry point for the 8086; simply notes that memory was accessed.
|
||||||
template <typename IntT> IntT &access([[maybe_unused]] InstructionSet::x86::Source segment, uint32_t address) {
|
template <typename IntT> IntT &access([[maybe_unused]] InstructionSet::x86::Source segment, uint32_t address) {
|
||||||
if(tags.find(address) == tags.end()) {
|
|
||||||
printf("Access to uninitialised RAM area");
|
|
||||||
}
|
|
||||||
return access<IntT>(segment, address, Tag::Accessed);
|
return access<IntT>(segment, address, Tag::Accessed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -403,13 +408,17 @@ struct FailedExecution {
|
|||||||
execution_support.clear();
|
execution_support.clear();
|
||||||
|
|
||||||
const uint16_t flags_mask = metadata[@"flags-mask"] ? [metadata[@"flags-mask"] intValue] : 0xffff;
|
const uint16_t flags_mask = metadata[@"flags-mask"] ? [metadata[@"flags-mask"] intValue] : 0xffff;
|
||||||
|
NSDictionary *const initial_state = test[@"initial"];
|
||||||
|
NSDictionary *const final_state = test[@"final"];
|
||||||
|
|
||||||
// Apply initial state.
|
// Apply initial state.
|
||||||
NSDictionary *const initial_state = test[@"initial"];
|
|
||||||
InstructionSet::x86::Status initial_status;
|
InstructionSet::x86::Status initial_status;
|
||||||
for(NSArray<NSNumber *> *ram in initial_state[@"ram"]) {
|
for(NSArray<NSNumber *> *ram in initial_state[@"ram"]) {
|
||||||
execution_support.memory.seed([ram[0] intValue], [ram[1] intValue]);
|
execution_support.memory.seed([ram[0] intValue], [ram[1] intValue]);
|
||||||
}
|
}
|
||||||
|
for(NSArray<NSNumber *> *ram in final_state[@"ram"]) {
|
||||||
|
execution_support.memory.touch([ram[0] intValue]);
|
||||||
|
}
|
||||||
[self populate:execution_support.registers status:initial_status value:initial_state[@"regs"]];
|
[self populate:execution_support.registers status:initial_status value:initial_state[@"regs"]];
|
||||||
execution_support.status = initial_status;
|
execution_support.status = initial_status;
|
||||||
|
|
||||||
@ -425,7 +434,6 @@ struct FailedExecution {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Compare final state.
|
// Compare final state.
|
||||||
NSDictionary *const final_state = test[@"final"];
|
|
||||||
Registers intended_registers;
|
Registers intended_registers;
|
||||||
InstructionSet::x86::Status intended_status;
|
InstructionSet::x86::Status intended_status;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user