summaryrefslogtreecommitdiff
path: root/src/core/loader/3dsx.cpp
diff options
context:
space:
mode:
authorGravatar Subv2017-09-26 18:17:47 -0500
committerGravatar Subv2017-09-26 18:17:47 -0500
commit7f48aa8d2580da6b3b83a389e31804e493aba69f (patch)
tree287b04f23f2d195f123fd15dca68d6a1cebf945c /src/core/loader/3dsx.cpp
parentKernel/Thread: Allow specifying which process a thread belongs to when creati... (diff)
downloadyuzu-7f48aa8d2580da6b3b83a389e31804e493aba69f.tar.gz
yuzu-7f48aa8d2580da6b3b83a389e31804e493aba69f.tar.xz
yuzu-7f48aa8d2580da6b3b83a389e31804e493aba69f.zip
Loaders: Don't automatically set the current process every time we load an application.
The loaders will now just create a Kernel::Process, construct it and return it to the caller, which is responsible for setting it as the current process and configuring the global page table.
Diffstat (limited to 'src/core/loader/3dsx.cpp')
-rw-r--r--src/core/loader/3dsx.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp
index 5ad5c5287..918038f1e 100644
--- a/src/core/loader/3dsx.cpp
+++ b/src/core/loader/3dsx.cpp
@@ -91,8 +91,8 @@ static u32 TranslateAddr(u32 addr, const THREEloadinfo* loadinfo, u32* offsets)
91 return loadinfo->seg_addrs[2] + addr - offsets[1]; 91 return loadinfo->seg_addrs[2] + addr - offsets[1];
92} 92}
93 93
94using Kernel::SharedPtr;
95using Kernel::CodeSet; 94using Kernel::CodeSet;
95using Kernel::SharedPtr;
96 96
97static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr, 97static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
98 SharedPtr<CodeSet>* out_codeset) { 98 SharedPtr<CodeSet>* out_codeset) {
@@ -255,7 +255,7 @@ FileType AppLoader_THREEDSX::IdentifyType(FileUtil::IOFile& file) {
255 return FileType::Error; 255 return FileType::Error;
256} 256}
257 257
258ResultStatus AppLoader_THREEDSX::Load() { 258ResultStatus AppLoader_THREEDSX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
259 if (is_loaded) 259 if (is_loaded)
260 return ResultStatus::ErrorAlreadyLoaded; 260 return ResultStatus::ErrorAlreadyLoaded;
261 261
@@ -267,16 +267,15 @@ ResultStatus AppLoader_THREEDSX::Load() {
267 return ResultStatus::Error; 267 return ResultStatus::Error;
268 codeset->name = filename; 268 codeset->name = filename;
269 269
270 Kernel::g_current_process = Kernel::Process::Create(std::move(codeset)); 270 process = Kernel::Process::Create(std::move(codeset));
271 Kernel::g_current_process->svc_access_mask.set(); 271 process->svc_access_mask.set();
272 Kernel::g_current_process->address_mappings = default_address_mappings; 272 process->address_mappings = default_address_mappings;
273 Memory::SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table);
274 273
275 // Attach the default resource limit (APPLICATION) to the process 274 // Attach the default resource limit (APPLICATION) to the process
276 Kernel::g_current_process->resource_limit = 275 process->resource_limit =
277 Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); 276 Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
278 277
279 Kernel::g_current_process->Run(48, Kernel::DEFAULT_STACK_SIZE); 278 process->Run(48, Kernel::DEFAULT_STACK_SIZE);
280 279
281 Service::FS::RegisterSelfNCCH(*this); 280 Service::FS::RegisterSelfNCCH(*this);
282 281