svc: Add new InfoTypes

This commit is contained in:
Michael Scire 2024-03-29 02:27:26 -07:00 committed by fincs
parent b69d2fa95e
commit c8c4406467
2 changed files with 9 additions and 0 deletions

View File

@ -209,6 +209,8 @@ typedef enum {
InfoType_FreeThreadCount = 24, ///< [11.0.0+] The number of free threads available to the process's resource limit. InfoType_FreeThreadCount = 24, ///< [11.0.0+] The number of free threads available to the process's resource limit.
InfoType_ThreadTickCount = 25, ///< [13.0.0+] Number of ticks spent on thread. InfoType_ThreadTickCount = 25, ///< [13.0.0+] Number of ticks spent on thread.
InfoType_IsSvcPermitted = 26, ///< [14.0.0+] Does process have access to SVC (only usable with \ref svcSynchronizePreemptionState at present). InfoType_IsSvcPermitted = 26, ///< [14.0.0+] Does process have access to SVC (only usable with \ref svcSynchronizePreemptionState at present).
InfoType_IoRegionHint = 27, ///< [16.0.0+] Low bits of the physical address for a KIoRegion.
InfoType_AliasRegionExtraSize = 28, ///< [18.0.0+] Extra size added to the reserved region.
InfoType_ThreadTickCountDeprecated = 0xF0000002, ///< [1.0.0-12.1.0] Number of ticks spent on thread. InfoType_ThreadTickCountDeprecated = 0xF0000002, ///< [1.0.0-12.1.0] Number of ticks spent on thread.
} InfoType; } InfoType;

View File

@ -160,6 +160,13 @@ void virtmemSetup(void) {
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_WeirdKernel)); diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_WeirdKernel));
} }
// Account for the alias region extra size.
u64 alias_extra_size;
rc = svcGetInfo(&alias_extra_size, InfoType_AliasRegionExtraSize, CUR_PROCESS_HANDLE, 0);
if (R_SUCCEEDED(rc)) {
g_AliasRegion.end -= alias_extra_size;
}
// Retrieve memory region information for the reserved heap region. // Retrieve memory region information for the reserved heap region.
rc = _memregionInitWithInfo(&g_HeapRegion, InfoType_HeapRegionAddress, InfoType_HeapRegionSize); rc = _memregionInitWithInfo(&g_HeapRegion, InfoType_HeapRegionAddress, InfoType_HeapRegionSize);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {