diff options
| author | 2017-09-26 18:17:47 -0500 | |
|---|---|---|
| committer | 2017-09-26 18:17:47 -0500 | |
| commit | 7f48aa8d2580da6b3b83a389e31804e493aba69f (patch) | |
| tree | 287b04f23f2d195f123fd15dca68d6a1cebf945c /src/core/loader/3dsx.cpp | |
| parent | Kernel/Thread: Allow specifying which process a thread belongs to when creati... (diff) | |
| download | yuzu-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.cpp | 15 |
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 | ||
| 94 | using Kernel::SharedPtr; | ||
| 95 | using Kernel::CodeSet; | 94 | using Kernel::CodeSet; |
| 95 | using Kernel::SharedPtr; | ||
| 96 | 96 | ||
| 97 | static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr, | 97 | static 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 | ||
| 258 | ResultStatus AppLoader_THREEDSX::Load() { | 258 | ResultStatus 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 | ||