mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
Memory: GetPhysicalPointer should accept right open bound address
Also removed IO region check in GetPhysicalPointer as it doesn't make sense to get a pointer to MMIO
This commit is contained in:
parent
560df843b1
commit
365eeb889f
@ -274,7 +274,6 @@ u8* GetPhysicalPointer(PAddr address) {
|
|||||||
|
|
||||||
static constexpr MemoryArea memory_areas[] = {
|
static constexpr MemoryArea memory_areas[] = {
|
||||||
{VRAM_PADDR, VRAM_SIZE},
|
{VRAM_PADDR, VRAM_SIZE},
|
||||||
{IO_AREA_PADDR, IO_AREA_SIZE},
|
|
||||||
{DSP_RAM_PADDR, DSP_RAM_SIZE},
|
{DSP_RAM_PADDR, DSP_RAM_SIZE},
|
||||||
{FCRAM_PADDR, FCRAM_N3DS_SIZE},
|
{FCRAM_PADDR, FCRAM_N3DS_SIZE},
|
||||||
{N3DS_EXTRA_RAM_PADDR, N3DS_EXTRA_RAM_SIZE},
|
{N3DS_EXTRA_RAM_PADDR, N3DS_EXTRA_RAM_SIZE},
|
||||||
@ -282,7 +281,9 @@ u8* GetPhysicalPointer(PAddr address) {
|
|||||||
|
|
||||||
const auto area =
|
const auto area =
|
||||||
std::find_if(std::begin(memory_areas), std::end(memory_areas), [&](const auto& area) {
|
std::find_if(std::begin(memory_areas), std::end(memory_areas), [&](const auto& area) {
|
||||||
return address >= area.paddr_base && address < area.paddr_base + area.size;
|
// Note: the region end check is inclusive because the user can pass in an address that
|
||||||
|
// represents an open right bound
|
||||||
|
return address >= area.paddr_base && address <= area.paddr_base + area.size;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (area == std::end(memory_areas)) {
|
if (area == std::end(memory_areas)) {
|
||||||
@ -290,11 +291,6 @@ u8* GetPhysicalPointer(PAddr address) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (area->paddr_base == IO_AREA_PADDR) {
|
|
||||||
LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x{:08X}", address);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 offset_into_region = address - area->paddr_base;
|
u32 offset_into_region = address - area->paddr_base;
|
||||||
|
|
||||||
u8* target_pointer = nullptr;
|
u8* target_pointer = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user