summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
authorGravatar Michael Scire2019-07-07 09:42:54 -0700
committerGravatar Michael Scire2019-07-07 11:45:53 -0700
commit13a8fde3ad2a4a37cf1bb8dcb367b4c8fc8b4d9b (patch)
tree5baf26505ec000e221c1119ba4dd2d0bca93de0e /src/core/hle/kernel/process.h
parentMerge pull request #2674 from lioncash/reporter (diff)
downloadyuzu-13a8fde3ad2a4a37cf1bb8dcb367b4c8fc8b4d9b.tar.gz
yuzu-13a8fde3ad2a4a37cf1bb8dcb367b4c8fc8b4d9b.tar.xz
yuzu-13a8fde3ad2a4a37cf1bb8dcb367b4c8fc8b4d9b.zip
Implement MapPhysicalMemory/UnmapPhysicalMemory
This implements svcMapPhysicalMemory/svcUnmapPhysicalMemory for Yuzu, which can be used to map memory at a desired address by games since 3.0.0. It also properly parses SystemResourceSize from NPDM, and makes information available via svcGetInfo. This is needed for games like Super Smash Bros. and Diablo 3 -- this PR's implementation does not run into the "ASCII reads" issue mentioned in the comments of #2626, which was caused by the following bugs in Yuzu's memory management that this PR also addresses: * Yuzu's memory coalescing does not properly merge blocks. This results in a polluted address space/svcQueryMemory results that would be impossible to replicate on hardware, which can lead to game code making the wrong assumptions about memory layout. * This implements better merging for AllocatedMemoryBlocks. * Yuzu's implementation of svcMirrorMemory unprotected the entire virtual memory range containing the range being mirrored. This could lead to games attempting to map data at that unprotected range/attempting to access that range after yuzu improperly unmapped it. * This PR fixes it by simply calling ReprotectRange instead of Reprotect.
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 83ea02bee..b0e795577 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -168,8 +168,9 @@ public:
168 return capabilities.GetPriorityMask(); 168 return capabilities.GetPriorityMask();
169 } 169 }
170 170
171 u32 IsVirtualMemoryEnabled() const { 171 /// Gets the amount of secure memory to allocate for memory management.
172 return is_virtual_address_memory_enabled; 172 u32 GetSystemResourceSize() const {
173 return system_resource_size;
173 } 174 }
174 175
175 /// Whether this process is an AArch64 or AArch32 process. 176 /// Whether this process is an AArch64 or AArch32 process.
@@ -298,12 +299,16 @@ private:
298 /// Title ID corresponding to the process 299 /// Title ID corresponding to the process
299 u64 program_id = 0; 300 u64 program_id = 0;
300 301
302 /// Specifies additional memory to be reserved for the process's memory management by the
303 /// system. When this is non-zero, secure memory is allocated and used for page table allocation
304 /// instead of using the normal global page tables/memory block management.
305 u32 system_resource_size = 0;
306
301 /// Resource limit descriptor for this process 307 /// Resource limit descriptor for this process
302 SharedPtr<ResourceLimit> resource_limit; 308 SharedPtr<ResourceLimit> resource_limit;
303 309
304 /// The ideal CPU core for this process, threads are scheduled on this core by default. 310 /// The ideal CPU core for this process, threads are scheduled on this core by default.
305 u8 ideal_core = 0; 311 u8 ideal_core = 0;
306 u32 is_virtual_address_memory_enabled = 0;
307 312
308 /// The Thread Local Storage area is allocated as processes create threads, 313 /// The Thread Local Storage area is allocated as processes create threads,
309 /// each TLS area is 0x200 bytes, so one page (0x1000) is split up in 8 parts, and each part 314 /// each TLS area is 0x200 bytes, so one page (0x1000) is split up in 8 parts, and each part