kern/pm: support for 5.x under mesosphere

This commit is contained in:
Michael Scire 2020-08-21 02:38:16 -07:00
parent 8741ee24a0
commit 8836a5385c
3 changed files with 386 additions and 357 deletions

View File

@ -294,6 +294,19 @@ 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

@ -14,9 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX) && defined(ATMOSPHERE_ARCH_ARM64)
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
namespace ams::svc::aarch64::lp64 {
namespace ams::svc {
#if defined(ATMOSPHERE_ARCH_ARM64)
namespace aarch64::lp64 {
ALWAYS_INLINE Result SetHeapSize(::ams::svc::Address *out_address, ::ams::svc::Size size) {
return ::svcSetHeapSize(reinterpret_cast<void **>(out_address), size);
@ -493,3 +497,12 @@ namespace ams::svc::aarch64::lp64 {
}
#endif
ALWAYS_INLINE bool IsKernelMesosphere() {
uint64_t dummy;
return R_SUCCEEDED(::ams::svc::GetSystemInfo(std::addressof(dummy), ::ams::svc::SystemInfoType_IsMesosphere, ::ams::svc::InvalidHandle, 0));
}
}
#endif

View File

@ -173,6 +173,9 @@ namespace ams::svc {
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 {