Loader services: Difference between revisions

 
(19 intermediate revisions by 6 users not shown)
Line 1: Line 1:
= ldr:dmnt =
= ldr:shel =
This is "nn::ldr::detail::IShellInterface".
 
This service has IPC max_sessions 3.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || AddProcessToDebugLaunchQueue
| 0 || [[#SetProgramArgument]]
|-
| 1 || ClearDebugLaunchQueue
|-
|-
| 2 ||
| 1 || [[#FlushArguments]]
|}
|}


== AddProcessToDebugLaunchQueue ==
== SetProgramArgument ==
Same as [[Loader_services#AddProcessToLaunchQueue|AddProcessToLaunchQueue]] but for processes marked as debug.
Takes a type-0x9 input buffer with launch arguments (as string), an u32 (size of arguments string), and an input [[NCM_services#ProgramId|ProgramId]]. No output.
 
[11.0.0+] Now takes a type-0x5 buffer instead of type-0x9. Now takes a total of 8-bytes of input, instead of 0x10-bytes total.


== ClearDebugLaunchQueue ==
Loads a process for the specified title-id and passes along the supplied arguments.
Same as [[Loader_services#ClearLaunchQueue|ClearLaunchQueue]] but for processes marked as debug.
Loaded processes are kept in a queue waiting for PM to launch them. The maximum number of waiting processes in this list is 10.
 
== FlushArguments ==
No input/output.
 
Clears the loaded processes waiting queue.
 
= ldr:dmnt =
This is "nn::ldr::detail::IDebugMonitorInterface".
 
This service has IPC max_sessions 2.


= ldr:pm =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || CreateProcess
| 0 || [[#SetProgramArgument2]]
|-
|-
| 1 || [[#GetProgramInfo]]
| 1 || [[#FlushArguments2]]
|-
| 2 || [[#RegisterTitle]]
|-
|-
| 3 || [[#UnregisterTitle]]
| 2 || [[#GetProcessModuleInfo]]
|}
|}


== GetProgramInfo ==
== SetProgramArgument2 ==
Takes a TitleId + StorageId, parses the NPDM, and writes output to a C descriptor buffer as follows:
Same as [[#SetProgramArgument]].
 
== FlushArguments2 ==
Same as [[#FlushArguments]].
 
== GetProcessModuleInfo ==
Takes a type-0xA output buffer of [[#ModuleInfo]] and an input u64 ProcessId. Returns an output s32.
 
= ldr:pm =
This is "nn::ldr::detail::IProcessManagerInterface".
 
This service has IPC max_sessions 1.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name
! Size
! Description
|-
| 0x0
| 0x1
| MainThreadPrio. Arg1 to svcStartProcess
|-
|-
| 0x1
| 0 || [[#CreateProcess]]
| 0x1
| DefaultCpuId. Arg2 to svcStartProcess
|-
|-
| 0x2
| 1 || [[#GetProgramInfo]]
| 0x1
| ApplicationType, see [[Process Manager services|here]].
|-
|-
| 0x3
| 2 || [[#PinProgram]]
| 0x1
| Padding
|-
|-
| 0x4
| 3 || [[#UnpinProgram]]
| 0x4
| MainThreadStackSize. Arg3 to svcStartProcess
|-
| 0x8
| 0x8
| Title id
|-
|-
| 0x10
| 4 || [10.0.0+] [[#SetEnabledProgramVerification]]
| 0x4
| ACID [[NPDM#Service Access Control|Service Access Control]] list size
|-
| 0x14
| 0x4
| ACI0 [[NPDM#Service Access Control|Service Access Control]] list size
|-
| 0x18
| 0x4
| ACID [[NPDM#FS Access Control|FS Access Control]] buffer size
|-
| 0x1C
| 0x4
| ACI0 [[NPDM#FS Access Control|FS Access Control]] buffer size
|-
| 0x20
| <Varies>
| ACID [[NPDM#Service Access Control|Service Access Control]] list
|-
| <Varies>
| <Varies>
| ACI0 [[NPDM#Service Access Control|Service Access Control]] list
|-
| <Varies>
| <Varies>
| ACID [[NPDM#FS Access Control|FS Access Control]] buffer
|-
| <Varies>
| <Varies>
| ACI0 [[NPDM#FS Access Control|FS Access Control]]
|}
|}


== RegisterTitle ==
== CreateProcess ==
Takes a TitleId + StorageId, returns an index.
Takes an input [[#PinId]], an input [[#CreateProcessFlag]] and an input ResourceLimit handle. Returns an output Process handle.


== UnregisterTitle ==
== GetProgramInfo ==
Takes the index from [[#RegisterTitle]].
Takes a type-0x1A output buffer containing a [[#ProgramInfo]] and a [[NCM_services#ProgramLocation|ProgramLocation]]. No output.


= ldr:shel =
[20.0.0+] Now takes an additional input u16.
{| class="wikitable" border="1"
 
|-
== PinProgram ==
! Cmd || Name
Takes a [[NCM_services#ProgramLocation|ProgramLocation]]. Returns an output [[#PinId]].
|-
| 0 || [[#AddProcessToLaunchQueue]]
|-
| 1 || [[#ClearLaunchQueue]]
|}


== AddProcessToLaunchQueue ==
== UnpinProgram ==
Takes a type-0x19 input buffer with launch arguments (as string), an u32 (size of arguments string), and an input title-id.
Takes an input [[#PinId]]. No output.


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


== ClearLaunchQueue ==
When the flag is zero, it will set ret=0 instead of ret={error} when verifying the fixed-key [[NPDM]] ACID signature fails. This also skips verifying the [[NCA#Header|NCA Header]] signature using the ACID key. Note that if verifying the fixed-key ACID signature is successful, and verifying the ACID-key NCA header signature fails, it will throw an error and abort.
Clears the loaded processes waiting queue.


= ldr:ro =
= CreateProcessFlag =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Value
!  Description
|-
|-
| 0 || [[#LoadNro]]
| 0 || EnableDebug
|-
|-
| 1 || UnloadNro
| 1 || DisableAslr
|-
| 2 || [[#LoadNrr]]
|-
| 3 || UnloadNrr
|-
| 4 || [[#Initialize]]
|}
|}


== LoadNro ==
= PinId =
This is an u64.
 
= ModuleInfo =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Word || Value
! Offset
! Size
! Description
|-
|-
| 0 || 0x00000004
| 0x0
| 0x20
| ModuleId
|-
|-
| 1 || 0x80000012
| 0x20
| 0x8
| Address
|-
|-
| 2 || 0x00000001
| 0x28
|- style="border-top: double"
| 0x8
| 0-1 || Pid
| Size
|- style="border-top: double"
| 0 || "SCFI"
|-
| 1 || 0x00000000
|-
| 2 || Always 0.
|-
| 3 || Nro heap address
|-
| 4 || Nro size
|-
| 5 || Bss backing heap address
|-
| 6 || Bss size
|}
|}


== LoadNrr ==
= ProgramInfo =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Word || Value
! Offset
! Size
! Description
|-
|-
| 0 || 0x00000004
| 0x0
| 0x1
| MainThreadPriority
|-
|-
| 1 || 0x8000000E
| 0x1
| 0x1
| DefaultCpuId
|-
|-
| 2 || 0x00000001
| 0x2
| 0x2
| Flags
|-
|-
|- style="border-top: double"
| 0x4
| 0-1 || Pid
| 0x4
|- style="border-top: double"
| MainThreadStackSize
| 0 || "SFCI"
|-
|-
| 1 || 0x00000002
| 0x8
| 0x8
| [[NCM_services#ProgramId|ProgramId]]
|-
|-
| 2 || Always 0.
| 0x10
| 0x4
| AcidSacSize
|-
|-
| 3 || Nrr address
| 0x14
| 0x4
| AciSacSize
|-
|-
| 4 || Nrr size
| 0x18
|}
| 0x4
 
| AcidFacSize
== Initialize ==
{| class="wikitable" border="1"
|-
|-
! Word || Value
| 0x1C
| 0x4
| AciFacSize
|-
|-
| 0 || 0x00000004
| 0x20
|-
| 0x10
| 1 || 0x8000000A
| [19.0.0+] Reserved
|-
|-
| 2 || 0x00000003
| [19.0.0+] 0x30 ([1.0.0-18.1.0] 0x20)
|- style="border-top: double"
| Variable
| 0-1 || Pid
| AcidSac
|-
|-
| 2 || Process handle (0xFFFF8001)
| Variable
|- style="border-top: double"
| Variable
| 0 || "SFCI"
| AciSac
|-
|-
| 1 || 0x00000004
| Variable
| Variable
| AcidFac
|-
|-
| 2 || Always 0.
| Variable
| Variable
| AciFac
|}
|}


[[Category:Services]]
[[Category:Services]]