mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 23:59:49 -04:00
ldr/hbl: support address space width overrides
This commit is contained in:
parent
835aa6b9db
commit
dd56f8449f
5 changed files with 99 additions and 5 deletions
|
@ -215,6 +215,21 @@ namespace ams::ldr {
|
|||
}
|
||||
}
|
||||
|
||||
/* Perform address space override. */
|
||||
if (status.HasOverrideAddressSpace()) {
|
||||
/* Clear the existing address space. */
|
||||
meta->npdm->flags &= ~Npdm::MetaFlag_AddressSpaceTypeMask;
|
||||
|
||||
/* Set the new address space flag. */
|
||||
switch (status.GetOverrideAddressSpaceFlags()) {
|
||||
case cfg::impl::OverrideStatusFlag_AddressSpace32Bit: meta->npdm->flags |= (Npdm::AddressSpaceType_32Bit) << Npdm::MetaFlag_AddressSpaceTypeShift; break;
|
||||
case cfg::impl::OverrideStatusFlag_AddressSpace64BitDeprecated: meta->npdm->flags |= (Npdm::AddressSpaceType_64BitDeprecated) << Npdm::MetaFlag_AddressSpaceTypeShift; break;
|
||||
case cfg::impl::OverrideStatusFlag_AddressSpace32BitWithoutAlias: meta->npdm->flags |= (Npdm::AddressSpaceType_32BitWithoutAlias) << Npdm::MetaFlag_AddressSpaceTypeShift; break;
|
||||
case cfg::impl::OverrideStatusFlag_AddressSpace64Bit: meta->npdm->flags |= (Npdm::AddressSpaceType_64Bit) << Npdm::MetaFlag_AddressSpaceTypeShift; break;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
/* When hbl is applet, adjust main thread priority. */
|
||||
if ((caps::GetProgramInfoFlags(meta->aci_kac, meta->aci->kac_size) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Applet) {
|
||||
constexpr auto HblMainThreadPriorityApplication = 44;
|
||||
|
|
|
@ -262,7 +262,11 @@ namespace ams::ldr {
|
|||
flags |= svc::CreateProcessFlag_AddressSpace32BitWithoutAlias;
|
||||
break;
|
||||
case Npdm::AddressSpaceType_64Bit:
|
||||
flags |= svc::CreateProcessFlag_AddressSpace64Bit;
|
||||
if (hos::GetVersion() >= hos::Version_2_0_0 || svc::IsKernelMesosphere()) {
|
||||
flags |= svc::CreateProcessFlag_AddressSpace64Bit;
|
||||
} else {
|
||||
flags |= svc::CreateProcessFlag_AddressSpace64BitDeprecated;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ResultInvalidMeta();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue