From 5f836aca6da839e57e5d887a0c0b7eb7c137e43f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 31 Jan 2019 04:46:20 -0800 Subject: [PATCH] Loader: set 7.0.0+ process bit when relevant --- stratosphere/loader/source/ldr_process_creation.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 6253b9bfc..76f9c85e2 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "ldr_process_creation.hpp" #include "ldr_registration.hpp" @@ -47,12 +48,19 @@ Result ProcessCreation::InitializeProcessInfo(NpdmUtils::NpdmInfo *npdm, Handle return 0x809; } out_proc_info->process_flags = (npdm->header->mmu_flags & 0xF); + /* Set Bit 4 (?) and EnableAslr based on argument flags. */ out_proc_info->process_flags |= ((arg_flags & 3) << 4) ^ 0x20; /* Set UseSystemMemBlocks if application type is 1. */ u32 application_type = NpdmUtils::GetApplicationType((u32 *)npdm->aci0_kac, npdm->aci0->kac_size / sizeof(u32)); if ((application_type & 3) == 1) { out_proc_info->process_flags |= 0x40; + /* 7.0.0+: Set unknown bit related to system resource heap if relevant. */ + if (GetRuntimeFirmwareVersion() >= FirmwareVersion_700) { + if ((npdm->header->mmu_flags & 0x10)) { + out_proc_info->process_flags |= 0x800; + } + } } /* 3.0.0+ System Resource Size. */