hos::Version: rename enum members

This commit is contained in:
Michael Scire
2020-04-13 22:19:44 -07:00
parent 79b9e07ee9
commit 6719abec65
78 changed files with 304 additions and 302 deletions

View File

@@ -54,7 +54,7 @@ namespace ams::pm::impl {
LaunchFlagsDeprecated_SignalOnStart = (1 << 5),
};
#define GET_FLAG_MASK(flag) (hos_version >= hos::Version_500 ? static_cast<u32>(LaunchFlags_##flag) : static_cast<u32>(LaunchFlagsDeprecated_##flag))
#define GET_FLAG_MASK(flag) (hos_version >= hos::Version_5_0_0 ? static_cast<u32>(LaunchFlags_##flag) : static_cast<u32>(LaunchFlagsDeprecated_##flag))
inline bool ShouldSignalOnExit(u32 launch_flags) {
const auto hos_version = hos::GetVersion();
@@ -63,7 +63,7 @@ namespace ams::pm::impl {
inline bool ShouldSignalOnStart(u32 launch_flags) {
const auto hos_version = hos::GetVersion();
if (hos_version < hos::Version_200) {
if (hos_version < hos::Version_2_0_0) {
return false;
}
return launch_flags & GET_FLAG_MASK(SignalOnStart);
@@ -110,7 +110,7 @@ namespace ams::pm::impl {
};
inline u32 GetProcessEventValue(ProcessEvent event) {
if (hos::GetVersion() >= hos::Version_500) {
if (hos::GetVersion() >= hos::Version_5_0_0) {
return static_cast<u32>(event);
}
switch (event) {
@@ -241,7 +241,7 @@ namespace ams::pm::impl {
inline u32 GetLoaderCreateProcessFlags(u32 launch_flags) {
u32 ldr_flags = 0;
if (ShouldSignalOnException(launch_flags) || (hos::GetVersion() >= hos::Version_200 && !ShouldStartSuspended(launch_flags))) {
if (ShouldSignalOnException(launch_flags) || (hos::GetVersion() >= hos::Version_2_0_0 && !ShouldStartSuspended(launch_flags))) {
ldr_flags |= ldr::CreateProcessFlag_EnableDebug;
}
if (ShouldDisableAslr(launch_flags)) {
@@ -283,7 +283,7 @@ namespace ams::pm::impl {
cfg::OverrideStatus override_status;
R_TRY(ldr::pm::AtmosphereGetProgramInfo(&program_info, &override_status, args.location));
const bool is_application = (program_info.flags & ldr::ProgramInfoFlag_ApplicationTypeMask) == ldr::ProgramInfoFlag_Application;
const bool allow_debug = (program_info.flags & ldr::ProgramInfoFlag_AllowDebug) || hos::GetVersion() < hos::Version_200;
const bool allow_debug = (program_info.flags & ldr::ProgramInfoFlag_AllowDebug) || hos::GetVersion() < hos::Version_2_0_0;
/* Ensure we only try to run one application. */
R_UNLESS(!is_application || !HasApplicationProcess(), pm::ResultApplicationRunning());
@@ -397,7 +397,7 @@ namespace ams::pm::impl {
process_info->ClearSuspended();
process_info->SetSuspendedStateChanged();
os::SignalSystemEvent(std::addressof(g_process_event));
} else if (hos::GetVersion() >= hos::Version_200 && process_info->ShouldSignalOnStart()) {
} else if (hos::GetVersion() >= hos::Version_2_0_0 && process_info->ShouldSignalOnStart()) {
process_info->SetStartedStateChanged();
process_info->ClearSignalOnStart();
os::SignalSystemEvent(std::addressof(g_process_event));
@@ -418,11 +418,11 @@ namespace ams::pm::impl {
/* Free process resources, unlink from waitable manager. */
process_info->Cleanup();
if (hos::GetVersion() < hos::Version_500 && process_info->ShouldSignalOnExit()) {
if (hos::GetVersion() < hos::Version_5_0_0 && process_info->ShouldSignalOnExit()) {
os::SignalSystemEvent(std::addressof(g_process_event));
} else {
/* Handle the case where we need to keep the process alive some time longer. */
if (hos::GetVersion() >= hos::Version_500 && process_info->ShouldSignalOnExit()) {
if (hos::GetVersion() >= hos::Version_5_0_0 && process_info->ShouldSignalOnExit()) {
/* Remove from the living list. */
list->Remove(process_info);
@@ -553,7 +553,7 @@ namespace ams::pm::impl {
out->process_id = process.GetProcessId();
return ResultSuccess();
}
if (hos::GetVersion() < hos::Version_500 && process.ShouldSignalOnExit() && process.HasTerminated()) {
if (hos::GetVersion() < hos::Version_5_0_0 && process.ShouldSignalOnExit() && process.HasTerminated()) {
out->event = GetProcessEventValue(ProcessEvent::Exited);
out->process_id = process.GetProcessId();
return ResultSuccess();
@@ -562,7 +562,7 @@ namespace ams::pm::impl {
}
/* Check for event from exited process. */
if (hos::GetVersion() >= hos::Version_500) {
if (hos::GetVersion() >= hos::Version_5_0_0) {
ProcessListAccessor dead_list(g_dead_process_list);
if (!dead_list->empty()) {

View File

@@ -184,7 +184,7 @@ namespace ams::pm::resource {
/* Adjust resource limits based on hos firmware version. */
const auto hos_version = hos::GetVersion();
if (hos_version >= hos::Version_400) {
if (hos_version >= hos::Version_4_0_0) {
/* 4.0.0 increased the system thread limit. */
g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_ThreadCountMax] += ExtraSystemThreadCount400;
/* 4.0.0 also took memory away from applet and gave it to system, for the Standard and StandardForSystemDev profiles. */
@@ -193,19 +193,19 @@ namespace ams::pm::resource {
g_memory_resource_limits[spl::MemoryArrangement_StandardForSystemDev][ResourceLimitGroup_System] += ExtraSystemMemorySize400;
g_memory_resource_limits[spl::MemoryArrangement_StandardForSystemDev][ResourceLimitGroup_Applet] -= ExtraSystemMemorySize400;
}
if (hos_version >= hos::Version_500) {
if (hos_version >= hos::Version_5_0_0) {
/* 5.0.0 took more memory away from applet and gave it to system, for the Standard and StandardForSystemDev profiles. */
g_memory_resource_limits[spl::MemoryArrangement_Standard][ResourceLimitGroup_System] += ExtraSystemMemorySize500;
g_memory_resource_limits[spl::MemoryArrangement_Standard][ResourceLimitGroup_Applet] -= ExtraSystemMemorySize500;
g_memory_resource_limits[spl::MemoryArrangement_StandardForSystemDev][ResourceLimitGroup_System] += ExtraSystemMemorySize500;
g_memory_resource_limits[spl::MemoryArrangement_StandardForSystemDev][ResourceLimitGroup_Applet] -= ExtraSystemMemorySize500;
}
if (hos_version >= hos::Version_600) {
if (hos_version >= hos::Version_6_0_0) {
/* 6.0.0 increased the system event and session limits. */
g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_EventCountMax] += ExtraSystemEventCount600;
g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_SessionCountMax] += ExtraSystemSessionCount600;
}
if (hos_version >= hos::Version_900) {
if (hos_version >= hos::Version_9_0_0) {
/* 9.2.0 increased the system session limit. */
/* NOTE: We don't currently support detection of minor version, so we will provide this increase on 9.0.0+. */
/* This shouldn't impact any existing behavior in undesirable ways. */
@@ -213,7 +213,7 @@ namespace ams::pm::resource {
}
/* 7.0.0+: Calculate the number of extra application threads available. */
if (hos::GetVersion() >= hos::Version_700) {
if (hos::GetVersion() >= hos::Version_7_0_0) {
/* See how many threads we have available. */
s64 total_threads_available = 0;
R_ABORT_UNLESS(svc::GetResourceLimitLimitValue(&total_threads_available, GetResourceLimitHandle(ResourceLimitGroup_System), svc::LimitableResource_ThreadCountMax));
@@ -231,7 +231,7 @@ namespace ams::pm::resource {
}
/* Choose and initialize memory arrangement. */
if (hos_version >= hos::Version_600) {
if (hos_version >= hos::Version_6_0_0) {
/* 6.0.0 retrieves memory limit information from the kernel, rather than using a hardcoded profile. */
g_memory_arrangement = spl::MemoryArrangement_Dynamic;
@@ -259,9 +259,9 @@ namespace ams::pm::resource {
/* We take memory away from applet normally, but away from application on < 3.0.0 to avoid a rare hang on boot. */
/* NOTE: On Version 5.0.0+, we cannot set the pools so simply. We must instead modify the kernel, which we do */
/* via patches in fusee-secondary. */
if (hos_version < hos::Version_600) {
const size_t extra_memory_size = hos_version == hos::Version_500 ? ExtraSystemMemorySizeAtmosphere500 : ExtraSystemMemorySizeAtmosphere;
const auto src_group = hos_version >= hos::Version_300 ? ResourceLimitGroup_Applet : ResourceLimitGroup_Application;
if (hos_version < hos::Version_6_0_0) {
const size_t extra_memory_size = hos_version == hos::Version_5_0_0 ? ExtraSystemMemorySizeAtmosphere500 : ExtraSystemMemorySizeAtmosphere;
const auto src_group = hos_version >= hos::Version_3_0_0 ? ResourceLimitGroup_Applet : ResourceLimitGroup_Application;
for (size_t i = 0; i < spl::MemoryArrangement_Count; i++) {
g_memory_resource_limits[i][ResourceLimitGroup_System] += extra_memory_size;
g_memory_resource_limits[i][src_group] -= extra_memory_size;
@@ -288,7 +288,7 @@ namespace ams::pm::resource {
{
std::scoped_lock lk(g_resource_limit_lock);
if (hos::GetVersion() >= hos::Version_500) {
if (hos::GetVersion() >= hos::Version_5_0_0) {
/* Starting in 5.0.0, PM does not allow for only one of the sets to fail. */
if (boost_size < g_system_memory_boost_size) {
R_TRY(svc::SetUnsafeLimit(boost_size));
@@ -338,7 +338,7 @@ namespace ams::pm::resource {
void WaitResourceAvailable(const ldr::ProgramInfo *info) {
if (GetResourceLimitGroup(info) == ResourceLimitGroup_Application) {
WaitResourceAvailable(ResourceLimitGroup_Application);
if (hos::GetVersion() >= hos::Version_500) {
if (hos::GetVersion() >= hos::Version_5_0_0) {
WaitApplicationMemoryAvailable();
}
}