ams-1.0.0: meso no longer optional, remove conditional logic

This commit is contained in:
Michael Scire 2021-09-05 10:08:30 -07:00
parent 452ad57ae0
commit fe21509991
5 changed files with 11 additions and 26 deletions

View File

@ -74,9 +74,6 @@ namespace ams {
ams_ctx.pc = ctx->pc.x; ams_ctx.pc = ctx->pc.x;
ams_ctx.pstate = ctx->pstate; ams_ctx.pstate = ctx->pstate;
ams_ctx.afsr0 = static_cast<u32>(::ams::exosphere::GetVersion(ATMOSPHERE_RELEASE_VERSION)); ams_ctx.afsr0 = static_cast<u32>(::ams::exosphere::GetVersion(ATMOSPHERE_RELEASE_VERSION));
if (svc::IsKernelMesosphere()) {
ams_ctx.afsr0 |= (static_cast<u32>('M') << (BITSIZEOF(u32) - BITSIZEOF(u8)));
}
ams_ctx.afsr1 = static_cast<u32>(hos::GetVersion()); ams_ctx.afsr1 = static_cast<u32>(hos::GetVersion());
ams_ctx.far = ctx->far.x; ams_ctx.far = ctx->far.x;
ams_ctx.report_identifier = armGetSystemTick(); ams_ctx.report_identifier = armGetSystemTick();

View File

@ -462,7 +462,7 @@ namespace ams::boot2 {
DetectAndDeclareFutureMitms(); DetectAndDeclareFutureMitms();
/* Device whether to launch tma or htc. */ /* Device whether to launch tma or htc. */
if (svc::IsKernelMesosphere() && IsHtcEnabled()) { if (IsHtcEnabled()) {
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Htc, ncm::StorageId::None), 0); LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Htc, ncm::StorageId::None), 0);
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Cs, ncm::StorageId::None), 0); LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Cs, ncm::StorageId::None), 0);
} else { } else {

View File

@ -219,11 +219,9 @@ namespace ams::erpt::srv {
} }
void SubmitResourceLimitContexts() { void SubmitResourceLimitContexts() {
if (hos::GetVersion() >= hos::Version_11_0_0 || svc::IsKernelMesosphere()) {
SubmitResourceLimitLimitContext(); SubmitResourceLimitLimitContext();
SubmitResourceLimitPeakContext(); SubmitResourceLimitPeakContext();
} }
}
Result ValidateCreateReportContext(const ContextEntry *ctx) { Result ValidateCreateReportContext(const ContextEntry *ctx) {
R_UNLESS(ctx->category == CategoryId_ErrorInfo, erpt::ResultRequiredContextMissing()); R_UNLESS(ctx->category == CategoryId_ErrorInfo, erpt::ResultRequiredContextMissing());

View File

@ -40,6 +40,9 @@ namespace ams::hos {
/* Initialize hos::Version API. */ /* Initialize hos::Version API. */
hos::SetVersionForLibnxInternal(); hos::SetVersionForLibnxInternal();
/* Check that we're running under mesosphere. */
AMS_ABORT_UNLESS(svc::IsKernelMesosphere());
} }
void InitializeForStratosphereDebug(hos::Version debug_version) { void InitializeForStratosphereDebug(hos::Version debug_version) {
@ -48,6 +51,9 @@ namespace ams::hos {
/* Initialize hos::Version API. */ /* Initialize hos::Version API. */
hos::SetVersionForLibnxInternalDebug(debug_version); hos::SetVersionForLibnxInternalDebug(debug_version);
/* Check that we're running under mesosphere. */
AMS_ABORT_UNLESS(svc::IsKernelMesosphere());
} }
} }

View File

@ -56,27 +56,11 @@ namespace ams::os::impl {
} }
static u64 GetAslrSpaceBeginAddress() { static u64 GetAslrSpaceBeginAddress() {
if (hos::GetVersion() >= hos::Version_2_0_0 || svc::IsKernelMesosphere()) {
return GetAslrInfo(svc::InfoType_AslrRegionAddress); return GetAslrInfo(svc::InfoType_AslrRegionAddress);
} else {
if (GetHeapSpaceBeginAddress() < AslrBase64BitDeprecated || GetAliasSpaceBeginAddress() < AslrBase64BitDeprecated) {
return AslrBase32Bit;
} else {
return AslrBase64BitDeprecated;
}
}
} }
static u64 GetAslrSpaceEndAddress() { static u64 GetAslrSpaceEndAddress() {
if (hos::GetVersion() >= hos::Version_2_0_0 || svc::IsKernelMesosphere()) {
return GetAslrInfo(svc::InfoType_AslrRegionAddress) + GetAslrInfo(svc::InfoType_AslrRegionSize); return GetAslrInfo(svc::InfoType_AslrRegionAddress) + GetAslrInfo(svc::InfoType_AslrRegionSize);
} else {
if (GetHeapSpaceBeginAddress() < AslrBase64BitDeprecated || GetAliasSpaceBeginAddress() < AslrBase64BitDeprecated) {
return AslrBase32Bit + AslrSize32Bit;
} else {
return AslrBase64BitDeprecated + AslrSize64BitDeprecated;
}
}
} }
}; };