Changes

Jump to navigation Jump to search
Line 1: Line 1:  
= LaunchFlags =
 
= LaunchFlags =
 +
 +
On [[5.0.0]]+, the LaunchFlag enum looks like this:
 +
 +
{| class=wikitable
 +
! Bit || Mask || Name
 +
|-
 +
| 0 || 1 || LaunchFlags_SignalOnExit
 +
|-
 +
| 1 || 2 || LaunchFlags_SignalOnStart
 +
|-
 +
| 2 || 4 || LaunchFlags_SignalOnCrash
 +
|-
 +
| 3 || 8 || LaunchFlags_SignalOnDebug
 +
|-
 +
| 4 || 0x10 || LaunchFlags_StartSuspended
 +
|-
 +
| 5 || 0x20 || LaunchFlags_DisableAslr
 +
|}
 +
 +
Prior to system version [[5.0.0]], the LaunchFlag enum had its entries in a different order:
 +
 
{| class=wikitable
 
{| class=wikitable
 
! Bit || Mask || Name
 
! Bit || Mask || Name
 
|-
 
|-
| 0 || 1 || LaunchFlags_NotifyWhenExited
+
| 0 || 1 || LaunchFlags_SignalOnExit
 
|-
 
|-
 
| 1 || 2 || LaunchFlags_StartSuspended
 
| 1 || 2 || LaunchFlags_StartSuspended
 
|-
 
|-
| 2 || 4 ||  
+
| 2 || 4 || LaunchFlags_SignalOnCrash
 
|-
 
|-
| 3 || 8 ||  
+
| 3 || 8 || LaunchFlags_DisableAslr
 
|-
 
|-
| 4 || 0x10 || LaunchFlags_NotifyDebugEvents
+
| 4 || 0x10 || LaunchFlags_SignalOnDebug
 
|-
 
|-
| 5 || 0x20 || [2.0.0+] LaunchFlags_NotifyDebugSpecial
+
| 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
 +
|-
 +
|}
    
= Process Tracker thread =
 
= Process Tracker thread =
Line 90: Line 131:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#IsDebugMode]]
+
| [1.0.0-4.1.0] 0 || [[#GetModuleIdList]]
 +
|-
 +
| 0 ([1.0.0-4.1.0] 1) || [[#GetJitDebugProcessIdList]]
 
|-
 
|-
| 1 || [[#GetDebugProcesses]]
+
| 1 ([1.0.0-4.1.0] 2)  || [[#StartProcess]]
 
|-
 
|-
| 2 || [[#StartDebugProcess]]
+
| 2 ([1.0.0-4.1.0] 3)  || [[#GetProcessId]]
 
|-
 
|-
| 3 || [[#GetTitlePid]]
+
| 3 ([1.0.0-4.1.0] 4)  || [[#HookToCreateProcess]]
 
|-
 
|-
| 4 || [[#EnableDebugForTitleId]]
+
| 4 ([1.0.0-4.1.0] 5)  || [[#GetApplicationProcessId]]
 
|-
 
|-
| 5 || [[#GetApplicationPid]]
+
| 5 ([1.0.0-4.1.0] 6)  || [[#HookToCreateApplicationProcess]]
 
|-
 
|-
| 6 || [[#EnableDebugForApplication]]
+
| [6.0.0+] 6 || [[#ClearHook]]
 
|}
 
|}
   −
== IsDebugMode ==
  −
Always returns u32 0 on retail.
     −
[2.0.0+] Additional check on input that can return 0xC0F. The meaning is probably useless because function is somewhat nopped on non-dev builds anyway.
+
== GetModuleIdList==
 +
Stubbed in all versions of retail firmware (just returns 0).
 +
 
 +
[2.0.0+] When output buffer size is > INT_MAX, returns ResultInvalidSize.
   −
== GetDebugProcesses ==
+
== 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+] Additional check on input that can return 0xC0F. The meaning is probably useless because function is somewhat nopped on non-dev builds anyway.
+
[2.0.0+] When output buffer size is > INT_MAX, returns ResultInvalidSize.
   −
== StartDebugProcess ==
+
== 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 122: Line 166:  
After that, it sets last process state to ProcessEvent_DebugDetached.
 
After that, it sets last process state to ProcessEvent_DebugDetached.
   −
== GetTitlePid ==
+
== GetProcessId ==
 
Takes a title-id and returns the pid.
 
Takes a title-id and returns the pid.
   −
== EnableDebugForTitleId ==
+
== 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 132: Line 176:  
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.
   −
== GetApplicationPid ==
+
== GetApplicationProcessId ==
 
Returns the pid of the application process.
 
Returns the pid of the application process.
   −
== EnableDebugForApplication ==
+
== 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.
 +
 +
Disables debugging/clears the globally specified tid if bit 0 is set, disables debugging/clears the next application if bit 1 is set.
    
= pm:info =
 
= pm:info =
Line 147: Line 196:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#GetTitleId]]
+
| 0 || [[#GetProgramId]]
 
|}
 
|}
   −
== GetTitleId ==
+
== 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 160: Line 209:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#LaunchProcess]]
+
| 0 || [[#LaunchProgram]]
 
|-
 
|-
| 1 || TerminateProcessByPid
+
| 1 || TerminateProcess
 
|-
 
|-
| 2 || TerminateProcessByTitleId
+
| 2 || TerminateProgram
 
|-
 
|-
| 3 || GetProcessEventWaiter
+
| 3 || GetProcessEventHandle
 
|-
 
|-
| 4 || [[#GetProcessEventType]]
+
| 4 || [[#GetProcessEventInfo]]
 
|-
 
|-
| ([1.0.0-4.1.0] 5) || [[#FinalizeDeadProcess]]
+
| ([1.0.0-4.1.0] 5) || [[#CleanupProcess]]
 
|-
 
|-
| ([1.0.0-4.1.0] 6) || [[#ClearProcessNotificationFlag]]
+
| ([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) || [[#GetApplicationPid]]
+
| 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]]
 
|}
 
|}
   −
== LaunchProcess ==
+
== LaunchProgram ==
Takes launch_flags, title-id, and storageID. See [[#Process launch]].
+
Takes an u32 launch_flags and [[NCM_services#ProgramLocation|ProgramLocation]]. Returns the u64 title PID.
   −
Returns the u64 title PID.
+
See [[#Process launch]].
   −
== GetProcessEventType ==
+
== GetProcessEventInfo ==
 
Returns 1 if flags has mask 2 set.
 
Returns 1 if flags has mask 2 set.
   Line 199: Line 252:  
Returns 0 if process is not found.
 
Returns 0 if process is not found.
   −
== FinalizeDeadProcess ==
+
== 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 206: Line 259:  
[5.0.0+] This command was removed.
 
[5.0.0+] This command was removed.
   −
== ClearProcessNotificationFlag ==
+
== ClearJitDebugOccured ==
 
Takes a pid as input. Clears 0x10 from process flags.
 
Takes a pid as input. Clears 0x10 from process flags.
   Line 230: Line 283:  
* 010000000000003D (safemode)
 
* 010000000000003D (safemode)
   −
== GetApplicationPid ==
+
== 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 237: Line 290:     
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]]

Navigation menu