1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-09 21:51:45 +00:00

kern: expose mesosphere meta over GetInfo instead of GetSystemInfo

This commit is contained in:
Michael Scire 2020-08-21 12:18:07 -07:00 committed by SciresM
parent 25ba61adae
commit 496f93ccdb
3 changed files with 32 additions and 17 deletions

View file

@ -235,6 +235,30 @@ namespace ams::kern::svc {
*out = tick_count;
}
break;
case ams::svc::InfoType_MesosphereMeta:
{
/* Verify the handle is invalid. */
R_UNLESS(handle == ams::svc::InvalidHandle, svc::ResultInvalidHandle());
switch (static_cast<ams::svc::MesosphereMetaInfo>(info_subtype)) {
case ams::svc::MesosphereMetaInfo_KernelVersion:
{
/* Return the supported kernel version. */
*out = ams::svc::SupportedKernelVersion;
}
break;
case ams::svc::MesosphereMetaInfo_IsKTraceEnabled:
{
/* Return whether the kernel supports tracing. */
constexpr u64 KTraceValue = ams::kern::IsKTraceEnabled ? 1 : 0;
*out = KTraceValue;
}
break;
default:
return svc::ResultInvalidCombination();
}
}
break;
default:
{
/* For debug, log the invalid info call. */
@ -294,19 +318,6 @@ namespace ams::kern::svc {
R_TRY(GetInitialProcessIdRange(out, static_cast<ams::svc::InitialProcessIdRangeInfo>(info_subtype)));
}
break;
case ams::svc::SystemInfoType_IsMesosphere:
{
/* Verify the handle is invalid. */
R_UNLESS(handle == ams::svc::InvalidHandle, svc::ResultInvalidHandle());
/* Verify that the sub-type is zero. */
R_UNLESS(info_subtype == 0, svc::ResultInvalidCombination());
/* We don't actually have any data to return. */
/* Clear the output. */
*out = 0;
}
break;
default:
return svc::ResultInvalidEnumValue();
}

View file

@ -500,7 +500,7 @@
ALWAYS_INLINE bool IsKernelMesosphere() {
uint64_t dummy;
return R_SUCCEEDED(::ams::svc::GetSystemInfo(std::addressof(dummy), ::ams::svc::SystemInfoType_IsMesosphere, ::ams::svc::InvalidHandle, 0));
return R_SUCCEEDED(::ams::svc::GetInfo(std::addressof(dummy), ::ams::svc::InfoType_MesosphereMeta, ::ams::svc::InvalidHandle, ::ams::svc::MesosphereMetaInfo_KernelVersion));
}
}

View file

@ -157,6 +157,8 @@ namespace ams::svc {
InfoType_UsedNonSystemMemorySize = 22,
InfoType_IsApplication = 23,
InfoType_MesosphereMeta = 65000,
InfoType_ThreadTickCount = 0xF0000002,
};
@ -169,13 +171,15 @@ namespace ams::svc {
TickCountInfo_Total = std::numeric_limits<s64>::max(),
};
enum MesosphereMetaInfo : u64 {
MesosphereMetaInfo_KernelVersion = 0,
MesosphereMetaInfo_IsKTraceEnabled = 1,
};
enum SystemInfoType : u32 {
SystemInfoType_TotalPhysicalMemorySize = 0,
SystemInfoType_UsedPhysicalMemorySize = 1,
SystemInfoType_InitialProcessIdRange = 2,
/* NOTE: This is potentially temporary, and highly subject to change. */
SystemInfoType_IsMesosphere = 0xF0000000,
};
enum InitialProcessIdRangeInfo : u64 {