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/hle/kernel | |
| 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/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/k_code_memory.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_process.h | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_shared_memory.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread_local_page.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_cache.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_code_memory.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_device_address_space.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_info.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_memory.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_physical_memory.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_process_memory.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_query_memory.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_shared_memory.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_thread.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_transfer_memory.cpp | 2 |
17 files changed, 57 insertions, 66 deletions
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)); |