Difference between revisions of "Loader services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 42: Line 42:
 
| 0x0
 
| 0x0
 
| 0x1
 
| 0x1
| Arg1 to svcStartProcess
+
| MainThreadPrio. Arg1 to svcStartProcess
 
|-
 
|-
 
| 0x1
 
| 0x1
 
| 0x1
 
| 0x1
| Arg2 to svcStartProcess
+
| DefaultCpuId. Arg2 to svcStartProcess
 
|-
 
|-
 
| 0x2
 
| 0x2
Line 58: Line 58:
 
| 0x4
 
| 0x4
 
| 0x4
 
| 0x4
| Arg3 to svcStartProcess
+
| MainThreadStackSize. Arg3 to svcStartProcess
 
|-
 
|-
 
| 0x8
 
| 0x8

Revision as of 03:29, 7 August 2017

ldr:dmnt

Cmd Name
0 AddProcessToDebugLaunchQueue
1 ClearDebugLaunchQueue
2

AddProcessToDebugLaunchQueue

Same as AddProcessToLaunchQueue but for processes marked as debug.

ClearDebugLaunchQueue

Same as ClearLaunchQueue but for processes marked as debug.

ldr:pm

Cmd Name
0 CreateProcess
1 #GetProgramInfo
2 #RegisterTitle
3 #UnregisterTitle

GetProgramInfo

Takes a TitleId + StorageId and writes output to a C descriptor buffer as follows:

Offset Size Description
0x0 0x1 MainThreadPrio. Arg1 to svcStartProcess
0x1 0x1 DefaultCpuId. Arg2 to svcStartProcess
0x2 0x1 PmFlags, see here.
0x3 0x1 Padding
0x4 0x4 MainThreadStackSize. Arg3 to svcStartProcess
0x8 0x8 Title id
0x10 0x4 ACID Service Access Control list size
0x14 0x4 ACI0 Service Access Control list size
0x18 0x4 ACID FS Access Control buffer size
0x1C 0x4 ACI0 FS Access Control buffer size
0x20 <Varies> ACID Service Access Control list
<Varies> <Varies> ACI0 Service Access Control list
<Varies> <Varies> ACID FS Access Control buffer
<Varies> <Varies> ACI0 FS Access Control

RegisterTitle

Takes a TitleId + StorageId, returns an index.

UnregisterTitle

Takes the index from #RegisterTitle.

ldr:shel

Cmd Name
0 #AddProcessToLaunchQueue
1 #ClearLaunchQueue

AddProcessToLaunchQueue

Takes a type-0x19 input buffer with launch arguments (as string), an u32 (size of arguments string), and an input title-id.

Loads a process for the specified title-id and passes along the supplied arguments. Loaded processes are kept in a queue waiting for PM to launch them. The maximum number of waiting processes in this list is 10.

ClearLaunchQueue

Clears the loaded processes waiting queue.

ldr:ro

Cmd Name
0 #LoadNro
1 UnloadNro
2 #LoadNrr
3 UnloadNrr
4 #Initialize

LoadNro

Word Value
0 0x00000004
1 0x80000012
2 0x00000001
0-1 Pid
0 "SCFI"
1 0x00000000
2 Always 0.
3 Nro heap address
4 Nro size
5 Bss backing heap address
6 Bss size

LoadNrr

Word Value
0 0x00000004
1 0x8000000E
2 0x00000001
0-1 Pid
0 "SFCI"
1 0x00000002
2 Always 0.
3 Nrr address
4 Nrr size

Initialize

Word Value
0 0x00000004
1 0x8000000A
2 0x00000003
0-1 Pid
2 Process handle (0xFFFF8001)
0 "SFCI"
1 0x00000004
2 Always 0.