Changes

Jump to navigation Jump to search
5,943 bytes added ,  23:46, 18 August 2019
CreateDeviceAddressSpace 32-bit regs
Line 19: Line 19:  
|  0x7 || [[#svcExitProcess]] || None ||
 
|  0x7 || [[#svcExitProcess]] || None ||
 
|-
 
|-
|  0x8 || [[#svcCreateThread]] || X1=entry, X2=thread_context, X3=stacktop, W4=prio, W5=processor_id || W0=result, W1=handle
+
|  0x8 || [[#svcCreateThread]] || X1=entry, X2=thread_context, X3=stacktop, W4=prio, W5=processor_id
 +
R0=prio, R1=entry, R2=thread_context, R3=stacktop, R4=processor_id
 +
|| W0=result, W1=handle
 
|-
 
|-
 
|  0x9 || [[#svcStartThread]] || W0=thread_handle || W0=result
 
|  0x9 || [[#svcStartThread]] || W0=thread_handle || W0=result
Line 25: Line 27:  
|  0xA || [[#svcExitThread]] || None ||                                                         
 
|  0xA || [[#svcExitThread]] || None ||                                                         
 
|-
 
|-
|  0xB || [[#svcSleepThread]] || X0=nano ||
+
|  0xB || [[#svcSleepThread]] || X0=nano
 +
R0=nano_lower32, R1=lower_upper32
 +
||
 
|-
 
|-
 
|  0xC || [[#svcGetThreadPriority]] || W1=thread_handle || W0=result, W1=prio
 
|  0xC || [[#svcGetThreadPriority]] || W1=thread_handle || W0=result, W1=prio
Line 31: Line 35:  
|  0xD || [[#svcSetThreadPriority]] || W0=thread_handle, W1=prio || W0=result
 
|  0xD || [[#svcSetThreadPriority]] || W0=thread_handle, W1=prio || W0=result
 
|-
 
|-
|  0xE || [[#svcGetThreadCoreMask]] || W2=thread_handle || W0=result, W1=out, X2=out
+
|  0xE || [[#svcGetThreadCoreMask]] || W2=thread_handle || W0=result, W1=out0, X2=out1
 +
R0=result, R1=out0, R2=out1_lower32, R3=out1_upper32
 
|-
 
|-
|  0xF || [[#svcSetThreadCoreMask]] || W0=thread_handle, W1=in, X2=in2 || W0=result
+
|  0xF || [[#svcSetThreadCoreMask]] || W0=thread_handle, W1=in, X2=in2
 +
R0=thread_handle, R1=in, R2=in2_lower32, R3=in2_upper32
 +
|| W0=result
 
|-
 
|-
 
| 0x10 || [[#svcGetCurrentProcessorNumber]] || None || W0/X0=cpuid
 
| 0x10 || [[#svcGetCurrentProcessorNumber]] || None || W0/X0=cpuid
Line 51: Line 58:  
| 0x17 || svcResetSignal || W0=revent_or_process_handle || W0=result
 
| 0x17 || svcResetSignal || W0=revent_or_process_handle || W0=result
 
|-
 
|-
| 0x18 || [[#svcWaitSynchronization]] || X1=handles_ptr, W2=num_handles. X3=timeout || W0=result, W1=handle_idx
+
| 0x18 || [[#svcWaitSynchronization]] || X1=handles_ptr, W2=num_handles, X3=timeout
 +
R0=timeout_lower32, R1=handles_ptr, R2=num_handles, R3=timeout_upper32
 +
|| W0=result, W1=handle_idx
 
|-
 
|-
 
| 0x19 || [[#svcCancelSynchronization]] || W0=thread_handle || W0=result
 
| 0x19 || [[#svcCancelSynchronization]] || W0=thread_handle || W0=result
Line 59: Line 68:  
| 0x1B || svcArbitrateUnlock || X0=ptr ||
 
| 0x1B || svcArbitrateUnlock || X0=ptr ||
 
|-
 
|-
| 0x1C || svcWaitProcessWideKeyAtomic || X0=ptr0, X1=ptr, W2=thread_handle, X3=timeout || W0=result
+
| 0x1C || svcWaitProcessWideKeyAtomic || X0=ptr0, X1=ptr, W2=thread_handle, X3=timeout
 +
R0=ptr0, R1=ptr, R2=thread_handle, R3=timeout_lower32, R4=timeout_upper32
 +
|| W0=result
 
|-
 
|-
 
| 0x1D || svcSignalProcessWideKey || X0=ptr, W1=value || W0=result
 
| 0x1D || svcSignalProcessWideKey || X0=ptr, W1=value || W0=result
 
|-
 
|-
 
| 0x1E || [[#svcGetSystemTick]] || None || X0={value of cntpct_el0}
 
| 0x1E || [[#svcGetSystemTick]] || None || X0={value of cntpct_el0}
 +
R0=cntpct_el0_lower32, R1=cntpct_el0_upper32
 
|-
 
|-
 
| 0x1F || svcConnectToNamedPort || X1=port_name_str || W0=result, W1=handle
 
| 0x1F || svcConnectToNamedPort || X1=port_name_str || W0=result, W1=handle
Line 76: Line 88:  
|-
 
|-
 
| 0x24 || svcGetProcessId || W1=thread_or_process_or_debug_handle || W0=result, X1=pid
 
| 0x24 || svcGetProcessId || W1=thread_or_process_or_debug_handle || W0=result, X1=pid
 +
R0=result, R1=pid_lower32, R2=pid_upper32
 
|-
 
|-
 
| 0x25 || svcGetThreadId || W1=thread_handle || W0=result, X1=out
 
| 0x25 || svcGetThreadId || W1=thread_handle || W0=result, X1=out
 +
R0=result, R1=out_lower32, R2=out_upper32
 
|-
 
|-
 
| 0x26 || [[#svcBreak]] || X0=break_reason,X1,X2=info || W0=result = 0
 
| 0x26 || [[#svcBreak]] || X0=break_reason,X1,X2=info || W0=result = 0
Line 85: Line 99:  
| 0x28 || svcReturnFromException || X0=result ||  
 
| 0x28 || svcReturnFromException || X0=result ||  
 
|-
 
|-
| 0x29 || [[#svcGetInfo]] || X1=info_id, X2=handle, X3=info_sub_id || W0=result, X1=out
+
| 0x29 || [[#svcGetInfo]] || W1=info_id, X2=handle, X3=info_sub_id
 +
R0=info_sub_id_lower32, R1=info_id, R2=handle, R3=info_sub_id_upper32
 +
|| W0=result, X1=out
 +
R0=result, R1=out_lower32, R2=out_upper32
 
|-
 
|-
 
| 0x2A || svcFlushEntireDataCache || None || None
 
| 0x2A || svcFlushEntireDataCache || None || None
Line 95: Line 112:  
| 0x2D || [3.0.0+] svcUnmapPhysicalMemory || X0=addr, X1=size || W0=result
 
| 0x2D || [3.0.0+] svcUnmapPhysicalMemory || X0=addr, X1=size || W0=result
 
|-
 
|-
| 0x2E || [5.0.0+] svcGetFutureThreadInfo || X3=timeout || W0=result, bunch of crap
+
| 0x2E || [5.0.0+] svcGetFutureThreadInfo || X3=timeout
 +
R0=timeout_lower32, R1=timeout_upper32
 +
|| W0=result, bunch of crap
 
|-
 
|-
 
| 0x2F || svcGetLastThreadInfo || None || W0=result, W1,W2,W3,W4=unk, W5=truncated_u64, W6=bool
 
| 0x2F || svcGetLastThreadInfo || None || W0=result, W1,W2,W3,W4=unk, W5=truncated_u64, W6=bool
 
|-
 
|-
 
| 0x30 || svcGetResourceLimitLimitValue || W1=reslimit_handle, W2=[[#LimitableResource]] || W0=result, X1=value
 
| 0x30 || svcGetResourceLimitLimitValue || W1=reslimit_handle, W2=[[#LimitableResource]] || W0=result, X1=value
 +
R0=result, R1=value_lower32, R2=value_upper32
 
|-
 
|-
 
| 0x31 || svcGetResourceLimitCurrentValue || W1=reslimit_handle, W2=[[#LimitableResource]] || W0=result, X1=value
 
| 0x31 || svcGetResourceLimitCurrentValue || W1=reslimit_handle, W2=[[#LimitableResource]] || W0=result, X1=value
 +
R0=result, R1=value_lower32, R2=value_upper32
 
|-
 
|-
 
| 0x32 || svcSetThreadActivity || W0=thread_handle, W1=bool || W0=result
 
| 0x32 || svcSetThreadActivity || W0=thread_handle, W1=bool || W0=result
Line 107: Line 128:  
| 0x33 || svcGetThreadContext3 || X0=[[#ThreadContext]]*, W1=thread_handle || W0=result
 
| 0x33 || svcGetThreadContext3 || X0=[[#ThreadContext]]*, W1=thread_handle || W0=result
 
|-
 
|-
| 0x34 || [4.0.0+] svcWaitForAddress || X0=ptr, W1=[[#ArbitrationType]], X2=value X3=timeout ||
+
| 0x34 || [4.0.0+] svcWaitForAddress || X0=ptr, W1=[[#ArbitrationType]], X2=value, X3=timeout
 +
R0=ptr, R1=[[#ArbitrationType]], R2=value, R3=timeout_lower32, R4=timeout_upper32
 +
||
 +
|-
 +
| 0x35 || [4.0.0+] svcSignalToAddress || X0=ptr, W1=[[#SignalType]], X2=value, W3=num_to_signal ||
 
|-
 
|-
| 0x35 || [4.0.0+] svcSignalToAddress || X0=ptr, W1=[[#SignalType]], X2=value W3=num_to_signal ||
+
| 0x36 || [8.0.0+] svcSynchronizePreemptionState || None || W0=result
 
|- style="border-top: double"
 
|- style="border-top: double"
 
| 0x3C || [[#svcDumpInfo]] || ||
 
| 0x3C || [[#svcDumpInfo]] || ||
Line 115: Line 140:  
| 0x3D || [4.0.0+] svcDumpInfoNew || ||
 
| 0x3D || [4.0.0+] svcDumpInfoNew || ||
 
|- style="border-top: double"
 
|- style="border-top: double"
| 0x40 || svcCreateSession || W2=is_light, X3=? || W0=result, W1=server_handle, W2=client_handle
+
| 0x40 || svcCreateSession || W2=is_light, X3=name_ptr || W0=result, W1=server_handle, W2=client_handle
 
|-
 
|-
 
| 0x41 || [[#svcAcceptSession]] || W1=port_handle || W0=result, W1=session_handle
 
| 0x41 || [[#svcAcceptSession]] || W1=port_handle || W0=result, W1=session_handle
Line 121: Line 146:  
| 0x42 || svcReplyAndReceiveLight || W0=light_session_handle || W0=result, W1,W2,W3,W4,W5,W6,W7=out
 
| 0x42 || svcReplyAndReceiveLight || W0=light_session_handle || W0=result, W1,W2,W3,W4,W5,W6,W7=out
 
|-
 
|-
| 0x43 || [[#svcReplyAndReceive]] || X1=ptr_handles, W2=num_handles, X3=replytarget_handle(0=none), X4=timeout || W0=result, W1=handle_idx
+
| 0x43 || [[#svcReplyAndReceive]] || X1=ptr_handles, W2=num_handles, X3=replytarget_handle(0=none), X4=timeout
 +
R0=timeout_lower32, R1=ptr_handles, R2=num_handles, R3=replytarget_handle(0=none), R4=timeout_upper32
 +
|| W0=result, W1=handle_idx
 
|-
 
|-
| 0x44 || svcReplyAndReceiveWithUserBuffer|| X1=buf, X2=sz, X3=ptr_handles, W4=num_handles, X5=replytarget_handle(0=none), X6=timeout || W0=result, W1=handle_idx
+
| 0x44 || svcReplyAndReceiveWithUserBuffer|| X1=buf, X2=sz, X3=ptr_handles, W4=num_handles, X5=replytarget_handle(0=none), X6=timeout
 +
R0=num_handles, R1=buf, R2=sz, R3=ptr_handles, R4=replytarget_handle(0=none), R5=timeout_lower32, R6=timeout_upper32
 +
|| W0=result, W1=handle_idx
 
|-
 
|-
 
| 0x45 || svcCreateEvent || None || W0=result, W1=wevent_handle, W2=revent_handle
 
| 0x45 || svcCreateEvent || None || W0=result, W1=wevent_handle, W2=revent_handle
Line 135: Line 164:  
| 0x4B || [4.0.0+] [[#svcCreateCodeMemory]] || X1=addr, X2=size || W0=result, W1=code_memory_handle
 
| 0x4B || [4.0.0+] [[#svcCreateCodeMemory]] || X1=addr, X2=size || W0=result, W1=code_memory_handle
 
|-
 
|-
| 0x4C || [4.0.0+] [[#svcControlCodeMemory]] || W0=code_memory_handle, W1=[[#CodeMemoryOperation]], X2=dstaddr, X3=size, W4=perm || W0=result
+
| 0x4C || [4.0.0+] [[#svcControlCodeMemory]] || W0=code_memory_handle, W1=[[#CodeMemoryOperation]], X2=dstaddr, X3=size, W4=perm
 +
R0=code_memory_handle, R1=[[#CodeMemoryOperation]], R2=dstaddr_lower32, R3=dstaddr_upper32, R4=size_lower32, R5=size_upper32, R6=perm
 +
|| W0=result
 
|-
 
|-
 
| 0x4D || svcSleepSystem || None || None
 
| 0x4D || svcSleepSystem || None || None
 
|-
 
|-
| 0x4E || [[#svcReadWriteRegister]] || X1=reg_addr, W2=rw_mask, W3=in_val || W0=result, W1=out_val
+
| 0x4E || [[#svcReadWriteRegister]] || X1=reg_addr, W2=rw_mask, W3=in_val
 +
R0=rw_mask, R1=in_val, R2=reg_addr_lower32, R3=reg_addr_upper32
 +
|| W0=result, W1=out_val
 
|-
 
|-
 
| 0x4F || svcSetProcessActivity || W0=process_handle, W1=bool || W0=result
 
| 0x4F || svcSetProcessActivity || W0=process_handle, W1=bool || W0=result
Line 149: Line 182:  
| 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
 
|-
 
|-
| 0x55 || [[#svcQueryIoMapping]] || X1=physaddr, X2=size || W0=result, X1=virtaddr
+
| 0x55 || [[#svcQueryIoMapping]] || X1=physaddr, X2=size
 +
R0=size, R2=physaddr_lower32, R3=physaddr_upper32
 +
|| W0=result, X1=virtaddr
 
|-
 
|-
| 0x56 || [[#svcCreateDeviceAddressSpace]] || X1=dev_as_start_addr, X2=dev_as_end_addr || W0=result, W1=dev_as_handle
+
| 0x56 || [[#svcCreateDeviceAddressSpace]] || X1=dev_as_start_addr, X2=dev_as_end_addr
 +
R0=dev_as_end_addr_lower32, R1=dev_as_end_addr_upper32, R2=dev_as_start_addr_lower32, R3=dev_as_start_addr_upper32
 +
|| W0=result, W1=dev_as_handle
 
|-
 
|-
 
| 0x57 || [[#svcAttachDeviceAddressSpace]] || W0=device, X1=dev_as_handle || W0=result
 
| 0x57 || [[#svcAttachDeviceAddressSpace]] || W0=device, X1=dev_as_handle || W0=result
Line 183: Line 220:  
| 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 230:  
| 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 207: Line 244:  
| 0x6F || [5.0.0+] [[#svcGetSystemInfo]] || X1=info_id, X2=handle, X3=info_sub_id || W0=result, X1=out
 
| 0x6F || [5.0.0+] [[#svcGetSystemInfo]] || X1=info_id, X2=handle, X3=info_sub_id || W0=result, X1=out
 
|-
 
|-
| 0x70 || svcCreatePort || W2=max_sessions, W3=is_light, X4=name_ptr || W0=result, W1=clientport_handle, W2=serverport_handle
+
| 0x70 || svcCreatePort || W2=max_sessions, W3=is_light, X4=name_ptr || W0=result, W1=serverport_handle, W2=clientport_handle
 
|-
 
|-
 
| 0x71 || svcManageNamedPort || X1=name_ptr, W2=max_sessions || W0=result, W1=serverport_handle
 
| 0x71 || svcManageNamedPort || X1=name_ptr, W2=max_sessions || W0=result, W1=serverport_handle
Line 237: Line 274:  
| 0x7E || svcSetResourceLimitLimitValue || W0=reslimit_handle, W1=[[#LimitableResource]], X2=value || W0=result
 
| 0x7E || svcSetResourceLimitLimitValue || W0=reslimit_handle, W1=[[#LimitableResource]], X2=value || W0=result
 
|-
 
|-
| 0x7F || svcCallSecureMonitor || X0=smc_sub_id, X1,X2,X3,X4,X5,X6,X7=smc_args || X0,X1,X2,X3,X4,X5,X6,X7=result
+
| 0x7F || [[#svcCallSecureMonitor]] || X0=smc_sub_id, X1,X2,X3,X4,X5,X6,X7=smc_args || X0,X1,X2,X3,X4,X5,X6,X7=result
 
|}
 
|}
   Line 419: Line 456:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X1 || void(*)(void*) || Entry
+
| (In) X1 || R1 || void(*)(void*) || Entry
 
|-
 
|-
| (In) X2 || void* || ThreadContext
+
| (In) X2 || R2 || void* || ThreadContext
 
|-
 
|-
| (In) X3 || void* || StackTop
+
| (In) X3 || R3 || void* || StackTop
 
|-
 
|-
| (In) W4 || u32 || Priority
+
| (In) W4 || R0 || u32 || Priority
 
|-
 
|-
| (In) W5 || u32 || ProcessorId
+
| (In) W5 || R4 || u32 || ProcessorId
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || Handle<Thread> || Handle
+
| (Out) W1 || R1 || Handle<Thread> || Handle
 
|}
 
|}
 
</div>
 
</div>
Line 476: Line 513:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X0 || s64 || Nanoseconds
+
| (In) X0 || R0, R1 || s64 || Nanoseconds
 
|-
 
|-
 
|}
 
|}
Line 542: Line 579:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W2 || Handle<Thread> || Handle
+
| (In) W2 || R2 || Handle<Thread> || Handle
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || u32 || Out0
+
| (Out) W1 || R1 || u32 || Out0
 
|-
 
|-
| (Out) X2 || u64 || Out1
+
| (Out) X2 || R2, R3 || u64 || Out1
 
|}
 
|}
 
</div>
 
</div>
Line 561: Line 598:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<Thread> || Handle
+
| (In) W0 || R0 || Handle<Thread> || Handle
 
|-
 
|-
| (In) W1 || u32 || In0
+
| (In) W1 || R1 || u32 || In0
 
|-
 
|-
| (In) X2 || u64 || In1
+
| (In) X2 || R2, R3 || u64 || In1
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 645: Line 682:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X1 || Handle* || HandlesPtr
+
| (In) X1 || R1 || Handle* || HandlesPtr
 
|-
 
|-
| (In) W2 || u64 || HandlesNum
+
| (In) W2 || R2 || u64 || HandlesNum
 
|-
 
|-
| (In) X3 || u64 || Timeout
+
| (In) X3 || R0, R3 || u64 || Timeout
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || u64 || HandleIndex
+
| (Out) W1 || R1 || u64 || HandleIndex
 
|}
 
|}
 
</div>
 
</div>
   
Works with num_handles <= 0x40.
 
Works with num_handles <= 0x40.
   Line 726: Line 762:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (Out) X0 || u64 || Ticks
+
| (Out) X0 || R0, R1 || u64 || Ticks
 
|}
 
|}
 
</div>
 
</div>
Line 799: Line 835:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) X1 || u64 || InfoId
+
| (In) W1 || u32 || InfoId
 
|-
 
|-
 
| (In) W2 || Handle || Handle
 
| (In) W2 || Handle || Handle
Line 810: Line 846:  
|}
 
|}
 
</div>
 
</div>
 
+
<div style="display: inline-block; vertical-align:top;">
{| class=wikitable
+
{| class="wikitable" border="1"
! Handle type || Id0 || Id1 || Description
   
|-
 
|-
| Process || 0 || 0 || AllowedCpuIdBitmask
+
! Argument || Type || Name
 
|-
 
|-
| Process || 1 || 0 || AllowedThreadPrioBitmask
+
| (In) R0 || u32 || InfoSubIdLower32
 
|-
 
|-
| Process || 2 || 0 || AliasRegionBaseAddr
+
| (In) R1 || u32 || InfoId
 
|-
 
|-
| Process || 3 || 0 || AliasRegionSize
+
| (In) R2 || Handle || Handle
 
|-
 
|-
| Process || 4 || 0 || HeapRegionBaseAddr
+
| (In) R3 || u32 || InfoSubIdUpper32
 
|-
 
|-
| Process || 5 || 0 || HeapRegionSize
+
| (Out) R0 || [[#Result]] || Ret
 
|-
 
|-
| Process || 6 || 0 || TotalMemoryAvailable. Total memory available(free+used).
+
| (Out) R1 || u32 || OutLower32
 +
|-
 +
| (Out) R2 || u32 || OutUpper32
 +
|}
 +
</div>
 +
 
 +
 
 +
{| class=wikitable
 +
! Handle type || Id0 || Id1 || Description
 +
|-
 +
| Process || 0 || 0 || AllowedCpuIdBitmask
 +
|-
 +
| Process || 1 || 0 || AllowedThreadPrioBitmask
 +
|-
 +
| Process || 2 || 0 || AliasRegionBaseAddr
 +
|-
 +
| Process || 3 || 0 || AliasRegionSize
 +
|-
 +
| Process || 4 || 0 || HeapRegionBaseAddr
 +
|-
 +
| Process || 5 || 0 || HeapRegionSize
 +
|-
 +
| Process || 6 || 0 || TotalMemoryAvailable. Total memory available(free+used).
 
|-
 
|-
 
| Process || 7 || 0 || TotalMemoryUsage. Total used size of codebin memory + main-thread stack + allocated heap.
 
| Process || 7 || 0 || TotalMemoryUsage. Total used size of codebin memory + main-thread stack + allocated heap.
Line 858: Line 915:  
| 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-3, -1 || Thread Ticks. When 0-3 are passed, gets specific core CPU ticks spent on thread. When -1 is passed, gets total CPU ticks spent on thread.
 
|}
 
|}
   Line 905: Line 966:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W1 || *Handle<Port or ServerSession> || Handles
+
| (In) W1 || R1 || *Handle<Port or ServerSession> || Handles
 
|-
 
|-
| (In) W2 || u32 || NumHandles
+
| (In) W2 || R2 || u32 || NumHandles
 
|-
 
|-
| (In) W3 || Handle<ServerSession> || ReplyTarget
+
| (In) W3 || R3 || Handle<ServerSession> || ReplyTarget
 
|-
 
|-
| (In) X4 || u64 (nanoseconds) || Timeout
+
| (In) X4 || R0, R4 || u64 (nanoseconds) || Timeout
 
|-
 
|-
| (Out) W0 || [[#Result]] || Result
+
| (Out) W0 || R0 || [[#Result]] || Result
 
|-
 
|-
| (Out) W1 || u32 || HandleIndex
+
| (Out) W1 || R1 || u32 || HandleIndex
 
|}
 
|}
 
</div>
 
</div>
Line 963: Line 1,024:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X1 || u64 || RegAddr
+
| (In) X1 || R2, R3 || u64 || RegAddr
 
|-
 
|-
| (In) W2 || u64 || RwMask
+
| (In) W2 || R0 || u64 || RwMask
 
|-
 
|-
| (In) W3 || u64 || InValue
+
| (In) W3 || R1 || u64 || InValue
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1|| u64 || OutValue
+
| (Out) W1 || R1 || u64 || OutValue
 
|}
 
|}
 
</div>
 
</div>
Line 1,069: Line 1,130:  
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;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument || Type || Name
 +
|-
 +
| (In) X1 || u64 || IrqNum
 +
|-
 +
| (In) W2 || bool || Flags
 +
|-
 +
| (Out) W0 || [[#Result]] || Ret
 +
|-
 +
| (Out) W1 || Handle<ReadableEvent> || ReadableEventHandle
 +
|}
 +
</div>
 +
 
 +
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 ===
 +
 
 +
'''0x0:''' Success.
 +
 
 +
'''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;">
 
<div style="display: inline-block;">
Line 1,093: Line 1,189:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X1 || u64 || PhysAddr
+
| (In) X1 || R2, R3 || u64 || PhysAddr
 
|-
 
|-
| (In) X2 || u64 || Size
+
| (In) X2 || R0 || u64 || Size
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) X1 || void* || VirtAddr
+
| (Out) X1 || R1 || void* || VirtAddr
 
|}
 
|}
 
</div>
 
</div>
Line 1,112: Line 1,208:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X1 || u64 || StartAddr
+
| (In) X1 || R2, R3 || u64 || StartAddr
 
|-
 
|-
| (In) X2 || u64 || EndAddr
+
| (In) X2 || R0, R1 || u64 || EndAddr
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || Handle<DeviceAddressSpace> || AddressSpaceHandle
+
| (Out) W1 || R1 || Handle<DeviceAddressSpace> || AddressSpaceHandle
 
|}
 
|}
 
</div>
 
</div>
Line 1,240: Line 1,336:     
'''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 or is already running.
    
== svcGetSystemInfo ==
 
== svcGetSystemInfo ==
Line 1,470: Line 1,576:     
Returns an enum with value 0-7.
 
Returns an enum with value 0-7.
 +
 +
== svcCallSecureMonitor ==
 +
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument || Type || Name
 +
|-
 +
| (In) X0 || u64 || [[SMC#ID_0|Function ID]]
 +
|-
 +
| (In) X1-X7 || u64 || SMC sub-arguments
 +
|-
 +
| (Out) X0 || [[SMC#Errors|SMC Result]] || Result of SMC
 +
|-
 +
| (Out) X1-X7 || u64 || SMC sub-output
 +
|}
 +
</div>
 +
 +
Takes in a SMC function ID in X0, and arguments for that SMC function in X1-X7.
 +
 +
Passing an invalid SMC function ID or calling from a core other than core 3 will result in a secure monitor panic.
 +
 +
The kernel parses bits 9-15 in the passed SMC function ID (per the ARM SMC calling convention), and when set uses as an indicator to translate a pointer in the associated register (X1-X7) to a physical address. The kernel will translate any address mapped as R-W, other addresses (R--, R-X, or invalid pointers) will be translated as 0/NULL.
 +
 +
Output is returned raw from the Secure Monitor; X0 will be the untranslated SMC result and X1-X7 will contain other SMC output (or be unchanged, depending on the SMC).
    
== Debugging ==
 
== Debugging ==
Line 1,512: Line 1,643:     
= Enum/Structures =
 
= Enum/Structures =
== ThreadContextRequestFlags ==
+
== ThreadContextFlags ==
 
Bitfield of one of more of these:
 
Bitfield of one of more of these:
    
{| class=wikitable
 
{| class=wikitable
! Bit || Bitmask || Name
+
! Bit || Bitmask || Name || Description
 
|-
 
|-
| 0 || 1 || NormalContext
+
| 0 || 1 || General-purpose registers || If in 64-bit mode, GPRs 0–28 will be read/written. If in 32-bit mode, GPRs 0–12 will be read/written.
 
|-
 
|-
| 1 || 2 ||
+
| 1 || 2 || Control registers || Reads/writes the FP, LR, PC, SP, PSTATE, and TPIDR registers.
 
|-
 
|-
| 2 || 4 ||
+
| 2 || 4 || Floating-point registers || Reads/writes the floating-point vector registers.
 
|-
 
|-
| 3 || 8 ||
+
| 3 || 8 || Floating-point control registers || Reads/writes the FPCR and FPSR registers.
 
|}
 
|}
 +
    
== DeviceName ==
 
== DeviceName ==
Line 1,626: Line 1,758:  
== LimitableResource ==
 
== LimitableResource ==
 
{| class=wikitable
 
{| class=wikitable
! Value || Name
+
! Value || Name || Note
 
|-
 
|-
| 0 || LimitableResource_Memory
+
| 0 || LimitableResource_Memory || Bytes of memory a process may allocate.
 
|-
 
|-
| 1 || LimitableResource_Threads
+
| 1 || LimitableResource_Threads || Amount of threads a process can create.
 
|-
 
|-
| 2 || LimitableResource_Events
+
| 2 || LimitableResource_Events || Amount of events a process can create through svcCreateEvent or svcSendAsyncRequestWithUserBuffer.
 
|-
 
|-
| 3 || LimitableResource_TransferMemories
+
| 3 || LimitableResource_TransferMemories || Amount of TransferMemory a process can create through svcCreateTransferMemory.
 
|-
 
|-
| 4 || LimitableResource_Sessions
+
| 4 || LimitableResource_Sessions || Amount of session a process can create through svcCreateSession, svcConnectToPort or svcConnectToNamedPort.
 
|}
 
|}
   Line 1,709: Line 1,841:  
| 0x20 || 4 || || CodeNumPages
 
| 0x20 || 4 || || CodeNumPages
 
|-
 
|-
| 0x24 || 4 || || MmuFlags
+
| 0x24 || 4 || || Flags
 
|-
 
|-
 
| || || Bit0 || IsAarch64
 
| || || Bit0 || IsAarch64
Line 1,719: Line 1,851:  
| || || Bit5 || EnableAslr
 
| || || Bit5 || EnableAslr
 
|-
 
|-
| || || Bit6 || UseSystemMemBlocks
+
| || || Bit6 || IsApplication
 
|-
 
|-
| || || Bit7 || [4.0.0] ?
+
| || || Bit7 || [4.0.0] UseSecureMemory
 
|-
 
|-
 
| || || 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)
 +
|-
 +
| || || Bit11 || [7.0.0+] OptimizeMemoryAllocation (Only allowed in combination with IsApplication).
 
|-
 
|-
 
| 0x28 || 4 || || ResourceLimitHandle or zero
 
| 0x28 || 4 || || ResourceLimitHandle or zero
 
|-
 
|-
| 0x2C || 4 || || [3.0.0+] PersonalMmHeapNumPages
+
| 0x2C || 4 || || [3.0.0+] SystemResourceNumPages
 
|}
 
|}
   Line 1,736: Line 1,870:  
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 [6.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory.
+
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 ===
Line 1,774: Line 1,913:  
== MemoryAttribute ==
 
== MemoryAttribute ==
 
{| class=wikitable
 
{| class=wikitable
! Bits || Description
+
! Bits || Name || Description
 
|-
 
|-
| 0 || IsBorrowed
+
| 0 || IsBorrowed || Used by MapMemory, as an async IPC user buffer,
 
|-
 
|-
| 1 || IsIpcMapped: when IpcRefCount > 0.
+
| 1 || IsIpcLocked || True when IpcRefCount > 0
 
|-
 
|-
| 2 || IsDeviceMapped: when DeviceRefCount > 0.
+
| 2 || IsDeviceShared || True when DeviceRefCount > 0
 
|-
 
|-
| 3 || IsUncached
+
| 3 || IsUncached ||
 
|}
 
|}
   Line 1,795: Line 1,934:  
| 9 || ForceReadWritableByDebugSyscalls
 
| 9 || ForceReadWritableByDebugSyscalls
 
|-
 
|-
| 10 || IpcSendAllowed_Type0
+
| 10 || IpcSendAllowed
 
|-
 
|-
| 11 || IpcSendAllowed_Type3
+
| 11 || NonDeviceIpcSendAllowed
 
|-
 
|-
| 12 || IpcSendAllowed_Type1
+
| 12 || NonSecureIpcSendAllowed
 
|-
 
|-
 
| 14 || [[#svcSetProcessMemoryPermission|ProcessPermissionChangeAllowed]]
 
| 14 || [[#svcSetProcessMemoryPermission|ProcessPermissionChangeAllowed]]
Line 1,869: Line 2,008:  
|| MemoryType_ModuleCodeMutable || Transition from 0xDD7E08 performed by [[#svcSetProcessMemoryPermission]].
 
|| MemoryType_ModuleCodeMutable || Transition from 0xDD7E08 performed by [[#svcSetProcessMemoryPermission]].
 
|-
 
|-
| 0x005C3C0A || [[IPC_Marshalling|MemoryType_IpcBuffer0]] || IPC buffers with descriptor flags=0.
+
| 0x005C3C0A || [[IPC_Marshalling|MemoryType_Ipc]] || IPC buffers with descriptor flags=0.
 
|-
 
|-
 
| 0x005C3C0B || MemoryType_Stack || Mapped using [[#svcMapMemory]].
 
| 0x005C3C0B || MemoryType_Stack || Mapped using [[#svcMapMemory]].
Line 1,883: Line 2,022:  
| 0x00000010 || MemoryType_Reserved ||
 
| 0x00000010 || MemoryType_Reserved ||
 
|-
 
|-
| 0x005C3811 || [[IPC_Marshalling|MemoryType_IpcBuffer1]] || IPC buffers with descriptor flags=1.
+
| 0x005C3811 || [[IPC_Marshalling|MemoryType_NonSecureIpc]] || IPC buffers with descriptor flags=1.
 
|-
 
|-
| 0x004C2812 || [[IPC_Marshalling|MemoryType_IpcBuffer3]] || IPC buffers with descriptor flags=3.
+
| 0x004C2812 || [[IPC_Marshalling|MemoryType_NonDeviceIpc]] || IPC buffers with descriptor flags=3.
 
|-
 
|-
 
| 0x00002013 || MemoryType_KernelStack || Mapped in kernel during [[#svcCreateThread]].
 
| 0x00002013 || MemoryType_KernelStack || Mapped in kernel during [[#svcCreateThread]].
151

edits

Navigation menu