diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index ce0ae512d..eefce4e96 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -319,8 +319,8 @@ template < using AddressT = typename AddressT::type; // Establish source() and destination() shorthand to fetch data if necessary. - auto source = [&]() -> IntT& { return *resolve(instruction, instruction.source().template source(), instruction.source(), registers, memory); }; - auto destination = [&]() -> IntT& { return *resolve(instruction, instruction.destination().template source(), instruction.source(), registers, memory); }; + auto source = [&]() -> IntT& { return *resolve(instruction, instruction.source().template source(), instruction.source(), registers, memory); }; + auto destination = [&]() -> IntT& { return *resolve(instruction, instruction.destination().template source(), instruction.destination(), registers, memory); }; // Guide to the below: // diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index 08c0681d9..c47a28109 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -96,6 +96,7 @@ struct Registers { struct Memory { enum class Tag { Seeded, + AccessExpected, Accessed, FlagsL, FlagsH @@ -118,6 +119,10 @@ struct Memory { 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, // so that defined-flag-only masks can be applied while verifying RAM contents. template 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 // to a selector, they're just at an absolute location. template IntT &access(uint32_t address, Tag tag) { + if(tags.find(address) == tags.end()) { +// printf("Access to unexpected RAM address"); + } tags[address] = tag; return *reinterpret_cast(&memory[address]); } // Entry point for the 8086; simply notes that memory was accessed. template 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(segment, address, Tag::Accessed); } }; @@ -403,13 +408,17 @@ struct FailedExecution { execution_support.clear(); 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. - NSDictionary *const initial_state = test[@"initial"]; InstructionSet::x86::Status initial_status; for(NSArray *ram in initial_state[@"ram"]) { execution_support.memory.seed([ram[0] intValue], [ram[1] intValue]); } + for(NSArray *ram in final_state[@"ram"]) { + execution_support.memory.touch([ram[0] intValue]); + } [self populate:execution_support.registers status:initial_status value:initial_state[@"regs"]]; execution_support.status = initial_status; @@ -425,7 +434,6 @@ struct FailedExecution { ); // Compare final state. - NSDictionary *const final_state = test[@"final"]; Registers intended_registers; InstructionSet::x86::Status intended_status;