loader: support 11.x DisableDeviceAddressSpaceMerge

This commit is contained in:
Michael Scire 2020-12-01 17:47:48 -08:00 committed by SciresM
parent 3d4ab95ab2
commit 1b164613a6
3 changed files with 21 additions and 4 deletions

View file

@ -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. */