Applied debug-interface-specific access restrictions for memory and registers
This commit is contained in:
@@ -307,6 +307,22 @@ namespace Targets::RiscV
|
||||
return this->programmingMode;
|
||||
}
|
||||
|
||||
void RiscV::applyDebugInterfaceAccessRestrictions(TargetAddressSpaceDescriptor& addressSpaceDescriptor) {
|
||||
for (auto& [segmentKey, segmentDescriptor] : addressSpaceDescriptor.segmentDescriptorsByKey) {
|
||||
this->riscVDebugInterface->applyAccessRestrictions(segmentDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
void RiscV::applyDebugInterfaceAccessRestrictions(TargetRegisterGroupDescriptor& registerGroupDescriptor) {
|
||||
for (auto& [registerKey, registerDescriptor] : registerGroupDescriptor.registerDescriptorsByKey) {
|
||||
this->riscVDebugInterface->applyAccessRestrictions(registerDescriptor);
|
||||
}
|
||||
|
||||
for (auto& [subgroupKey, subgroupDescriptor] : registerGroupDescriptor.subgroupDescriptorsByKey) {
|
||||
this->applyDebugInterfaceAccessRestrictions(subgroupDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
const TargetMemorySegmentDescriptor& RiscV::resolveRegisterMemorySegmentDescriptor(
|
||||
const TargetRegisterDescriptor& regDescriptor,
|
||||
const TargetAddressSpaceDescriptor& addressSpaceDescriptor
|
||||
@@ -355,6 +371,7 @@ namespace Targets::RiscV
|
||||
false,
|
||||
{true, true},
|
||||
{false, false},
|
||||
false,
|
||||
std::nullopt
|
||||
}
|
||||
);
|
||||
@@ -371,6 +388,7 @@ namespace Targets::RiscV
|
||||
false,
|
||||
{true, true},
|
||||
{false, false},
|
||||
false,
|
||||
std::nullopt
|
||||
}
|
||||
);
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include "TargetDescriptionFile.hpp"
|
||||
#include "IsaDescriptor.hpp"
|
||||
|
||||
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
||||
#include "src/Targets/TargetRegisterGroupDescriptor.hpp"
|
||||
|
||||
#include "src/DebugToolDrivers/TargetInterfaces/RiscV/RiscVDebugInterface.hpp"
|
||||
|
||||
namespace Targets::RiscV
|
||||
@@ -119,6 +122,9 @@ namespace Targets::RiscV
|
||||
|
||||
bool programmingMode = false;
|
||||
|
||||
void applyDebugInterfaceAccessRestrictions(TargetAddressSpaceDescriptor& addressSpaceDescriptor);
|
||||
void applyDebugInterfaceAccessRestrictions(TargetRegisterGroupDescriptor& registerGroupDescriptor);
|
||||
|
||||
const TargetMemorySegmentDescriptor& resolveRegisterMemorySegmentDescriptor(
|
||||
const TargetRegisterDescriptor& regDescriptor,
|
||||
const TargetAddressSpaceDescriptor& addressSpaceDescriptor
|
||||
|
||||
@@ -78,6 +78,16 @@ namespace Targets::RiscV::Wch
|
||||
this->cpuPeripheralDescriptor.clone()
|
||||
);
|
||||
|
||||
for (auto& [addressSpaceKey, addressSpaceDescriptor] : descriptor.addressSpaceDescriptorsByKey) {
|
||||
this->applyDebugInterfaceAccessRestrictions(addressSpaceDescriptor);
|
||||
}
|
||||
|
||||
for (auto& [peripheralKey, peripheralDescriptor] : descriptor.peripheralDescriptorsByKey) {
|
||||
for (auto& [groupKey, groupDescriptor] : peripheralDescriptor.registerGroupDescriptorsByKey) {
|
||||
this->applyDebugInterfaceAccessRestrictions(groupDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
auto& sysAddressSpaceDescriptor = descriptor.getAddressSpaceDescriptor("system");
|
||||
sysAddressSpaceDescriptor.getMemorySegmentDescriptor("internal_program_memory").inspectionEnabled = true;
|
||||
sysAddressSpaceDescriptor.getMemorySegmentDescriptor("internal_ram").inspectionEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user