Changes

Jump to navigation Jump to search
2,678 bytes added ,  10:13, 5 February 2019
Line 25: Line 25:  
|  0xA || [[#svcExitThread]] || None ||                                                         
 
|  0xA || [[#svcExitThread]] || None ||                                                         
 
|-
 
|-
|  0xB || [[#svcSleepThread]] || X0=nano || W0=result
+
|  0xB || [[#svcSleepThread]] || X0=nano ||
 
|-
 
|-
 
|  0xC || [[#svcGetThreadPriority]] || W1=thread_handle || W0=result, W1=prio
 
|  0xC || [[#svcGetThreadPriority]] || W1=thread_handle || W0=result, W1=prio
Line 149: Line 149:  
| 0x52 || [[#svcUnmapTransferMemory]] || W0=tmemhandle, X1=addr, X2=size || W0=result
 
| 0x52 || [[#svcUnmapTransferMemory]] || W0=tmemhandle, X1=addr, X2=size || W0=result
 
|-
 
|-
| 0x53 || svcCreateInterruptEvent || X1=irq_num, W2=flag || W0=result, W1=handle
+
| 0x53 || [[#svcCreateInterruptEvent]] || X1=irq_num, W2=flag || W0=result, W1=handle
 
|-
 
|-
 
| 0x54 || [[#svcQueryPhysicalAddress]] || X1=addr || W0=result, X1=physaddr, X2=kerneladdr, X3=size
 
| 0x54 || [[#svcQueryPhysicalAddress]] || X1=addr || W0=result, X1=physaddr, X2=kerneladdr, X3=size
Line 183: Line 183:  
| 0x63 || svcGetDebugEvent || X0=[[#DebugEventInfo]]*, W1=debug_handle || W0=result
 
| 0x63 || svcGetDebugEvent || X0=[[#DebugEventInfo]]*, W1=debug_handle || W0=result
 
|-
 
|-
| 0x64 || svcContinueDebugEvent || [1.0.0-2.3.0] W0=debug_handle, W1=[[#ContinueDebugFlagsOld]], X2=thread_id  
+
| 0x64 || [[#svcContinueDebugEvent]] || [1.0.0-2.3.0] W0=debug_handle, W1=[[#ContinueDebugFlagsOld]], X2=thread_id  
 
[3.0.0+] W0=debug_handle, W1=[[#ContinueDebugFlags]], X2=thread_id_list(u64 *), W3=num_tids (max 64, 0 means "all threads")
 
[3.0.0+] W0=debug_handle, W1=[[#ContinueDebugFlags]], X2=thread_id_list(u64 *), W3=num_tids (max 64, 0 means "all threads")
 
|| W0=result
 
|| W0=result
Line 193: Line 193:  
| 0x67 || svcGetDebugThreadContext || X0=ThreadContext*, X1=debug_handle, X2=thread_id, W3=[[#ThreadContextFlags]] || W0=result
 
| 0x67 || svcGetDebugThreadContext || X0=ThreadContext*, X1=debug_handle, X2=thread_id, W3=[[#ThreadContextFlags]] || W0=result
 
|-
 
|-
| 0x68 || svcSetDebugThreadContext || W0=debug_handle, W1=[[#ThreadContextFlags]], X2=ThreadContext*, X3=thread_id || W0=result
+
| 0x68 || svcSetDebugThreadContext || W0=debug_handle, X1=thread_id, X2=ThreadContext*, W3=[[#ThreadContextFlags]] || W0=result
 
|-
 
|-
 
| 0x69 || svcQueryDebugProcessMemory || X0=[[#MemoryInfo]]*, X2=debug_handle, X3=addr || W0=result, W1=PageInfo
 
| 0x69 || svcQueryDebugProcessMemory || X0=[[#MemoryInfo]]*, X2=debug_handle, X3=addr || W0=result, W1=PageInfo
Line 478: Line 478:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) X0 || u64 || Nano
+
| (In) X0 || s64 || Nanoseconds
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
   
|}
 
|}
 
</div>
 
</div>
Line 486: Line 485:  
'''Description:''' Sleep for a specified amount of time, or yield thread.
 
'''Description:''' Sleep for a specified amount of time, or yield thread.
   −
Setting nano=0 means "yield thread".
+
Setting nanoseconds to 0, -1, or -2 indicates a yielding type.
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value || Type
 +
|-
 +
| 0 || Yielding without core migration
 +
|-
 +
| -1 || Yielding with core migration
 +
|-
 +
| -2 || Yielding to any other thread
 +
|-
 +
|}
 +
</div>
    
== svcGetThreadPriority ==
 
== svcGetThreadPriority ==
Line 845: Line 858:  
| Process || 20 || 0 || [5.0.0+] UserExceptionContextAddr
 
| Process || 20 || 0 || [5.0.0+] UserExceptionContextAddr
 
|-
 
|-
| Thread  || 0xF0000002 || 0 || Performance counter related.
+
| Process || 21 || 0 || [6.0.0+] TotalMemoryAvailableWithoutMmHeap
 +
|-
 +
| Process || 22 || 0 || [6.0.0+] TotalMemoryUsedWithoutMmHeap
 +
|-
 +
| Thread  || 0xF0000002 || 0 || Scheduler related.
 
|}
 
|}
   Line 1,056: Line 1,073:  
Size must match size given in map syscall, otherwise there's an invalid-size error.
 
Size must match size given in map syscall, otherwise there's an invalid-size error.
   −
== svcQueryPhysicalAddress ==
+
 
 +
== svcCreateInterruptEvent ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 1,063: Line 1,081:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) X1 || u64 || Addr
+
| (In) X1 || u64 || IrqNum
 
|-
 
|-
| (Out) W0 || [[#Result]]|| Ret
+
| (In) W2 || bool || Flags
 
|-
 
|-
| (Out) X1 || u64 || PhysAddr
+
| (Out) W0 || [[#Result]] || Ret
|-
  −
| (Out) X2 || u64 || KernelAddr
   
|-
 
|-
| (Out) X3 || u64 || Size
+
| (Out) W1 || Handle<ReadableEvent> || ReadableEventHandle
 
|}
 
|}
 
</div>
 
</div>
   −
== svcQueryIoMapping ==
+
Create an event handle for the given IRQ number. Waiting on this handle will wait until the IRQ is triggered. The flags argument configures the triggering. If it is false, the IRQ is active HIGH level sensitive, if it is true it is rising-edge sensitive.
 +
 
 +
=== Result codes ===
   −
<div style="display: inline-block;">
+
'''0x0:''' Success.
{| class="wikitable" border="1"
+
 
 +
'''0xF001:''' Flags was > 1
 +
 
 +
'''0xF201:''' IRQ above 0x3FF or outside the [[NPDM#Kernel_Access_Control|IRQ access mask]] was given.
 +
 
 +
'''0xCE01:''' A SlabHeap was exhausted (too many interrupts created).
 +
 
 +
'''0xF401:''' IRQ already has an event registered.
 +
 
 +
'''0xD201:''' The handle table is full. Try closing some handles.
 +
 
 +
 
 +
== svcQueryPhysicalAddress ==
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument || Type || Name
 +
|-
 +
| (In) X1 || u64 || Addr
 +
|-
 +
| (Out) W0 || [[#Result]]|| Ret
 +
|-
 +
| (Out) X1 || u64 || PhysAddr
 +
|-
 +
| (Out) X2 || u64 || KernelAddr
 +
|-
 +
| (Out) X3 || u64 || Size
 +
|}
 +
</div>
 +
 
 +
== svcQueryIoMapping ==
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 
|-
 
|-
 
! Argument || Type || Name
 
! Argument || Type || Name
Line 1,227: Line 1,279:     
'''Description:''' Unmaps an attached device address space from an userspace address.
 
'''Description:''' Unmaps an attached device address space from an userspace address.
 +
 +
== svcContinueDebugEvent ==
 +
 +
=== Result codes ===
 +
 +
'''0x0:''' Success. The process has been resumed.
 +
 +
'''0xe401:''' Invalid debug handle.
 +
 +
'''0xf401:''' Process has debug events queued.
    
== svcGetSystemInfo ==
 
== svcGetSystemInfo ==
Line 1,411: Line 1,473:  
| (In) X1 || [[#CreateProcessInfo]]* || InfoPtr
 
| (In) X1 || [[#CreateProcessInfo]]* || InfoPtr
 
|-
 
|-
| (In) X2 || u64 || CapabilitiesPtr
+
| (In) X2 || u32* || CapabilitiesPtr
 
|-
 
|-
 
| (In) X3 || u64 || CapabilitiesNum
 
| (In) X3 || u64 || CapabilitiesNum
Line 1,422: Line 1,484:     
Takes a [[#CreateProcessInfo]] as input.
 
Takes a [[#CreateProcessInfo]] as input.
 +
CapabilitiesPtr points to an array of [[NPDM#Kernel_Access_Control|kernel capabilities]].
 +
CapabilitiesNum is a number of capabilities in the CapabilitiesPtr array (number of element, not number of bytes).
 +
 +
=== Result codes ===
 +
 +
'''0x0:''' Success.
 +
 +
'''0xCA01:''' Attempted to map more code pages than available in address space.
 +
 +
'''0xCC01:''' Provided CodeAddr is invalid (make sure it's in range?)
 +
 +
'''0xE401:''' The resource handle passed is invalid.
 +
 +
'''0xE601:''' Attempt to copy procinfo from user-supplied pointer failed. Attempt to copy capabilities_num from user-supplied pointer failed.
 +
 +
'''0xE801:''' Attempted to create a 32-bit process with a 36-bit address space.
 +
 +
'''0xF001:''' Unused bits are set in mmuflags. Unknown address space type used.
    
== svcGetProcessInfo ==
 
== svcGetProcessInfo ==
Line 1,670: Line 1,750:  
| 0 || 12 || || ProcessName (doesn't have to be null-terminated)
 
| 0 || 12 || || ProcessName (doesn't have to be null-terminated)
 
|-
 
|-
| 0 || 4 || || ProcessCategory (0: regular title, 1: kernel built-in)
+
| 0x0C || 4 || || ProcessCategory (0: regular title, 1: kernel built-in)
 
|-
 
|-
 
| 0x10 || 8 || || TitleId
 
| 0x10 || 8 || || TitleId
Line 1,694: Line 1,774:  
| || || Bit10-7 || [5.0.0+] PoolPartition (0=Application, 1=Applet, 2=Sysmodule, 3=Nvservices)
 
| || || Bit10-7 || [5.0.0+] PoolPartition (0=Application, 1=Applet, 2=Sysmodule, 3=Nvservices)
 
|-
 
|-
| 0x28 || 4 || || ResourceLimitHandle
+
| || || Bit11 || [7.0.0+] Only allowed in combination with bit6.
 +
|-
 +
| 0x28 || 4 || || ResourceLimitHandle or zero
 
|-
 
|-
 
| 0x2C || 4 || || [3.0.0+] PersonalMmHeapNumPages
 
| 0x2C || 4 || || [3.0.0+] PersonalMmHeapNumPages
Line 1,704: Line 1,786:     
On [5.0.0] PoolPartition is specified in CreateProcessArgs. There are now 4 pool partitions.
 
On [5.0.0] PoolPartition is specified in CreateProcessArgs. There are now 4 pool partitions.
 +
 +
On [5.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory.
 +
 +
The PersonalMmHeap are allocated as follows:
 +
* For the application, normal insecure pool is used. Carveout 5 is used to provide protection.
 +
* For the applet, a pre-allocated secure pool segment of size 0x400000 is used.
 +
* For sysmodules, secure pool is allocated.
    
=== AddressSpaceType ===
 
=== AddressSpaceType ===

Navigation menu