summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-04-09 15:36:29 -0400
committerGravatar Lioncash2019-04-11 22:11:41 -0400
commit32a6ceb4e576a88cf7193bf6d0bfb6d4fa1570f6 (patch)
tree56ecfd188540c0e061b4fc7cdf804ebd8481cc3b /src/core/hle/kernel/process.cpp
parentcore/core: Move main process creation into Load() (diff)
downloadyuzu-32a6ceb4e576a88cf7193bf6d0bfb6d4fa1570f6.tar.gz
yuzu-32a6ceb4e576a88cf7193bf6d0bfb6d4fa1570f6.tar.xz
yuzu-32a6ceb4e576a88cf7193bf6d0bfb6d4fa1570f6.zip
core/process: Remove unideal page table setting from LoadFromMetadata()
Initially required due to the split codepath with how the initial main process instance was initialized. We used to initialize the process like: Init() { main_process = Process::Create(...); kernel.MakeCurrentProcess(main_process.get()); } Load() { const auto load_result = loader.Load(*kernel.GetCurrentProcess()); if (load_result != Loader::ResultStatus::Success) { // Handle error here. } ... } which presented a problem. Setting a created process as the main process would set the page table for that process as the main page table. This is fine... until we get to the part that the page table can have its size changed in the Load() function via NPDM metadata, which can dictate either a 32-bit, 36-bit, or 39-bit usable address space. Now that we have full control over the process' creation in load, we can simply set the initial process as the main process after all the loading is done, reflecting the potential page table changes without any special-casing behavior. We can also remove the cache flushing within LoadModule(), as execution wouldn't have even begun yet during all usages of this function, now that we have the initialization order cleaned up.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 94d196e5c..bf0d479af 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -106,8 +106,6 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
106 is_64bit_process = metadata.Is64BitProgram(); 106 is_64bit_process = metadata.Is64BitProgram();
107 107
108 vm_manager.Reset(metadata.GetAddressSpaceType()); 108 vm_manager.Reset(metadata.GetAddressSpaceType());
109 // Ensure that the potentially resized page table is seen by CPU backends.
110 Memory::SetCurrentPageTable(*this);
111 109
112 const auto& caps = metadata.GetKernelCapabilities(); 110 const auto& caps = metadata.GetKernelCapabilities();
113 const auto capability_init_result = 111 const auto capability_init_result =
@@ -242,9 +240,6 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) {
242 MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeData); 240 MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeData);
243 241
244 code_memory_size += module_.memory.size(); 242 code_memory_size += module_.memory.size();
245
246 // Clear instruction cache in CPU JIT
247 system.InvalidateCpuInstructionCaches();
248} 243}
249 244
250Process::Process(Core::System& system) 245Process::Process(Core::System& system)