diff options
| author | 2023-07-14 21:43:15 -0400 | |
|---|---|---|
| committer | 2023-07-14 21:43:15 -0400 | |
| commit | a85ce8ea563dfdd0ea61b22a80ffcf7ff66861cb (patch) | |
| tree | 40f818c29a9e19dbc2c7aeb352d7892c59d7e858 /src/core | |
| parent | file_sys/content_archive: Detect compressed NCAs (#11047) (diff) | |
| download | yuzu-a85ce8ea563dfdd0ea61b22a80ffcf7ff66861cb.tar.gz yuzu-a85ce8ea563dfdd0ea61b22a80ffcf7ff66861cb.tar.xz yuzu-a85ce8ea563dfdd0ea61b22a80ffcf7ff66861cb.zip | |
k_process: PageTable -> GetPageTable
Diffstat (limited to 'src/core')
27 files changed, 81 insertions, 90 deletions
diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index e2a13bbd2..da6078372 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp | |||
| @@ -556,7 +556,7 @@ void GDBStub::HandleQuery(std::string_view command) { | |||
| 556 | } else { | 556 | } else { |
| 557 | SendReply(fmt::format( | 557 | SendReply(fmt::format( |
| 558 | "TextSeg={:x}", | 558 | "TextSeg={:x}", |
| 559 | GetInteger(system.ApplicationProcess()->PageTable().GetCodeRegionStart()))); | 559 | GetInteger(system.ApplicationProcess()->GetPageTable().GetCodeRegionStart()))); |
| 560 | } | 560 | } |
| 561 | } else if (command.starts_with("Xfer:libraries:read::")) { | 561 | } else if (command.starts_with("Xfer:libraries:read::")) { |
| 562 | Loader::AppLoader::Modules modules; | 562 | Loader::AppLoader::Modules modules; |
| @@ -731,7 +731,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) { | |||
| 731 | std::string reply; | 731 | std::string reply; |
| 732 | 732 | ||
| 733 | auto* process = system.ApplicationProcess(); | 733 | auto* process = system.ApplicationProcess(); |
| 734 | auto& page_table = process->PageTable(); | 734 | auto& page_table = process->GetPageTable(); |
| 735 | 735 | ||
| 736 | const char* commands = "Commands:\n" | 736 | const char* commands = "Commands:\n" |
| 737 | " get fastmem\n" | 737 | " get fastmem\n" |
diff --git a/src/core/hle/kernel/k_code_memory.cpp b/src/core/hle/kernel/k_code_memory.cpp index 3583bee44..7454be55c 100644 --- a/src/core/hle/kernel/k_code_memory.cpp +++ b/src/core/hle/kernel/k_code_memory.cpp | |||
| @@ -25,7 +25,7 @@ Result KCodeMemory::Initialize(Core::DeviceMemory& device_memory, KProcessAddres | |||
| 25 | m_owner = GetCurrentProcessPointer(m_kernel); | 25 | m_owner = GetCurrentProcessPointer(m_kernel); |
| 26 | 26 | ||
| 27 | // Get the owner page table. | 27 | // Get the owner page table. |
| 28 | auto& page_table = m_owner->PageTable(); | 28 | auto& page_table = m_owner->GetPageTable(); |
| 29 | 29 | ||
| 30 | // Construct the page group. | 30 | // Construct the page group. |
| 31 | m_page_group.emplace(m_kernel, page_table.GetBlockInfoManager()); | 31 | m_page_group.emplace(m_kernel, page_table.GetBlockInfoManager()); |
| @@ -53,7 +53,7 @@ void KCodeMemory::Finalize() { | |||
| 53 | // Unlock. | 53 | // Unlock. |
| 54 | if (!m_is_mapped && !m_is_owner_mapped) { | 54 | if (!m_is_mapped && !m_is_owner_mapped) { |
| 55 | const size_t size = m_page_group->GetNumPages() * PageSize; | 55 | const size_t size = m_page_group->GetNumPages() * PageSize; |
| 56 | m_owner->PageTable().UnlockForCodeMemory(m_address, size, *m_page_group); | 56 | m_owner->GetPageTable().UnlockForCodeMemory(m_address, size, *m_page_group); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | // Close the page group. | 59 | // Close the page group. |
| @@ -75,7 +75,7 @@ Result KCodeMemory::Map(KProcessAddress address, size_t size) { | |||
| 75 | R_UNLESS(!m_is_mapped, ResultInvalidState); | 75 | R_UNLESS(!m_is_mapped, ResultInvalidState); |
| 76 | 76 | ||
| 77 | // Map the memory. | 77 | // Map the memory. |
| 78 | R_TRY(GetCurrentProcess(m_kernel).PageTable().MapPageGroup( | 78 | R_TRY(GetCurrentProcess(m_kernel).GetPageTable().MapPageGroup( |
| 79 | address, *m_page_group, KMemoryState::CodeOut, KMemoryPermission::UserReadWrite)); | 79 | address, *m_page_group, KMemoryState::CodeOut, KMemoryPermission::UserReadWrite)); |
| 80 | 80 | ||
| 81 | // Mark ourselves as mapped. | 81 | // Mark ourselves as mapped. |
| @@ -92,8 +92,8 @@ Result KCodeMemory::Unmap(KProcessAddress address, size_t size) { | |||
| 92 | KScopedLightLock lk(m_lock); | 92 | KScopedLightLock lk(m_lock); |
| 93 | 93 | ||
| 94 | // Unmap the memory. | 94 | // Unmap the memory. |
| 95 | R_TRY(GetCurrentProcess(m_kernel).PageTable().UnmapPageGroup(address, *m_page_group, | 95 | R_TRY(GetCurrentProcess(m_kernel).GetPageTable().UnmapPageGroup(address, *m_page_group, |
| 96 | KMemoryState::CodeOut)); | 96 | KMemoryState::CodeOut)); |
| 97 | 97 | ||
| 98 | // Mark ourselves as unmapped. | 98 | // Mark ourselves as unmapped. |
| 99 | m_is_mapped = false; | 99 | m_is_mapped = false; |
| @@ -126,8 +126,8 @@ Result KCodeMemory::MapToOwner(KProcessAddress address, size_t size, Svc::Memory | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | // Map the memory. | 128 | // Map the memory. |
| 129 | R_TRY(m_owner->PageTable().MapPageGroup(address, *m_page_group, KMemoryState::GeneratedCode, | 129 | R_TRY(m_owner->GetPageTable().MapPageGroup(address, *m_page_group, KMemoryState::GeneratedCode, |
| 130 | k_perm)); | 130 | k_perm)); |
| 131 | 131 | ||
| 132 | // Mark ourselves as mapped. | 132 | // Mark ourselves as mapped. |
| 133 | m_is_owner_mapped = true; | 133 | m_is_owner_mapped = true; |
| @@ -143,7 +143,8 @@ Result KCodeMemory::UnmapFromOwner(KProcessAddress address, size_t size) { | |||
| 143 | KScopedLightLock lk(m_lock); | 143 | KScopedLightLock lk(m_lock); |
| 144 | 144 | ||
| 145 | // Unmap the memory. | 145 | // Unmap the memory. |
| 146 | R_TRY(m_owner->PageTable().UnmapPageGroup(address, *m_page_group, KMemoryState::GeneratedCode)); | 146 | R_TRY(m_owner->GetPageTable().UnmapPageGroup(address, *m_page_group, |
| 147 | KMemoryState::GeneratedCode)); | ||
| 147 | 148 | ||
| 148 | // Mark ourselves as unmapped. | 149 | // Mark ourselves as unmapped. |
| 149 | m_is_owner_mapped = false; | 150 | m_is_owner_mapped = false; |
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index efe86ad27..44c7cb22f 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp | |||
| @@ -38,7 +38,7 @@ namespace { | |||
| 38 | */ | 38 | */ |
| 39 | void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority, | 39 | void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority, |
| 40 | KProcessAddress stack_top) { | 40 | KProcessAddress stack_top) { |
| 41 | const KProcessAddress entry_point = owner_process.PageTable().GetCodeRegionStart(); | 41 | const KProcessAddress entry_point = owner_process.GetPageTable().GetCodeRegionStart(); |
| 42 | ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::ThreadCountMax, 1)); | 42 | ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::ThreadCountMax, 1)); |
| 43 | 43 | ||
| 44 | KThread* thread = KThread::Create(system.Kernel()); | 44 | KThread* thread = KThread::Create(system.Kernel()); |
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index 925981d06..c9b37e138 100644 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h | |||
| @@ -110,16 +110,6 @@ public: | |||
| 110 | ProcessType type, KResourceLimit* res_limit); | 110 | ProcessType type, KResourceLimit* res_limit); |
| 111 | 111 | ||
| 112 | /// Gets a reference to the process' page table. | 112 | /// Gets a reference to the process' page table. |
| 113 | KPageTable& PageTable() { | ||
| 114 | return m_page_table; | ||
| 115 | } | ||
| 116 | |||
| 117 | /// Gets const a reference to the process' page table. | ||
| 118 | const KPageTable& PageTable() const { | ||
| 119 | return m_page_table; | ||
| 120 | } | ||
| 121 | |||
| 122 | /// Gets a reference to the process' page table. | ||
| 123 | KPageTable& GetPageTable() { | 113 | KPageTable& GetPageTable() { |
| 124 | return m_page_table; | 114 | return m_page_table; |
| 125 | } | 115 | } |
diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp index efb5699de..f713968f6 100644 --- a/src/core/hle/kernel/k_shared_memory.cpp +++ b/src/core/hle/kernel/k_shared_memory.cpp | |||
| @@ -90,8 +90,8 @@ Result KSharedMemory::Map(KProcess& target_process, KProcessAddress address, std | |||
| 90 | R_UNLESS(map_perm == test_perm, ResultInvalidNewMemoryPermission); | 90 | R_UNLESS(map_perm == test_perm, ResultInvalidNewMemoryPermission); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | R_RETURN(target_process.PageTable().MapPageGroup(address, *m_page_group, KMemoryState::Shared, | 93 | R_RETURN(target_process.GetPageTable().MapPageGroup( |
| 94 | ConvertToKMemoryPermission(map_perm))); | 94 | address, *m_page_group, KMemoryState::Shared, ConvertToKMemoryPermission(map_perm))); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | Result KSharedMemory::Unmap(KProcess& target_process, KProcessAddress address, | 97 | Result KSharedMemory::Unmap(KProcess& target_process, KProcessAddress address, |
| @@ -100,7 +100,7 @@ Result KSharedMemory::Unmap(KProcess& target_process, KProcessAddress address, | |||
| 100 | R_UNLESS(m_size == unmap_size, ResultInvalidSize); | 100 | R_UNLESS(m_size == unmap_size, ResultInvalidSize); |
| 101 | 101 | ||
| 102 | R_RETURN( | 102 | R_RETURN( |
| 103 | target_process.PageTable().UnmapPageGroup(address, *m_page_group, KMemoryState::Shared)); | 103 | target_process.GetPageTable().UnmapPageGroup(address, *m_page_group, KMemoryState::Shared)); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | } // namespace Kernel | 106 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/k_thread_local_page.cpp b/src/core/hle/kernel/k_thread_local_page.cpp index b4a1e3cdb..2c45b4232 100644 --- a/src/core/hle/kernel/k_thread_local_page.cpp +++ b/src/core/hle/kernel/k_thread_local_page.cpp | |||
| @@ -25,9 +25,9 @@ Result KThreadLocalPage::Initialize(KernelCore& kernel, KProcess* process) { | |||
| 25 | 25 | ||
| 26 | // Map the address in. | 26 | // Map the address in. |
| 27 | const auto phys_addr = kernel.System().DeviceMemory().GetPhysicalAddr(page_buf); | 27 | const auto phys_addr = kernel.System().DeviceMemory().GetPhysicalAddr(page_buf); |
| 28 | R_TRY(m_owner->PageTable().MapPages(std::addressof(m_virt_addr), 1, PageSize, phys_addr, | 28 | R_TRY(m_owner->GetPageTable().MapPages(std::addressof(m_virt_addr), 1, PageSize, phys_addr, |
| 29 | KMemoryState::ThreadLocal, | 29 | KMemoryState::ThreadLocal, |
| 30 | KMemoryPermission::UserReadWrite)); | 30 | KMemoryPermission::UserReadWrite)); |
| 31 | 31 | ||
| 32 | // We succeeded. | 32 | // We succeeded. |
| 33 | page_buf_guard.Cancel(); | 33 | page_buf_guard.Cancel(); |
| @@ -37,11 +37,11 @@ Result KThreadLocalPage::Initialize(KernelCore& kernel, KProcess* process) { | |||
| 37 | 37 | ||
| 38 | Result KThreadLocalPage::Finalize() { | 38 | Result KThreadLocalPage::Finalize() { |
| 39 | // Get the physical address of the page. | 39 | // Get the physical address of the page. |
| 40 | const KPhysicalAddress phys_addr = m_owner->PageTable().GetPhysicalAddr(m_virt_addr); | 40 | const KPhysicalAddress phys_addr = m_owner->GetPageTable().GetPhysicalAddr(m_virt_addr); |
| 41 | ASSERT(phys_addr); | 41 | ASSERT(phys_addr); |
| 42 | 42 | ||
| 43 | // Unmap the page. | 43 | // Unmap the page. |
| 44 | R_TRY(m_owner->PageTable().UnmapPages(this->GetAddress(), 1, KMemoryState::ThreadLocal)); | 44 | R_TRY(m_owner->GetPageTable().UnmapPages(this->GetAddress(), 1, KMemoryState::ThreadLocal)); |
| 45 | 45 | ||
| 46 | // Free the page. | 46 | // Free the page. |
| 47 | KPageBuffer::Free(*m_kernel, KPageBuffer::FromPhysicalAddress(m_kernel->System(), phys_addr)); | 47 | KPageBuffer::Free(*m_kernel, KPageBuffer::FromPhysicalAddress(m_kernel->System(), phys_addr)); |
diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp index 082942dab..c2c8be10f 100644 --- a/src/core/hle/kernel/svc/svc_cache.cpp +++ b/src/core/hle/kernel/svc/svc_cache.cpp | |||
| @@ -42,7 +42,7 @@ Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 ad | |||
| 42 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); | 42 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); |
| 43 | 43 | ||
| 44 | // Verify the region is within range. | 44 | // Verify the region is within range. |
| 45 | auto& page_table = process->PageTable(); | 45 | auto& page_table = process->GetPageTable(); |
| 46 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); | 46 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |
| 47 | 47 | ||
| 48 | // Perform the operation. | 48 | // Perform the operation. |
diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index 687baff82..bae4cb0cd 100644 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp | |||
| @@ -48,7 +48,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, u64 address, uint64_t | |||
| 48 | SCOPE_EXIT({ code_mem->Close(); }); | 48 | SCOPE_EXIT({ code_mem->Close(); }); |
| 49 | 49 | ||
| 50 | // Verify that the region is in range. | 50 | // Verify that the region is in range. |
| 51 | R_UNLESS(GetCurrentProcess(system.Kernel()).PageTable().Contains(address, size), | 51 | R_UNLESS(GetCurrentProcess(system.Kernel()).GetPageTable().Contains(address, size), |
| 52 | ResultInvalidCurrentMemory); | 52 | ResultInvalidCurrentMemory); |
| 53 | 53 | ||
| 54 | // Initialize the code memory. | 54 | // Initialize the code memory. |
| @@ -92,7 +92,7 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, | |||
| 92 | case CodeMemoryOperation::Map: { | 92 | case CodeMemoryOperation::Map: { |
| 93 | // Check that the region is in range. | 93 | // Check that the region is in range. |
| 94 | R_UNLESS(GetCurrentProcess(system.Kernel()) | 94 | R_UNLESS(GetCurrentProcess(system.Kernel()) |
| 95 | .PageTable() | 95 | .GetPageTable() |
| 96 | .CanContain(address, size, KMemoryState::CodeOut), | 96 | .CanContain(address, size, KMemoryState::CodeOut), |
| 97 | ResultInvalidMemoryRegion); | 97 | ResultInvalidMemoryRegion); |
| 98 | 98 | ||
| @@ -105,7 +105,7 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, | |||
| 105 | case CodeMemoryOperation::Unmap: { | 105 | case CodeMemoryOperation::Unmap: { |
| 106 | // Check that the region is in range. | 106 | // Check that the region is in range. |
| 107 | R_UNLESS(GetCurrentProcess(system.Kernel()) | 107 | R_UNLESS(GetCurrentProcess(system.Kernel()) |
| 108 | .PageTable() | 108 | .GetPageTable() |
| 109 | .CanContain(address, size, KMemoryState::CodeOut), | 109 | .CanContain(address, size, KMemoryState::CodeOut), |
| 110 | ResultInvalidMemoryRegion); | 110 | ResultInvalidMemoryRegion); |
| 111 | 111 | ||
| @@ -117,8 +117,8 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, | |||
| 117 | } break; | 117 | } break; |
| 118 | case CodeMemoryOperation::MapToOwner: { | 118 | case CodeMemoryOperation::MapToOwner: { |
| 119 | // Check that the region is in range. | 119 | // Check that the region is in range. |
| 120 | R_UNLESS(code_mem->GetOwner()->PageTable().CanContain(address, size, | 120 | R_UNLESS(code_mem->GetOwner()->GetPageTable().CanContain(address, size, |
| 121 | KMemoryState::GeneratedCode), | 121 | KMemoryState::GeneratedCode), |
| 122 | ResultInvalidMemoryRegion); | 122 | ResultInvalidMemoryRegion); |
| 123 | 123 | ||
| 124 | // Check the memory permission. | 124 | // Check the memory permission. |
| @@ -129,8 +129,8 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, | |||
| 129 | } break; | 129 | } break; |
| 130 | case CodeMemoryOperation::UnmapFromOwner: { | 130 | case CodeMemoryOperation::UnmapFromOwner: { |
| 131 | // Check that the region is in range. | 131 | // Check that the region is in range. |
| 132 | R_UNLESS(code_mem->GetOwner()->PageTable().CanContain(address, size, | 132 | R_UNLESS(code_mem->GetOwner()->GetPageTable().CanContain(address, size, |
| 133 | KMemoryState::GeneratedCode), | 133 | KMemoryState::GeneratedCode), |
| 134 | ResultInvalidMemoryRegion); | 134 | ResultInvalidMemoryRegion); |
| 135 | 135 | ||
| 136 | // Check the memory permission. | 136 | // Check the memory permission. |
diff --git a/src/core/hle/kernel/svc/svc_device_address_space.cpp b/src/core/hle/kernel/svc/svc_device_address_space.cpp index ec3143e67..42add9473 100644 --- a/src/core/hle/kernel/svc/svc_device_address_space.cpp +++ b/src/core/hle/kernel/svc/svc_device_address_space.cpp | |||
| @@ -107,7 +107,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han | |||
| 107 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); | 107 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); |
| 108 | 108 | ||
| 109 | // Validate that the process address is within range. | 109 | // Validate that the process address is within range. |
| 110 | auto& page_table = process->PageTable(); | 110 | auto& page_table = process->GetPageTable(); |
| 111 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); | 111 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); |
| 112 | 112 | ||
| 113 | // Map. | 113 | // Map. |
| @@ -148,7 +148,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han | |||
| 148 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); | 148 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); |
| 149 | 149 | ||
| 150 | // Validate that the process address is within range. | 150 | // Validate that the process address is within range. |
| 151 | auto& page_table = process->PageTable(); | 151 | auto& page_table = process->GetPageTable(); |
| 152 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); | 152 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); |
| 153 | 153 | ||
| 154 | // Map. | 154 | // Map. |
| @@ -180,7 +180,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p | |||
| 180 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); | 180 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); |
| 181 | 181 | ||
| 182 | // Validate that the process address is within range. | 182 | // Validate that the process address is within range. |
| 183 | auto& page_table = process->PageTable(); | 183 | auto& page_table = process->GetPageTable(); |
| 184 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); | 184 | R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory); |
| 185 | 185 | ||
| 186 | R_RETURN(das->Unmap(std::addressof(page_table), process_address, size, device_address)); | 186 | R_RETURN(das->Unmap(std::addressof(page_table), process_address, size, device_address)); |
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index 445cdd87b..f99964028 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp | |||
| @@ -54,35 +54,35 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle | |||
| 54 | R_SUCCEED(); | 54 | R_SUCCEED(); |
| 55 | 55 | ||
| 56 | case InfoType::AliasRegionAddress: | 56 | case InfoType::AliasRegionAddress: |
| 57 | *result = GetInteger(process->PageTable().GetAliasRegionStart()); | 57 | *result = GetInteger(process->GetPageTable().GetAliasRegionStart()); |
| 58 | R_SUCCEED(); | 58 | R_SUCCEED(); |
| 59 | 59 | ||
| 60 | case InfoType::AliasRegionSize: | 60 | case InfoType::AliasRegionSize: |
| 61 | *result = process->PageTable().GetAliasRegionSize(); | 61 | *result = process->GetPageTable().GetAliasRegionSize(); |
| 62 | R_SUCCEED(); | 62 | R_SUCCEED(); |
| 63 | 63 | ||
| 64 | case InfoType::HeapRegionAddress: | 64 | case InfoType::HeapRegionAddress: |
| 65 | *result = GetInteger(process->PageTable().GetHeapRegionStart()); | 65 | *result = GetInteger(process->GetPageTable().GetHeapRegionStart()); |
| 66 | R_SUCCEED(); | 66 | R_SUCCEED(); |
| 67 | 67 | ||
| 68 | case InfoType::HeapRegionSize: | 68 | case InfoType::HeapRegionSize: |
| 69 | *result = process->PageTable().GetHeapRegionSize(); | 69 | *result = process->GetPageTable().GetHeapRegionSize(); |
| 70 | R_SUCCEED(); | 70 | R_SUCCEED(); |
| 71 | 71 | ||
| 72 | case InfoType::AslrRegionAddress: | 72 | case InfoType::AslrRegionAddress: |
| 73 | *result = GetInteger(process->PageTable().GetAliasCodeRegionStart()); | 73 | *result = GetInteger(process->GetPageTable().GetAliasCodeRegionStart()); |
| 74 | R_SUCCEED(); | 74 | R_SUCCEED(); |
| 75 | 75 | ||
| 76 | case InfoType::AslrRegionSize: | 76 | case InfoType::AslrRegionSize: |
| 77 | *result = process->PageTable().GetAliasCodeRegionSize(); | 77 | *result = process->GetPageTable().GetAliasCodeRegionSize(); |
| 78 | R_SUCCEED(); | 78 | R_SUCCEED(); |
| 79 | 79 | ||
| 80 | case InfoType::StackRegionAddress: | 80 | case InfoType::StackRegionAddress: |
| 81 | *result = GetInteger(process->PageTable().GetStackRegionStart()); | 81 | *result = GetInteger(process->GetPageTable().GetStackRegionStart()); |
| 82 | R_SUCCEED(); | 82 | R_SUCCEED(); |
| 83 | 83 | ||
| 84 | case InfoType::StackRegionSize: | 84 | case InfoType::StackRegionSize: |
| 85 | *result = process->PageTable().GetStackRegionSize(); | 85 | *result = process->GetPageTable().GetStackRegionSize(); |
| 86 | R_SUCCEED(); | 86 | R_SUCCEED(); |
| 87 | 87 | ||
| 88 | case InfoType::TotalMemorySize: | 88 | case InfoType::TotalMemorySize: |
diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 5dcb7f045..bcf3d0d2b 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp | |||
| @@ -112,7 +112,7 @@ Result SetMemoryPermission(Core::System& system, u64 address, u64 size, MemoryPe | |||
| 112 | R_UNLESS(IsValidSetMemoryPermission(perm), ResultInvalidNewMemoryPermission); | 112 | R_UNLESS(IsValidSetMemoryPermission(perm), ResultInvalidNewMemoryPermission); |
| 113 | 113 | ||
| 114 | // Validate that the region is in range for the current process. | 114 | // Validate that the region is in range for the current process. |
| 115 | auto& page_table = GetCurrentProcess(system.Kernel()).PageTable(); | 115 | auto& page_table = GetCurrentProcess(system.Kernel()).GetPageTable(); |
| 116 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); | 116 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |
| 117 | 117 | ||
| 118 | // Set the memory attribute. | 118 | // Set the memory attribute. |
| @@ -136,7 +136,7 @@ Result SetMemoryAttribute(Core::System& system, u64 address, u64 size, u32 mask, | |||
| 136 | R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); | 136 | R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); |
| 137 | 137 | ||
| 138 | // Validate that the region is in range for the current process. | 138 | // Validate that the region is in range for the current process. |
| 139 | auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()}; | 139 | auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()}; |
| 140 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); | 140 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |
| 141 | 141 | ||
| 142 | // Set the memory attribute. | 142 | // Set the memory attribute. |
| @@ -148,7 +148,7 @@ Result MapMemory(Core::System& system, u64 dst_addr, u64 src_addr, u64 size) { | |||
| 148 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | 148 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, |
| 149 | src_addr, size); | 149 | src_addr, size); |
| 150 | 150 | ||
| 151 | auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()}; | 151 | auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()}; |
| 152 | 152 | ||
| 153 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; | 153 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; |
| 154 | result.IsError()) { | 154 | result.IsError()) { |
| @@ -163,7 +163,7 @@ Result UnmapMemory(Core::System& system, u64 dst_addr, u64 src_addr, u64 size) { | |||
| 163 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | 163 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, |
| 164 | src_addr, size); | 164 | src_addr, size); |
| 165 | 165 | ||
| 166 | auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()}; | 166 | auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()}; |
| 167 | 167 | ||
| 168 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; | 168 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; |
| 169 | result.IsError()) { | 169 | result.IsError()) { |
diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp index c2fbfb59a..56643c75c 100644 --- a/src/core/hle/kernel/svc/svc_physical_memory.cpp +++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp | |||
| @@ -16,7 +16,7 @@ Result SetHeapSize(Core::System& system, u64* out_address, u64 size) { | |||
| 16 | R_UNLESS(size < MainMemorySizeMax, ResultInvalidSize); | 16 | R_UNLESS(size < MainMemorySizeMax, ResultInvalidSize); |
| 17 | 17 | ||
| 18 | // Set the heap size. | 18 | // Set the heap size. |
| 19 | R_RETURN(GetCurrentProcess(system.Kernel()).PageTable().SetHeapSize(out_address, size)); | 19 | R_RETURN(GetCurrentProcess(system.Kernel()).GetPageTable().SetHeapSize(out_address, size)); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | /// Maps memory at a desired address | 22 | /// Maps memory at a desired address |
| @@ -44,7 +44,7 @@ Result MapPhysicalMemory(Core::System& system, u64 addr, u64 size) { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())}; | 46 | KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())}; |
| 47 | auto& page_table{current_process->PageTable()}; | 47 | auto& page_table{current_process->GetPageTable()}; |
| 48 | 48 | ||
| 49 | if (current_process->GetSystemResourceSize() == 0) { | 49 | if (current_process->GetSystemResourceSize() == 0) { |
| 50 | LOG_ERROR(Kernel_SVC, "System Resource Size is zero"); | 50 | LOG_ERROR(Kernel_SVC, "System Resource Size is zero"); |
| @@ -93,7 +93,7 @@ Result UnmapPhysicalMemory(Core::System& system, u64 addr, u64 size) { | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())}; | 95 | KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())}; |
| 96 | auto& page_table{current_process->PageTable()}; | 96 | auto& page_table{current_process->GetPageTable()}; |
| 97 | 97 | ||
| 98 | if (current_process->GetSystemResourceSize() == 0) { | 98 | if (current_process->GetSystemResourceSize() == 0) { |
| 99 | LOG_ERROR(Kernel_SVC, "System Resource Size is zero"); | 99 | LOG_ERROR(Kernel_SVC, "System Resource Size is zero"); |
diff --git a/src/core/hle/kernel/svc/svc_process.cpp b/src/core/hle/kernel/svc/svc_process.cpp index 619ed16a3..4b438fe52 100644 --- a/src/core/hle/kernel/svc/svc_process.cpp +++ b/src/core/hle/kernel/svc/svc_process.cpp | |||
| @@ -66,7 +66,7 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, u64 out_proc | |||
| 66 | auto& kernel = system.Kernel(); | 66 | auto& kernel = system.Kernel(); |
| 67 | const auto total_copy_size = out_process_ids_size * sizeof(u64); | 67 | const auto total_copy_size = out_process_ids_size * sizeof(u64); |
| 68 | 68 | ||
| 69 | if (out_process_ids_size > 0 && !GetCurrentProcess(kernel).PageTable().IsInsideAddressSpace( | 69 | if (out_process_ids_size > 0 && !GetCurrentProcess(kernel).GetPageTable().IsInsideAddressSpace( |
| 70 | out_process_ids, total_copy_size)) { | 70 | out_process_ids, total_copy_size)) { |
| 71 | LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}", | 71 | LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}", |
| 72 | out_process_ids, out_process_ids + total_copy_size); | 72 | out_process_ids, out_process_ids + total_copy_size); |
diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp index aee0f2f36..ee11e9639 100644 --- a/src/core/hle/kernel/svc/svc_process_memory.cpp +++ b/src/core/hle/kernel/svc/svc_process_memory.cpp | |||
| @@ -49,7 +49,7 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, u | |||
| 49 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); | 49 | R_UNLESS(process.IsNotNull(), ResultInvalidHandle); |
| 50 | 50 | ||
| 51 | // Validate that the address is in range. | 51 | // Validate that the address is in range. |
| 52 | auto& page_table = process->PageTable(); | 52 | auto& page_table = process->GetPageTable(); |
| 53 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); | 53 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |
| 54 | 54 | ||
| 55 | // Set the memory permission. | 55 | // Set the memory permission. |
| @@ -77,8 +77,8 @@ Result MapProcessMemory(Core::System& system, u64 dst_address, Handle process_ha | |||
| 77 | R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); | 77 | R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); |
| 78 | 78 | ||
| 79 | // Get the page tables. | 79 | // Get the page tables. |
| 80 | auto& dst_pt = dst_process->PageTable(); | 80 | auto& dst_pt = dst_process->GetPageTable(); |
| 81 | auto& src_pt = src_process->PageTable(); | 81 | auto& src_pt = src_process->GetPageTable(); |
| 82 | 82 | ||
| 83 | // Validate that the mapping is in range. | 83 | // Validate that the mapping is in range. |
| 84 | R_UNLESS(src_pt.Contains(src_address, size), ResultInvalidCurrentMemory); | 84 | R_UNLESS(src_pt.Contains(src_address, size), ResultInvalidCurrentMemory); |
| @@ -118,8 +118,8 @@ Result UnmapProcessMemory(Core::System& system, u64 dst_address, Handle process_ | |||
| 118 | R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); | 118 | R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); |
| 119 | 119 | ||
| 120 | // Get the page tables. | 120 | // Get the page tables. |
| 121 | auto& dst_pt = dst_process->PageTable(); | 121 | auto& dst_pt = dst_process->GetPageTable(); |
| 122 | auto& src_pt = src_process->PageTable(); | 122 | auto& src_pt = src_process->GetPageTable(); |
| 123 | 123 | ||
| 124 | // Validate that the mapping is in range. | 124 | // Validate that the mapping is in range. |
| 125 | R_UNLESS(src_pt.Contains(src_address, size), ResultInvalidCurrentMemory); | 125 | R_UNLESS(src_pt.Contains(src_address, size), ResultInvalidCurrentMemory); |
| @@ -178,7 +178,7 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst | |||
| 178 | R_THROW(ResultInvalidHandle); | 178 | R_THROW(ResultInvalidHandle); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | auto& page_table = process->PageTable(); | 181 | auto& page_table = process->GetPageTable(); |
| 182 | if (!page_table.IsInsideAddressSpace(src_address, size)) { | 182 | if (!page_table.IsInsideAddressSpace(src_address, size)) { |
| 183 | LOG_ERROR(Kernel_SVC, | 183 | LOG_ERROR(Kernel_SVC, |
| 184 | "Source address range is not within the address space (src_address=0x{:016X}, " | 184 | "Source address range is not within the address space (src_address=0x{:016X}, " |
| @@ -246,7 +246,7 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d | |||
| 246 | R_THROW(ResultInvalidHandle); | 246 | R_THROW(ResultInvalidHandle); |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | auto& page_table = process->PageTable(); | 249 | auto& page_table = process->GetPageTable(); |
| 250 | if (!page_table.IsInsideAddressSpace(src_address, size)) { | 250 | if (!page_table.IsInsideAddressSpace(src_address, size)) { |
| 251 | LOG_ERROR(Kernel_SVC, | 251 | LOG_ERROR(Kernel_SVC, |
| 252 | "Source address range is not within the address space (src_address=0x{:016X}, " | 252 | "Source address range is not within the address space (src_address=0x{:016X}, " |
diff --git a/src/core/hle/kernel/svc/svc_query_memory.cpp b/src/core/hle/kernel/svc/svc_query_memory.cpp index 4d9fcd25f..51af06e97 100644 --- a/src/core/hle/kernel/svc/svc_query_memory.cpp +++ b/src/core/hle/kernel/svc/svc_query_memory.cpp | |||
| @@ -31,7 +31,7 @@ Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageIn | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | auto& current_memory{GetCurrentMemory(system.Kernel())}; | 33 | auto& current_memory{GetCurrentMemory(system.Kernel())}; |
| 34 | const auto memory_info{process->PageTable().QueryInfo(address).GetSvcMemoryInfo()}; | 34 | const auto memory_info{process->GetPageTable().QueryInfo(address).GetSvcMemoryInfo()}; |
| 35 | 35 | ||
| 36 | current_memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info)); | 36 | current_memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info)); |
| 37 | 37 | ||
diff --git a/src/core/hle/kernel/svc/svc_shared_memory.cpp b/src/core/hle/kernel/svc/svc_shared_memory.cpp index a698596aa..012b1ae2b 100644 --- a/src/core/hle/kernel/svc/svc_shared_memory.cpp +++ b/src/core/hle/kernel/svc/svc_shared_memory.cpp | |||
| @@ -43,7 +43,7 @@ Result MapSharedMemory(Core::System& system, Handle shmem_handle, u64 address, u | |||
| 43 | 43 | ||
| 44 | // Get the current process. | 44 | // Get the current process. |
| 45 | auto& process = GetCurrentProcess(system.Kernel()); | 45 | auto& process = GetCurrentProcess(system.Kernel()); |
| 46 | auto& page_table = process.PageTable(); | 46 | auto& page_table = process.GetPageTable(); |
| 47 | 47 | ||
| 48 | // Get the shared memory. | 48 | // Get the shared memory. |
| 49 | KScopedAutoObject shmem = process.GetHandleTable().GetObject<KSharedMemory>(shmem_handle); | 49 | KScopedAutoObject shmem = process.GetHandleTable().GetObject<KSharedMemory>(shmem_handle); |
| @@ -73,7 +73,7 @@ Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, u64 address, | |||
| 73 | 73 | ||
| 74 | // Get the current process. | 74 | // Get the current process. |
| 75 | auto& process = GetCurrentProcess(system.Kernel()); | 75 | auto& process = GetCurrentProcess(system.Kernel()); |
| 76 | auto& page_table = process.PageTable(); | 76 | auto& page_table = process.GetPageTable(); |
| 77 | 77 | ||
| 78 | // Get the shared memory. | 78 | // Get the shared memory. |
| 79 | KScopedAutoObject shmem = process.GetHandleTable().GetObject<KSharedMemory>(shmem_handle); | 79 | KScopedAutoObject shmem = process.GetHandleTable().GetObject<KSharedMemory>(shmem_handle); |
diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp index 36b94e6bf..d102e94a8 100644 --- a/src/core/hle/kernel/svc/svc_thread.cpp +++ b/src/core/hle/kernel/svc/svc_thread.cpp | |||
| @@ -236,7 +236,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, u64 out_thread_ | |||
| 236 | const auto total_copy_size = out_thread_ids_size * sizeof(u64); | 236 | const auto total_copy_size = out_thread_ids_size * sizeof(u64); |
| 237 | 237 | ||
| 238 | if (out_thread_ids_size > 0 && | 238 | if (out_thread_ids_size > 0 && |
| 239 | !current_process->PageTable().IsInsideAddressSpace(out_thread_ids, total_copy_size)) { | 239 | !current_process->GetPageTable().IsInsideAddressSpace(out_thread_ids, total_copy_size)) { |
| 240 | LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}", | 240 | LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}", |
| 241 | out_thread_ids, out_thread_ids + total_copy_size); | 241 | out_thread_ids, out_thread_ids + total_copy_size); |
| 242 | R_THROW(ResultInvalidCurrentMemory); | 242 | R_THROW(ResultInvalidCurrentMemory); |
diff --git a/src/core/hle/kernel/svc/svc_transfer_memory.cpp b/src/core/hle/kernel/svc/svc_transfer_memory.cpp index 82d469a37..7d94e7f09 100644 --- a/src/core/hle/kernel/svc/svc_transfer_memory.cpp +++ b/src/core/hle/kernel/svc/svc_transfer_memory.cpp | |||
| @@ -55,7 +55,7 @@ Result CreateTransferMemory(Core::System& system, Handle* out, u64 address, u64 | |||
| 55 | SCOPE_EXIT({ trmem->Close(); }); | 55 | SCOPE_EXIT({ trmem->Close(); }); |
| 56 | 56 | ||
| 57 | // Ensure that the region is in range. | 57 | // Ensure that the region is in range. |
| 58 | R_UNLESS(process.PageTable().Contains(address, size), ResultInvalidCurrentMemory); | 58 | R_UNLESS(process.GetPageTable().Contains(address, size), ResultInvalidCurrentMemory); |
| 59 | 59 | ||
| 60 | // Initialize the transfer memory. | 60 | // Initialize the transfer memory. |
| 61 | R_TRY(trmem->Initialize(address, size, map_perm)); | 61 | R_TRY(trmem->Initialize(address, size, map_perm)); |
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index c42489ff9..3d34917e8 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp | |||
| @@ -358,7 +358,7 @@ public: | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | ResultVal<VAddr> MapProcessCodeMemory(Kernel::KProcess* process, VAddr base_addr, u64 size) { | 360 | ResultVal<VAddr> MapProcessCodeMemory(Kernel::KProcess* process, VAddr base_addr, u64 size) { |
| 361 | auto& page_table{process->PageTable()}; | 361 | auto& page_table{process->GetPageTable()}; |
| 362 | VAddr addr{}; | 362 | VAddr addr{}; |
| 363 | 363 | ||
| 364 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { | 364 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { |
| @@ -382,7 +382,7 @@ public: | |||
| 382 | ResultVal<VAddr> MapNro(Kernel::KProcess* process, VAddr nro_addr, std::size_t nro_size, | 382 | ResultVal<VAddr> MapNro(Kernel::KProcess* process, VAddr nro_addr, std::size_t nro_size, |
| 383 | VAddr bss_addr, std::size_t bss_size, std::size_t size) { | 383 | VAddr bss_addr, std::size_t bss_size, std::size_t size) { |
| 384 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { | 384 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { |
| 385 | auto& page_table{process->PageTable()}; | 385 | auto& page_table{process->GetPageTable()}; |
| 386 | VAddr addr{}; | 386 | VAddr addr{}; |
| 387 | 387 | ||
| 388 | CASCADE_RESULT(addr, MapProcessCodeMemory(process, nro_addr, nro_size)); | 388 | CASCADE_RESULT(addr, MapProcessCodeMemory(process, nro_addr, nro_size)); |
| @@ -437,12 +437,12 @@ public: | |||
| 437 | CopyCode(nro_addr + nro_header.segment_headers[DATA_INDEX].memory_offset, data_start, | 437 | CopyCode(nro_addr + nro_header.segment_headers[DATA_INDEX].memory_offset, data_start, |
| 438 | nro_header.segment_headers[DATA_INDEX].memory_size); | 438 | nro_header.segment_headers[DATA_INDEX].memory_size); |
| 439 | 439 | ||
| 440 | CASCADE_CODE(process->PageTable().SetProcessMemoryPermission( | 440 | CASCADE_CODE(process->GetPageTable().SetProcessMemoryPermission( |
| 441 | text_start, ro_start - text_start, Kernel::Svc::MemoryPermission::ReadExecute)); | 441 | text_start, ro_start - text_start, Kernel::Svc::MemoryPermission::ReadExecute)); |
| 442 | CASCADE_CODE(process->PageTable().SetProcessMemoryPermission( | 442 | CASCADE_CODE(process->GetPageTable().SetProcessMemoryPermission( |
| 443 | ro_start, data_start - ro_start, Kernel::Svc::MemoryPermission::Read)); | 443 | ro_start, data_start - ro_start, Kernel::Svc::MemoryPermission::Read)); |
| 444 | 444 | ||
| 445 | return process->PageTable().SetProcessMemoryPermission( | 445 | return process->GetPageTable().SetProcessMemoryPermission( |
| 446 | data_start, bss_end_addr - data_start, Kernel::Svc::MemoryPermission::ReadWrite); | 446 | data_start, bss_end_addr - data_start, Kernel::Svc::MemoryPermission::ReadWrite); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| @@ -571,7 +571,7 @@ public: | |||
| 571 | 571 | ||
| 572 | Result UnmapNro(const NROInfo& info) { | 572 | Result UnmapNro(const NROInfo& info) { |
| 573 | // Each region must be unmapped separately to validate memory state | 573 | // Each region must be unmapped separately to validate memory state |
| 574 | auto& page_table{system.ApplicationProcess()->PageTable()}; | 574 | auto& page_table{system.ApplicationProcess()->GetPageTable()}; |
| 575 | 575 | ||
| 576 | if (info.bss_size != 0) { | 576 | if (info.bss_size != 0) { |
| 577 | CASCADE_CODE(page_table.UnmapCodeMemory( | 577 | CASCADE_CODE(page_table.UnmapCodeMemory( |
| @@ -643,7 +643,7 @@ public: | |||
| 643 | 643 | ||
| 644 | initialized = true; | 644 | initialized = true; |
| 645 | current_map_addr = | 645 | current_map_addr = |
| 646 | GetInteger(system.ApplicationProcess()->PageTable().GetAliasCodeRegionStart()); | 646 | GetInteger(system.ApplicationProcess()->GetPageTable().GetAliasCodeRegionStart()); |
| 647 | 647 | ||
| 648 | IPC::ResponseBuilder rb{ctx, 2}; | 648 | IPC::ResponseBuilder rb{ctx, 2}; |
| 649 | rb.Push(ResultSuccess); | 649 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index e7f7e273b..968eaa175 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -128,7 +128,7 @@ NvResult nvmap::IocAlloc(std::span<const u8> input, std::span<u8> output) { | |||
| 128 | } | 128 | } |
| 129 | bool is_out_io{}; | 129 | bool is_out_io{}; |
| 130 | ASSERT(system.ApplicationProcess() | 130 | ASSERT(system.ApplicationProcess() |
| 131 | ->PageTable() | 131 | ->GetPageTable() |
| 132 | .LockForMapDeviceAddressSpace(&is_out_io, handle_description->address, | 132 | .LockForMapDeviceAddressSpace(&is_out_io, handle_description->address, |
| 133 | handle_description->size, | 133 | handle_description->size, |
| 134 | Kernel::KMemoryPermission::None, true, false) | 134 | Kernel::KMemoryPermission::None, true, false) |
| @@ -255,7 +255,7 @@ NvResult nvmap::IocFree(std::span<const u8> input, std::span<u8> output) { | |||
| 255 | if (auto freeInfo{file.FreeHandle(params.handle, false)}) { | 255 | if (auto freeInfo{file.FreeHandle(params.handle, false)}) { |
| 256 | if (freeInfo->can_unlock) { | 256 | if (freeInfo->can_unlock) { |
| 257 | ASSERT(system.ApplicationProcess() | 257 | ASSERT(system.ApplicationProcess() |
| 258 | ->PageTable() | 258 | ->GetPageTable() |
| 259 | .UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size) | 259 | .UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size) |
| 260 | .IsSuccess()); | 260 | .IsSuccess()); |
| 261 | } | 261 | } |
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index 3be9b71cf..e04ad19db 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp | |||
| @@ -153,7 +153,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect | |||
| 153 | 153 | ||
| 154 | // Load NSO modules | 154 | // Load NSO modules |
| 155 | modules.clear(); | 155 | modules.clear(); |
| 156 | const VAddr base_address{GetInteger(process.PageTable().GetCodeRegionStart())}; | 156 | const VAddr base_address{GetInteger(process.GetPageTable().GetCodeRegionStart())}; |
| 157 | VAddr next_load_addr{base_address}; | 157 | VAddr next_load_addr{base_address}; |
| 158 | const FileSys::PatchManager pm{metadata.GetTitleID(), system.GetFileSystemController(), | 158 | const FileSys::PatchManager pm{metadata.GetTitleID(), system.GetFileSystemController(), |
| 159 | system.GetContentProvider()}; | 159 | system.GetContentProvider()}; |
diff --git a/src/core/loader/kip.cpp b/src/core/loader/kip.cpp index 709e2564f..ffe976b94 100644 --- a/src/core/loader/kip.cpp +++ b/src/core/loader/kip.cpp | |||
| @@ -96,7 +96,7 @@ AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process, | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | codeset.memory = std::move(program_image); | 98 | codeset.memory = std::move(program_image); |
| 99 | const VAddr base_address = GetInteger(process.PageTable().GetCodeRegionStart()); | 99 | const VAddr base_address = GetInteger(process.GetPageTable().GetCodeRegionStart()); |
| 100 | process.LoadModule(std::move(codeset), base_address); | 100 | process.LoadModule(std::move(codeset), base_address); |
| 101 | 101 | ||
| 102 | LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", kip->GetName(), base_address); | 102 | LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", kip->GetName(), base_address); |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 7be6cf5f3..506808b5d 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -203,7 +203,7 @@ static bool LoadNroImpl(Kernel::KProcess& process, const std::vector<u8>& data) | |||
| 203 | 203 | ||
| 204 | // Load codeset for current process | 204 | // Load codeset for current process |
| 205 | codeset.memory = std::move(program_image); | 205 | codeset.memory = std::move(program_image); |
| 206 | process.LoadModule(std::move(codeset), process.PageTable().GetCodeRegionStart()); | 206 | process.LoadModule(std::move(codeset), process.GetPageTable().GetCodeRegionStart()); |
| 207 | 207 | ||
| 208 | return true; | 208 | return true; |
| 209 | } | 209 | } |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 79639f5e4..74cc9579f 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -167,7 +167,7 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::KProcess& process, Core::S | |||
| 167 | modules.clear(); | 167 | modules.clear(); |
| 168 | 168 | ||
| 169 | // Load module | 169 | // Load module |
| 170 | const VAddr base_address = GetInteger(process.PageTable().GetCodeRegionStart()); | 170 | const VAddr base_address = GetInteger(process.GetPageTable().GetCodeRegionStart()); |
| 171 | if (!LoadModule(process, system, *file, base_address, true, true)) { | 171 | if (!LoadModule(process, system, *file, base_address, true, true)) { |
| 172 | return {ResultStatus::ErrorLoadingNSO, {}}; | 172 | return {ResultStatus::ErrorLoadingNSO, {}}; |
| 173 | } | 173 | } |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 805963178..e1fbe8e00 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -31,10 +31,10 @@ struct Memory::Impl { | |||
| 31 | explicit Impl(Core::System& system_) : system{system_} {} | 31 | explicit Impl(Core::System& system_) : system{system_} {} |
| 32 | 32 | ||
| 33 | void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) { | 33 | void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) { |
| 34 | current_page_table = &process.PageTable().PageTableImpl(); | 34 | current_page_table = &process.GetPageTable().PageTableImpl(); |
| 35 | current_page_table->fastmem_arena = system.DeviceMemory().buffer.VirtualBasePointer(); | 35 | current_page_table->fastmem_arena = system.DeviceMemory().buffer.VirtualBasePointer(); |
| 36 | 36 | ||
| 37 | const std::size_t address_space_width = process.PageTable().GetAddressSpaceWidth(); | 37 | const std::size_t address_space_width = process.GetPageTable().GetAddressSpaceWidth(); |
| 38 | 38 | ||
| 39 | system.ArmInterface(core_id).PageTableChanged(*current_page_table, address_space_width); | 39 | system.ArmInterface(core_id).PageTableChanged(*current_page_table, address_space_width); |
| 40 | } | 40 | } |
| @@ -186,7 +186,7 @@ struct Memory::Impl { | |||
| 186 | void WalkBlock(const Kernel::KProcess& process, const Common::ProcessAddress addr, | 186 | void WalkBlock(const Kernel::KProcess& process, const Common::ProcessAddress addr, |
| 187 | const std::size_t size, auto on_unmapped, auto on_memory, auto on_rasterizer, | 187 | const std::size_t size, auto on_unmapped, auto on_memory, auto on_rasterizer, |
| 188 | auto increment) { | 188 | auto increment) { |
| 189 | const auto& page_table = process.PageTable().PageTableImpl(); | 189 | const auto& page_table = process.GetPageTable().PageTableImpl(); |
| 190 | std::size_t remaining_size = size; | 190 | std::size_t remaining_size = size; |
| 191 | std::size_t page_index = addr >> YUZU_PAGEBITS; | 191 | std::size_t page_index = addr >> YUZU_PAGEBITS; |
| 192 | std::size_t page_offset = addr & YUZU_PAGEMASK; | 192 | std::size_t page_offset = addr & YUZU_PAGEMASK; |
| @@ -808,7 +808,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, Common::ProcessAddress b | |||
| 808 | 808 | ||
| 809 | bool Memory::IsValidVirtualAddress(const Common::ProcessAddress vaddr) const { | 809 | bool Memory::IsValidVirtualAddress(const Common::ProcessAddress vaddr) const { |
| 810 | const Kernel::KProcess& process = *system.ApplicationProcess(); | 810 | const Kernel::KProcess& process = *system.ApplicationProcess(); |
| 811 | const auto& page_table = process.PageTable().PageTableImpl(); | 811 | const auto& page_table = process.GetPageTable().PageTableImpl(); |
| 812 | const size_t page = vaddr >> YUZU_PAGEBITS; | 812 | const size_t page = vaddr >> YUZU_PAGEBITS; |
| 813 | if (page >= page_table.pointers.size()) { | 813 | if (page >= page_table.pointers.size()) { |
| 814 | return false; | 814 | return false; |
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 8742dd164..1f87678e2 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -177,8 +177,8 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const { | |||
| 177 | 177 | ||
| 178 | CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_, | 178 | CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_, |
| 179 | const std::array<u8, 0x20>& build_id_) | 179 | const std::array<u8, 0x20>& build_id_) |
| 180 | : vm{std::make_unique<StandardVmCallbacks>(system_, metadata)}, | 180 | : vm{std::make_unique<StandardVmCallbacks>(system_, metadata)}, cheats(std::move(cheats_)), |
| 181 | cheats(std::move(cheats_)), core_timing{system_.CoreTiming()}, system{system_} { | 181 | core_timing{system_.CoreTiming()}, system{system_} { |
| 182 | metadata.main_nso_build_id = build_id_; | 182 | metadata.main_nso_build_id = build_id_; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| @@ -199,7 +199,7 @@ void CheatEngine::Initialize() { | |||
| 199 | metadata.process_id = system.ApplicationProcess()->GetProcessId(); | 199 | metadata.process_id = system.ApplicationProcess()->GetProcessId(); |
| 200 | metadata.title_id = system.GetApplicationProcessProgramID(); | 200 | metadata.title_id = system.GetApplicationProcessProgramID(); |
| 201 | 201 | ||
| 202 | const auto& page_table = system.ApplicationProcess()->PageTable(); | 202 | const auto& page_table = system.ApplicationProcess()->GetPageTable(); |
| 203 | metadata.heap_extents = { | 203 | metadata.heap_extents = { |
| 204 | .base = GetInteger(page_table.GetHeapRegionStart()), | 204 | .base = GetInteger(page_table.GetHeapRegionStart()), |
| 205 | .size = page_table.GetHeapRegionSize(), | 205 | .size = page_table.GetHeapRegionSize(), |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 6c3dc7369..b5b3e7eda 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -117,8 +117,8 @@ json GetProcessorStateDataAuto(Core::System& system) { | |||
| 117 | arm.SaveContext(context); | 117 | arm.SaveContext(context); |
| 118 | 118 | ||
| 119 | return GetProcessorStateData(process->Is64BitProcess() ? "AArch64" : "AArch32", | 119 | return GetProcessorStateData(process->Is64BitProcess() ? "AArch64" : "AArch32", |
| 120 | GetInteger(process->PageTable().GetCodeRegionStart()), context.sp, | 120 | GetInteger(process->GetPageTable().GetCodeRegionStart()), |
| 121 | context.pc, context.pstate, context.cpu_registers); | 121 | context.sp, context.pc, context.pstate, context.cpu_registers); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | json GetBacktraceData(Core::System& system) { | 124 | json GetBacktraceData(Core::System& system) { |