diff --git a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp index 11a03457..302c7e0c 100644 --- a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp +++ b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp @@ -77,6 +77,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec , config(config) , targetDescriptionFile(targetDescriptionFile) , targetConfig(targetConfig) + , sysAddressSpaceDescriptor(targetDescriptionFile.getSystemAddressSpaceDescriptor()) {} void DebugTranslator::activate() { @@ -437,6 +438,10 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec TargetMemorySize bytes, const std::set& excludedAddressRanges ) { + if (addressSpaceDescriptor != this->sysAddressSpaceDescriptor) { + throw Exceptions::TargetOperationFailure{"Unsupported address space"}; + } + // TODO: excluded addresses constexpr auto alignTo = DebugTranslator::WORD_BYTE_SIZE; @@ -474,6 +479,10 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec TargetMemoryAddress startAddress, TargetMemoryBufferSpan buffer ) { + if (addressSpaceDescriptor != this->sysAddressSpaceDescriptor) { + throw Exceptions::TargetOperationFailure{"Unsupported address space"}; + } + constexpr auto alignTo = DebugTranslator::WORD_BYTE_SIZE; const auto bytes = static_cast(buffer.size()); if ((startAddress % alignTo) != 0 || (bytes % alignTo) != 0) { diff --git a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.hpp b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.hpp index 0ab1ee8f..e05a32a9 100644 --- a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.hpp +++ b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.hpp @@ -115,6 +115,8 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec const ::Targets::RiscV::TargetDescriptionFile& targetDescriptionFile; const ::Targets::RiscV::RiscVTargetConfig& targetConfig; + const ::Targets::TargetAddressSpaceDescriptor sysAddressSpaceDescriptor; + DebugModuleDescriptor debugModuleDescriptor = {}; DebugModule::HartIndex selectedHartIndex = 0;