Process Manager services: Difference between revisions
(18 intermediate revisions by 3 users not shown) | |||
Line 35: | Line 35: | ||
|- | |- | ||
| 5 || 0x20 || [2.0.0+] LaunchFlags_SignalOnStart | | 5 || 0x20 || [2.0.0+] LaunchFlags_SignalOnStart | ||
|} | |||
= ProcessEventInfo = | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 | |||
| 0x4 | |||
| ProcessEvent | |||
|- | |||
| 0x4 | |||
| 0x4 | |||
| Padding/Reserved | |||
|- | |||
| 0x8 | |||
| 0x8 | |||
| ProcessId | |||
|- | |||
|} | |} | ||
Line 101: | Line 122: | ||
|- | |- | ||
| 1 || SetMaintenanceBoot | | 1 || SetMaintenanceBoot | ||
|- | |||
| 2 || [19.0.0+] | |||
|- | |||
| 3 || [19.0.0+] | |||
|} | |} | ||
Line 110: | Line 135: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| [1.0.0-4.1.0] 0 || [[# | | [1.0.0-4.1.0] 0 || [[#GetModuleIdList]] | ||
|- | |- | ||
| 0 ([1.0.0-4.1.0] 1) || [[# | | 0 ([1.0.0-4.1.0] 1) || [[#GetJitDebugProcessIdList]] | ||
|- | |- | ||
| 1 ([1.0.0-4.1.0] 2) | | 1 ([1.0.0-4.1.0] 2) || [[#StartProcess]] | ||
|- | |- | ||
| 2 ([1.0.0-4.1.0] 3) | | 2 ([1.0.0-4.1.0] 3) || [[#GetProcessId]] | ||
|- | |- | ||
| 3 ([1.0.0-4.1.0] 4) | | 3 ([1.0.0-4.1.0] 4) || [[#HookToCreateProcess]] | ||
|- | |- | ||
| 4 ([1.0.0-4.1.0] 5) | | 4 ([1.0.0-4.1.0] 5) || [[#GetApplicationProcessId]] | ||
|- | |- | ||
| 5 ([1.0.0-4.1.0] 6) | | 5 ([1.0.0-4.1.0] 6) || [[#HookToCreateApplicationProcess]] | ||
|- | |- | ||
| [6.0.0+] 6 | | [6.0.0+] 6 || [[#ClearHook]] | ||
|- | |||
| [14.0.0+] 7 || GetProgramId | |||
|} | |} | ||
== | == GetModuleIdList== | ||
Stubbed in all versions of retail firmware (just returns 0). | |||
[2.0.0+] | [2.0.0+] When output buffer size is > INT_MAX, returns ResultInvalidSize. | ||
== | == GetJitDebugProcessIdList == | ||
Returns an array of pids of all processes that have mask 4 set in process flags. | Returns an array of pids of all processes that have mask 4 set in process flags. | ||
[2.0.0+] | [2.0.0+] When output buffer size is > INT_MAX, returns ResultInvalidSize. | ||
== | == StartProcess == | ||
Takes a pid. Last process event must be ProcessEvent_Created or ProcessEvent_DebugAttached. | Takes a pid. Last process event must be ProcessEvent_Created or ProcessEvent_DebugAttached. | ||
Line 145: | Line 172: | ||
After that, it sets last process state to ProcessEvent_DebugDetached. | After that, it sets last process state to ProcessEvent_DebugDetached. | ||
== | == GetProcessId == | ||
Takes a title-id and returns the pid. | Takes a title-id and returns the pid. | ||
== | == HookToCreateProcess == | ||
Takes a title-id of the program to debug. Sets this to a global field. | Takes a title-id of the program to debug. Sets this to a global field. | ||
Line 155: | Line 182: | ||
Returns an event handle that is signaled when the requested title is about to be launched. | Returns an event handle that is signaled when the requested title is about to be launched. | ||
== | == GetApplicationProcessId == | ||
Returns the pid of the application process. | Returns the pid of the application process. | ||
== | == HookToCreateApplicationProcess == | ||
Does *not* take a specific title-id as input. | Does *not* take a specific title-id as input. | ||
Returns an event handle that is triggered for application titles. | Returns an event handle that is triggered for application titles. | ||
== | == ClearHook == | ||
Takes in a u32 of bitflags. | Takes in a u32 of bitflags. | ||
Line 175: | Line 202: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#GetProgramId]] | ||
|- | |||
| 1 || [14.0.0+] GetAppletCurrentResourceLimitValues | |||
|- | |||
| 2 || [14.0.0+] GetAppletPeakResourceLimitValues | |||
|} | |} | ||
== | == GetProgramId == | ||
Takes a pid and returns the title-id associated with the process. | Takes a pid and returns the title-id associated with the process. | ||
Line 188: | Line 219: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#LaunchProgram]] | ||
|- | |- | ||
| 1 || | | 1 || TerminateProcess | ||
|- | |- | ||
| 2 || | | 2 || TerminateProgram | ||
|- | |- | ||
| 3 || | | 3 || GetProcessEventHandle | ||
|- | |- | ||
| 4 || [[# | | 4 || [[#GetProcessEventInfo]] | ||
|- | |- | ||
| ([1.0.0-4.1.0] 5) || [[# | | ([1.0.0-4.1.0] 5) || [[#CleanupProcess]] | ||
|- | |- | ||
| ([1.0.0-4.1.0] 6) || [[# | | ([1.0.0-4.1.0] 6) || [[#ClearJitDebugOccured]] | ||
|- | |- | ||
| 5 ([1.0.0-4.1.0] 7) || [[#NotifyBootFinished]] | | 5 ([1.0.0-4.1.0] 7) || [[#NotifyBootFinished]] | ||
|- | |- | ||
| 6 ([1.0.0-4.1.0] 8) || [[# | | 6 ([1.0.0-4.1.0] 8) || [[#GetApplicationProcessIdForShell]] | ||
|- | |- | ||
| 7 ([4.0.0-4.1.0] 9) || [4.0.0+] [[#BoostSystemMemoryResourceLimit]] | | 7 ([4.0.0-4.1.0] 9) || [4.0.0+] [[#BoostSystemMemoryResourceLimit]] | ||
|- | |||
| 8 || [7.0.0+] [[#BoostApplicationThreadResourceLimit]] | |||
|- | |||
| 9 || [8.0.0+] [[#GetBootFinishedEventHandle]] | |||
|- | |||
| 10 || [14.0.0+] BoostSystemThreadResourceLimit | |||
|- | |||
| 12 || [19.0.0+] GetProcessId | |||
|} | |} | ||
== | == LaunchProgram == | ||
Takes launch_flags | Takes an u32 launch_flags and [[NCM_services#ProgramLocation|ProgramLocation]]. Returns the u64 title PID. | ||
See [[#Process launch]]. | |||
== | == GetProcessEventInfo == | ||
Returns 1 if flags has mask 2 set. | Returns 1 if flags has mask 2 set. | ||
Line 227: | Line 266: | ||
Returns 0 if process is not found. | Returns 0 if process is not found. | ||
== | == CleanupProcess == | ||
Takes a pid as input. If the process with pid has the state "dead", it unregisters the pid in fsp:pr, sm:m, and ldr:pm. | Takes a pid as input. If the process with pid has the state "dead", it unregisters the pid in fsp:pr, sm:m, and ldr:pm. | ||
Line 234: | Line 273: | ||
[5.0.0+] This command was removed. | [5.0.0+] This command was removed. | ||
== | == ClearJitDebugOccured == | ||
Takes a pid as input. Clears 0x10 from process flags. | Takes a pid as input. Clears 0x10 from process flags. | ||
Line 240: | Line 279: | ||
== NotifyBootFinished == | == NotifyBootFinished == | ||
This launches the [[boot2]] title. | This [[#LaunchProgram|launches]] the [[boot2]] title with launch_flags=0. | ||
[4.0.0+] When booting from SafeMode Firmware, instead of [[boot2]], this launches the following titles in order: | [10.0.0+] The functionality described [[SMC#DisableProgramVerification|here]] was added, prior to title-launching. | ||
[4.0.0+] When booting from SafeMode Firmware, instead of [[boot2]], this launches the following titles in order (launch_flags=0): | |||
* 0100000000000009 (settings) | * 0100000000000009 (settings) | ||
* 0100000000000006 (usb) | * 0100000000000006 (usb) | ||
* 010000000000001D (pcie) | * 010000000000001D (pcie) | ||
* 0100000000000007 (tma) | * 0100000000000007 (tma) | ||
* 0100000000000042 (pgl) [10.0.0+] | |||
* 010000000000001F (ns) | * 010000000000001F (ns) | ||
* 0100000000000015 (lm) | * 0100000000000015 (lm) | ||
Line 252: | Line 294: | ||
* 0100000000000016 (wlan) | * 0100000000000016 (wlan) | ||
* 0100000000000012 (bsdsockets) | * 0100000000000012 (bsdsockets) | ||
* 0100000000000046 (eth) [15.0.0+] | |||
* 010000000000000F (nifm) | * 010000000000000F (nifm) | ||
* 0100000000000024 (ssl) | * 0100000000000024 (ssl) | ||
Line 258: | Line 301: | ||
* 010000000000003D (safemode) | * 010000000000003D (safemode) | ||
== | == GetApplicationProcessIdForShell == | ||
Loops through the internal linked-list of processes, looks for mask 0x40 set in process flags. Returns pid of first such entry. | Loops through the internal linked-list of processes, looks for mask 0x40 set in process flags. Returns pid of first such entry. | ||
Line 265: | Line 308: | ||
This is used directly by [[NS_Services#IApplicationManagerInterface|ns:am2 BoostSystemMemoryResourceLimit]]. | This is used directly by [[NS_Services#IApplicationManagerInterface|ns:am2 BoostSystemMemoryResourceLimit]]. | ||
== BoostApplicationThreadResourceLimit == | |||
Calls svcSetResourceLimitLimitValue to increase the limit on application threads by an amount calculated dynamically during setup. | |||
This function can only increase the limit once, on further calls it will call svcSetResourceLimitLimitValue with the same value it called the first time. | |||
On normal [[7.0.0]] retail firmware, this will double the limit on application threads from 0x60 to 0xC0. | |||
== GetBootFinishedEventHandle == | |||
This function returns a handle to an event that is signaled when [[#NotifyBootFinished]] is called. | |||
However, this is only used/available in safe mode; in normal, non-safe FIRM, the implementation for this command just does "abort();". | |||
[[Category:Services]] | [[Category:Services]] |