diff options
author | Subv <subv2112@gmail.com> | 2017-07-22 05:22:59 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2017-09-15 21:26:13 +0200 |
commit | 214150f00c77474927cbdfb1598dbdb2cb4fcf32 (patch) | |
tree | 4e86b987f4503953ab3b6389e176bd63f7cdd672 /src/core/hle/kernel | |
parent | Kernel/Memory: Switch the current page table when a new process is scheduled. (diff) | |
download | yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar.gz yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar.bz2 yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar.lz yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar.xz yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.tar.zst yuzu-214150f00c77474927cbdfb1598dbdb2cb4fcf32.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/memory.cpp | 30 | ||||
-rw-r--r-- | src/core/hle/kernel/memory.h | 2 |
2 files changed, 7 insertions, 25 deletions
diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp index 496d07cb5..7f27e9655 100644 --- a/src/core/hle/kernel/memory.cpp +++ b/src/core/hle/kernel/memory.cpp @@ -8,7 +8,6 @@ #include <memory> #include <utility> #include <vector> -#include "audio_core/audio_core.h" #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" @@ -24,7 +23,7 @@ namespace Kernel { -static MemoryRegionInfo memory_regions[3]; +MemoryRegionInfo memory_regions[3]; /// Size of the APPLICATION, SYSTEM and BASE memory regions (respectively) for each system /// memory configuration type. @@ -96,9 +95,6 @@ MemoryRegionInfo* GetMemoryRegion(MemoryRegion region) { } } -std::array<u8, Memory::VRAM_SIZE> vram; -std::array<u8, Memory::N3DS_EXTRA_RAM_SIZE> n3ds_extra_ram; - void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) { using namespace Memory; @@ -143,30 +139,14 @@ void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mappin return; } - // TODO(yuriks): Use GetPhysicalPointer when that becomes independent of the virtual - // mappings. - u8* target_pointer = nullptr; - switch (area->paddr_base) { - case VRAM_PADDR: - target_pointer = vram.data(); - break; - case DSP_RAM_PADDR: - target_pointer = AudioCore::GetDspMemory().data(); - break; - case N3DS_EXTRA_RAM_PADDR: - target_pointer = n3ds_extra_ram.data(); - break; - default: - UNREACHABLE(); - } + u8* target_pointer = Memory::GetPhysicalPointer(area->paddr_base + offset_into_region); // TODO(yuriks): This flag seems to have some other effect, but it's unknown what MemoryState memory_state = mapping.unk_flag ? MemoryState::Static : MemoryState::IO; - auto vma = address_space - .MapBackingMemory(mapping.address, target_pointer + offset_into_region, - mapping.size, memory_state) - .Unwrap(); + auto vma = + address_space.MapBackingMemory(mapping.address, target_pointer, mapping.size, memory_state) + .Unwrap(); address_space.Reprotect(vma, mapping.read_only ? VMAPermission::Read : VMAPermission::ReadWrite); } diff --git a/src/core/hle/kernel/memory.h b/src/core/hle/kernel/memory.h index 08c1a9989..da6bb3563 100644 --- a/src/core/hle/kernel/memory.h +++ b/src/core/hle/kernel/memory.h @@ -26,4 +26,6 @@ MemoryRegionInfo* GetMemoryRegion(MemoryRegion region); void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping); void MapSharedPages(VMManager& address_space); + +extern MemoryRegionInfo memory_regions[3]; } // namespace Kernel |