mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-17 17:36:44 +00:00
loader: support 11.x DisableDeviceAddressSpaceMerge
This commit is contained in:
parent
3d4ab95ab2
commit
1b164613a6
3 changed files with 21 additions and 4 deletions
|
@ -211,6 +211,7 @@ namespace ams::ldr {
|
|||
MetaFlag_AddressSpaceTypeMask = (7 << MetaFlag_AddressSpaceTypeShift),
|
||||
|
||||
MetaFlag_OptimizeMemoryAllocation = (1 << 4),
|
||||
MetaFlag_DisableDeviceAddressSpaceMerge = (1 << 5),
|
||||
};
|
||||
|
||||
enum AddressSpaceType {
|
||||
|
|
|
@ -55,11 +55,20 @@ namespace ams::ldr {
|
|||
R_UNLESS(npdm->magic == Npdm::Magic, ResultInvalidMeta());
|
||||
|
||||
/* Validate flags. */
|
||||
u32 mask = ~0x1F;
|
||||
if (hos::GetVersion() < hos::Version_7_0_0) {
|
||||
/* 7.0.0 added 0x10 as a valid bit to NPDM flags, so before that we only check 0xF. */
|
||||
u32 mask;
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0) {
|
||||
/* 11.0.0 added bit 5 = "DisableDeviceAddressSpaceMerge". */
|
||||
mask = ~0x3F;
|
||||
} else if (hos::GetVersion() >= hos::Version_7_0_0) {
|
||||
/* 7.0.0 added bit 4 = "UseOptimizedMemory" */
|
||||
mask = ~0x1F;
|
||||
} else {
|
||||
mask = ~0xF;
|
||||
}
|
||||
|
||||
/* We set the "DisableDeviceAddressSpaceMerge" bit on all versions, so be permissive with it. */
|
||||
mask &= ~0x20;
|
||||
|
||||
R_UNLESS(!(npdm->flags & mask), ResultInvalidMeta());
|
||||
|
||||
/* Validate Acid extents. */
|
||||
|
|
|
@ -326,6 +326,13 @@ namespace ams::ldr {
|
|||
}
|
||||
}
|
||||
|
||||
/* 11.0.0+ Set Disable DAS merge. */
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0 || svc::IsKernelMesosphere()) {
|
||||
if (meta_flags & Npdm::MetaFlag_DisableDeviceAddressSpaceMerge) {
|
||||
flags |= svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge;
|
||||
}
|
||||
}
|
||||
|
||||
*out = flags;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue