diff --git a/InstructionSets/ARM/Executor.hpp b/InstructionSets/ARM/Executor.hpp index 3770230ca..3ea5cb8c8 100644 --- a/InstructionSets/ARM/Executor.hpp +++ b/InstructionSets/ARM/Executor.hpp @@ -278,7 +278,7 @@ struct Executor { } // Check for an address exception. - if(address >= (1 << 26)) { + if(is_invalid_address(address)) { registers_.exception(); return; } @@ -472,7 +472,7 @@ struct Executor { }; // Check for an address exception. - address_error = address >= (1 << 26); + address_error = is_invalid_address(address); // Write out registers 1 to 14. for(uint32_t c = 0; c < 15; c++) { @@ -578,6 +578,13 @@ struct Executor { private: Registers registers_; + + static bool is_invalid_address(uint32_t address) { + if constexpr (model == Model::ARMv2with32bitAddressing) { + return false; + } + return address >= 1 << 26; + } }; /// Executes the instruction @c instruction which should have been fetched from @c executor.pc(), diff --git a/InstructionSets/ARM/OperationMapper.hpp b/InstructionSets/ARM/OperationMapper.hpp index 1df66b0e1..bfdea9838 100644 --- a/InstructionSets/ARM/OperationMapper.hpp +++ b/InstructionSets/ARM/OperationMapper.hpp @@ -15,6 +15,10 @@ namespace InstructionSet::ARM { enum class Model { ARMv2, + + /// Like an ARMv2 but all non-PC addressing is 64-bit. Primarily useful for a particular set of test + /// cases that I want to apply retroactively; not a real iteration. + ARMv2with32bitAddressing, }; enum class Condition { diff --git a/Machines/Acorn/Archimedes/Archimedes.cpp b/Machines/Acorn/Archimedes/Archimedes.cpp index 479d4d709..5b976baa5 100644 --- a/Machines/Acorn/Archimedes/Archimedes.cpp +++ b/Machines/Acorn/Archimedes/Archimedes.cpp @@ -740,7 +740,7 @@ class ConcreteMachine: } info.append("]"); } - InstructionSet::ARM::execute(instruction, executor_); + InstructionSet::ARM::execute(instruction, executor_); // if( //// executor_.pc() > 0x038021d0 && diff --git a/OSBindings/Mac/Clock SignalTests/ARMDecoderTests.mm b/OSBindings/Mac/Clock SignalTests/ARMDecoderTests.mm index 74428167d..a78530b97 100644 --- a/OSBindings/Mac/Clock SignalTests/ARMDecoderTests.mm +++ b/OSBindings/Mac/Clock SignalTests/ARMDecoderTests.mm @@ -334,7 +334,7 @@ struct MemoryLedger { input >> std::hex; - using Exec = Executor; + using Exec = Executor; std::unique_ptr test; struct FailureRecord { @@ -389,7 +389,7 @@ struct MemoryLedger { default: break; } - execute(instruction, *test); + execute(instruction, *test); NSMutableString *error = nil; for(uint32_t c = 0; c < 15; c++) {