This commit is contained in:
Nav
2023-11-26 15:58:28 +00:00
parent 17a72bf231
commit c962c5e4ca

View File

@@ -293,21 +293,15 @@ namespace Targets::RiscV
TargetMemorySize bytes, TargetMemorySize bytes,
const std::set<TargetMemoryAddressRange>& excludedAddressRanges const std::set<TargetMemoryAddressRange>& excludedAddressRanges
) { ) {
using DebugModule::Registers::MemoryAccessControlField;
// TODO: excluded addresses // TODO: excluded addresses
const auto pageSize = 4; const auto pageSize = 4;
if ((startAddress % pageSize) != 0 || (bytes % pageSize) != 0) { if ((startAddress % pageSize) != 0 || (bytes % pageSize) != 0) {
// Alignment required // Alignment required
const auto alignedStartAddress = static_cast<TargetMemoryAddress>( const auto alignedStartAddress = this->alignMemoryAddress(startAddress, pageSize);
std::floor(static_cast<float>(startAddress) / static_cast<float>(pageSize)) * pageSize const auto alignedBytes = this->alignMemorySize(bytes + (startAddress - alignedStartAddress), pageSize);
);
const auto alignedBytes = static_cast<TargetMemorySize>(
std::ceil(
static_cast<float>(bytes + (startAddress - alignedStartAddress))
/ static_cast<float>(pageSize)
) * pageSize
);
auto memoryBuffer = this->readMemory( auto memoryBuffer = this->readMemory(
memoryType, memoryType,
@@ -325,8 +319,6 @@ namespace Targets::RiscV
return output; return output;
} }
using DebugModule::Registers::MemoryAccessControlField;
auto output = TargetMemoryBuffer(); auto output = TargetMemoryBuffer();
output.reserve(bytes); output.reserve(bytes);