diff options
author | Lioncash <mathew1800@gmail.com> | 2018-09-24 16:29:56 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-09-25 04:15:53 +0200 |
commit | 7fd598636e819d4e86874b20081945936a05c5f1 (patch) | |
tree | 046da702e80db7f8f5d75521b7864a1b7eb822a3 /src/core/hle | |
parent | process/vm_manager: Amend API to allow reading parameters from NPDM metadata (diff) | |
download | yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar.gz yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar.bz2 yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar.lz yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar.xz yuzu-7fd598636e819d4e86874b20081945936a05c5f1.tar.zst yuzu-7fd598636e819d4e86874b20081945936a05c5f1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/kernel/vm_manager.h | 3 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 337f17b7b..20d06f000 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -66,18 +66,21 @@ VMManager::~VMManager() { void VMManager::Reset(FileSys::ProgramAddressSpaceType type) { Clear(); + InitializeMemoryRegionRanges(type); + page_table.Resize(address_space_width); + // Initialize the map with a single free region covering the entire managed space. VirtualMemoryArea initial_vma; - initial_vma.size = MAX_ADDRESS; + initial_vma.size = address_space_end; vma_map.emplace(initial_vma.base, initial_vma); UpdatePageTableForVMA(initial_vma); } VMManager::VMAHandle VMManager::FindVMA(VAddr target) const { - if (target >= MAX_ADDRESS) { + if (target >= address_space_end) { return vma_map.end(); } else { return std::prev(vma_map.upper_bound(target)); @@ -291,7 +294,7 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { const VAddr target_end = target + size; ASSERT(target_end >= target); - ASSERT(target_end <= MAX_ADDRESS); + ASSERT(target_end <= address_space_end); ASSERT(size > 0); VMAIter begin_vma = StripIterConstness(FindVMA(target)); @@ -455,9 +458,10 @@ void VMManager::ClearVMAMap() { } void VMManager::ClearPageTable() { - page_table.pointers.fill(nullptr); + std::fill(page_table.pointers.begin(), page_table.pointers.end(), nullptr); page_table.special_regions.clear(); - page_table.attributes.fill(Memory::PageType::Unmapped); + std::fill(page_table.attributes.begin(), page_table.attributes.end(), + Memory::PageType::Unmapped); } u64 VMManager::GetTotalMemoryUsage() const { @@ -480,6 +484,10 @@ u64 VMManager::GetAddressSpaceSize() const { return MAX_ADDRESS; } +u64 VMManager::GetAddressSpaceWidth() const { + return address_space_width; +} + VAddr VMManager::GetCodeRegionBaseAddress() const { return code_region_base; } diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index 0ce240126..581bf3d00 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h @@ -205,6 +205,9 @@ public: /// Gets the total address space address size, used by svcGetInfo u64 GetAddressSpaceSize() const; + /// Gets the address space width in bits. + u64 GetAddressSpaceWidth() const; + /// Gets the base address of the code region. VAddr GetCodeRegionBaseAddress() const; |