Difference between revisions of "Process Manager services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 8: Line 8:
 
| 1 || EnableMaintenanceMode
 
| 1 || EnableMaintenanceMode
 
|}
 
|}
 +
 +
= pm:dmnt =
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || [[#GetZero]]
 +
|-
 +
| 1 || [[#GetProcessesWithFlag4]]
 +
|-
 +
| 2 || [[#StartProcess]]
 +
|-
 +
| 3 || GetProcessTitleIdByPid
 +
|-
 +
| 4 || .. Returns a handle.
 +
|-
 +
| 5 || GetCrashingProcessPid
 +
|-
 +
| 6 || .. Returns a handle.
 +
|}
 +
 +
== GetZero ==
 +
Always returns u32 0.
 +
 +
== GetProcessesWithFlag4 ==
 +
Returns an array of pids of all processes that have mask 4 set in process flags.
 +
 +
== StartProcess ==
 +
Takes a pid. Process state must be 0 or 1. Then it uses svcStartProcess(process_handle, u8, u8, u32) with args coming from ldr:pm GetProgramInfo.
 +
 +
After that, it sets process state to 2.
  
 
= pm:info =
 
= pm:info =
Line 14: Line 45:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || GetProcessTitleID
+
| 0 || GetProcessTitleIdByPid
 
|}
 
|}
  

Revision as of 23:51, 18 July 2017

pm:bm

Cmd Name
0 GetMaintenanceMode
1 EnableMaintenanceMode

pm:dmnt

Cmd Name
0 #GetZero
1 #GetProcessesWithFlag4
2 #StartProcess
3 GetProcessTitleIdByPid
4 .. Returns a handle.
5 GetCrashingProcessPid
6 .. Returns a handle.

GetZero

Always returns u32 0.

GetProcessesWithFlag4

Returns an array of pids of all processes that have mask 4 set in process flags.

StartProcess

Takes a pid. Process state must be 0 or 1. Then it uses svcStartProcess(process_handle, u8, u8, u32) with args coming from ldr:pm GetProgramInfo.

After that, it sets process state to 2.

pm:info

Cmd Name
0 GetProcessTitleIdByPid

pm:shell

Cmd Name
0 LaunchProcess
1 TerminateProcessByPid
2 TerminateProcessByTitleID
3 GetProcessEventWaiter
4 GetProcessEventType (0=CONTINUE, 1=CRASHING, 2,3,5)
5 #FinalizeDeadProcess
6 #ClearProcessCrashedFlag
7 #NotifyBootFinished
8 #GetCrashingProcessPid

FinalizeDeadProcess

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.

Then it removes the process from PMs internal linked-list of active processes.

ClearProcessCrashedFlag

Takes a pid as input. Clears 0x10 from process flags.

NotifyBootFinished

Launches a process with hardcoded boot2 title-id.

GetCrashingProcessPid

Loops through the internal linked-list of processes, looks for mask 0x40 set in process flags. Returns pid of first such entry.