stratosphere: stop using kernelAbove

This commit is contained in:
Michael Scire
2019-05-10 03:25:07 -07:00
parent b5dd621250
commit 41f5b39f6b
11 changed files with 34 additions and 34 deletions

View File

@@ -20,7 +20,7 @@
#include "ldr_map.hpp"
Result MapUtils::LocateSpaceForMap(u64 *out, u64 out_size) {
if (kernelAbove200()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_200)) {
return LocateSpaceForMapModern(out, out_size);
} else {
return LocateSpaceForMapDeprecated(out, out_size);

View File

@@ -208,7 +208,7 @@ Result NpdmUtils::LoadNpdm(u64 tid, NpdmInfo *out) {
if (ContentManagement::ShouldOverrideContentsWithHBL(tid) && R_SUCCEEDED(LoadNpdmInternal(OpenNpdmFromExeFS(), &g_original_npdm_cache))) {
NpdmInfo *original_info = &g_original_npdm_cache.info;
/* Fix pool partition. */
if (kernelAbove500()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_500)) {
info->acid->flags = (info->acid->flags & 0xFFFFFFC3) | (original_info->acid->flags & 0x0000003C);
}
/* Fix application type. */
@@ -506,7 +506,7 @@ u32 NpdmUtils::GetApplicationType(u32 *caps, size_t num_caps) {
}
}
/* After 1.0.0, allow_debug is used as bit 4. */
if (kernelAbove200() && (caps[i] & 0x1FFFF) == 0xFFFF) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_200) && (caps[i] & 0x1FFFF) == 0xFFFF) {
application_type |= (caps[i] >> 15) & 4;
}
}

View File

@@ -191,7 +191,7 @@ Result NsoUtils::CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLo
/* Calculate ASLR extents for address space type. */
u64 addspace_start, addspace_size;
if (kernelAbove200()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_200)) {
switch (addspace_type & 0xE) {
case 0:
case 4:

View File

@@ -64,7 +64,7 @@ Result ProcessCreation::InitializeProcessInfo(NpdmUtils::NpdmInfo *npdm, Handle
}
/* 3.0.0+ System Resource Size. */
if (kernelAbove300()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_300)) {
if (npdm->header->system_resource_size & 0x1FFFFF) {
return ResultLoaderInvalidSize;
}
@@ -72,7 +72,7 @@ Result ProcessCreation::InitializeProcessInfo(NpdmUtils::NpdmInfo *npdm, Handle
if ((out_proc_info->process_flags & 6) == 0) {
return ResultLoaderInvalidMeta;
}
if (!(((application_type & 3) == 1) || (kernelAbove600() && (application_type & 3) == 2))) {
if (!(((application_type & 3) == 1) || ((GetRuntimeFirmwareVersion() >= FirmwareVersion_600) && (application_type & 3) == 2))) {
return ResultLoaderInvalidMeta;
}
if (npdm->header->system_resource_size > 0x1FE00000) {
@@ -85,7 +85,7 @@ Result ProcessCreation::InitializeProcessInfo(NpdmUtils::NpdmInfo *npdm, Handle
}
/* 5.0.0+ Pool Partition. */
if (kernelAbove500()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_500)) {
u32 pool_partition_id = (npdm->acid->flags >> 2) & 0xF;
switch (pool_partition_id) {
case 0: /* Application. */
@@ -206,7 +206,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
/* Update the list of registered processes with the new process. */
svcGetProcessId(&process_id, process_h);
bool is_64_bit_addspace;
if (kernelAbove200()) {
if ((GetRuntimeFirmwareVersion() >= FirmwareVersion_200)) {
is_64_bit_addspace = (((npdm_info.header->mmu_flags >> 1) & 5) | 2) == 3;
} else {
is_64_bit_addspace = (npdm_info.header->mmu_flags & 0xE) == 0x2;