From 365eeb889f77728a806677879c822809473b296b Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Fri, 16 Nov 2018 00:14:17 -0500 Subject: [PATCH] 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 --- src/core/memory.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index ed5a04c9a..1456f28c6 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -274,7 +274,6 @@ u8* GetPhysicalPointer(PAddr address) { static constexpr MemoryArea memory_areas[] = { {VRAM_PADDR, VRAM_SIZE}, - {IO_AREA_PADDR, IO_AREA_SIZE}, {DSP_RAM_PADDR, DSP_RAM_SIZE}, {FCRAM_PADDR, FCRAM_N3DS_SIZE}, {N3DS_EXTRA_RAM_PADDR, N3DS_EXTRA_RAM_SIZE}, @@ -282,7 +281,9 @@ u8* GetPhysicalPointer(PAddr address) { 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)) { @@ -290,11 +291,6 @@ u8* GetPhysicalPointer(PAddr address) { 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; u8* target_pointer = nullptr;