NPDM: Difference between revisions

Liam (talk | contribs)
mNo edit summary
No edit summary
Line 37: Line 37:
| 0xC
| 0xC
| 0x1
| 0x1
| MMU flags (bit0 = use 64-bit instructions, bit1 = use 64-bit address space, bit2 = use 32-bit address space, bit3 = use 32-bit address space without reserved region, bit4 = optimize memory allocation?)
| Flags (bit0 = Is64BitInstruction, bit1 = AddressSpace64BitOld, bit2 = AddressSpace32Bit, bit3 = AddressSpace32BitNoReserved, bit4 = AddressSpace64Bit)
|-
|-
| 0xD
| 0xD
Line 45: Line 45:
| 0xE
| 0xE
| 0x1
| 0x1
| Main thread priority (0-63)
| MainThreadPriority (0-63)
|-
|-
| 0xF
| 0xF
| 0x1
| 0x1
| Main thread core number
| MainThreadCoreNumber
|-
|-
| 0x10
| 0x10
Line 65: Line 65:
| 0x1C
| 0x1C
| 0x4
| 0x4
| Main thread stack size (Should(?) be page-aligned. In non-nspwn scenarios, values of 0 can also rarely break in Horizon. This might be something auto-adapting or a security feature of some sort?)
| MainThreadStackSize (Must be aligned to 0x1000. In non-nspwn scenarios, values of 0 can also rarely break in Horizon. This might be something auto-adapting or a security feature of some sort?)
|-
|-
| 0x20
| 0x20
Line 125: Line 125:
| 0x20C
| 0x20C
| 0x4
| 0x4
| Flags (bit0 = ProductionFlag, bit1 = UnqualifiedApproval, [5.0.0+] bit2-3: PoolPartition? For applets set to 0b01, for sysmodules set to 0b10. Exceptions: "starter" is set to 0, "nvservices" is set to 3)
| Flags (bit0 = ProductionFlag, bit1 = UnqualifiedApproval, [5.0.0+] bit2-3: MemoryRegion (for applets set to 0b01, for sysmodules set to 0b10. Exceptions: "starter" is set to 0, "nvservices" is set to 3)
|-
|-
| 0x210
| 0x210
| 0x8
| 0x8
| TitleIdRange_Min
| ProgramIdMin
|-
|-
| 0x218
| 0x218
| 0x8
| 0x8
| TitleIdRange_Max
| ProgramIdMax
|-
|-
| 0x220
| 0x220
Line 181: Line 181:
| 0x10
| 0x10
| 0x8
| 0x8
| Title ID
| ProgramId
|-
|-
| 0x18
| 0x18
Line 224: Line 224:
|-
|-
| 0x0
| 0x0
| 0x1
| 0x4
| Version (always 1, must be non-zero)
| Version (always 1, must be non-zero)
|-
| 0x1
| 0x3
| Padding
|-
|-
| 0x4
| 0x4
Line 237: Line 233:
| 0xC
| 0xC
| 0x4
| 0x4
| Data Size (always 0x1C)
| ContentOwnerInfoOffset
|-
|-
| 0x10
| 0x10
| 0x4
| 0x4
| Size of Content Owner ID section.
| ContentOwnerInfoSize
|-
|-
| 0x14
| 0x14
| 0x4
| 0x4
| Data size (0x1C) plus Content Owner size
| SaveDataOwnerInfoOffset
|-
|-
| 0x18
| 0x18
| 0x4
| 0x4
| Size of Save Data owners section (for applications that wish to share save data?)
| SaveDataOwnerInfoSize
|-
|-
| 0x1C
| 0x1C
Line 463: Line 459:
Bitmask 0x07 in control_byte is the {length of the service-name without nul-terminator} - 1.
Bitmask 0x07 in control_byte is the {length of the service-name without nul-terminator} - 1.


Bitmask 0x80 in control_byte means service is allowed to be registered.
Bitmask 0x80 in control_byte means IsServer (service is allowed to be registered).


The service string can contain a wildcard <code>*</code> character.
The service string can contain a wildcard <code>*</code> character.
Line 479: Line 475:
| <code>0bxxxxxxxxxxxx0111</code>
| <code>0bxxxxxxxxxxxx0111</code>
| Bit3
| Bit3
| KernelFlags
| ThreadInfo
| Bit31-24: Highest allowed cpu id, bit23-16: Lowest allowed cpu id, bit15-10: Highest allowed thread prio, bit9-4: Lowest allowed thread prio
| Bit31-24: MaxCoreNumber, bit23-16: MinCoreNumber, bit15-10: HighestPriority, bit9-4: LowestPriority.
|-
|-
| <code>0bxxxxxxxxxxx01111</code>
| <code>0bxxxxxxxxxxx01111</code>
| Bit4
| Bit4
| SyscallMask
| EnableSystemCalls
| Bits 29-31: Syscall mask table index; Bits 5-28: Mask
| Bits29-31: SystemCallId; Bits5-28: Mask.
|-
|-
| <code>0bxxxxxxxxx0111111</code>
| <code>0bxxxxxxxxx0111111</code>
| Bit6
| Bit6
| MapIoOrNormalRange
| MemoryMap
| Bits 7-30: Alternating start page and number of pages, bit31: Alternating read-only flag then MemoryAttribute 0x2001/0x42002 selector flag
| Bits7-30: Alternates between BeginAddress and Size, bit31: Alternates between Permission (MemoryPermission_RO or MemoryPermission_RW) and Type (MemoryType_Io or MemoryType_Static).
|-
|-
| <code>0bxxxxxxxx01111111</code>
| <code>0bxxxxxxxx01111111</code>
| Bit7
| Bit7
| MapNormalPage (RW)
| MemoryMap (RW)
| Bits 8-31: Page
| Bits8-31: BeginAddress.
|-
|-
| <code>0bxxxx011111111111</code>
| <code>0bxxxx011111111111</code>
| Bit11
| Bit11
| InterruptPair
| EnableInterrupts
| Bits 12-21: Irq0, bits 22-31: Irq1, 0x3FF means empty.
| Bits12-21: Irq0, bits22-31: Irq1, 0x3FF means empty.
|-
|-
| <code>0bxx01111111111111</code>
| <code>0bxx01111111111111</code>
| Bit13
| Bit13
| ApplicationType
| MiscParams
| Bit16-14: ApplicationType (0=sysmodule, 1=application, 2=applet), bit16 ignored. Parsed by [[Process Manager services]]. Defaults to 0 if descriptor doesn't exist. Can only run 1 application at a time.
| Bit16-14: ProgramType (0 = System, 1 = Application, 2 = Applet), bit16 ignored. Parsed by [[Process Manager services]]. Defaults to 0 if descriptor doesn't exist. Can only run 1 application at a time.
|-
|-
| <code>0bx011111111111111</code>
| <code>0bx011111111111111</code>
| Bit14
| Bit14
| KernelReleaseVersion
| KernelVersion
| Bits 15-X: Version. The raw descriptor is compared with 0x80000, when less than an error is returned. This is equivalent to comparing the bits starting at bit15 with 0x10. This enforces a minimum required version, not a maximum.
| Bits15-18: MinorVersion, bits19-31: MajorVersion. The raw descriptor is compared with 0x80000, when less than an error is returned. This is equivalent to comparing the bits starting at bit15 with 0x10. This enforces a minimum required version, not a maximum.
|-
|-
| <code>0b0111111111111111</code>
| <code>0b0111111111111111</code>
| Bit15
| Bit15
| HandleTableSize
| HandleTableSize
| Bit25-16: Number of handles the table shall fit.
| Bit16-25: Number of handles the table shall fit.
|-
|-
| <code>0b1111111111111111</code>
| <code>0b1111111111111111</code>
| Bit16
| Bit16
| DebugFlags
| MiscFlags
| Bit17: can be debugged, bit18: can debug others
| Bit17: EnableDebug, bit18: ForceDebug.
|-
|-
| All ones
| All ones