Changes

Jump to navigation Jump to search
8,519 bytes added ,  10:03, 2 October 2019
We were lied to. Based on 5.0.0 info.
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 42: Line 44:  
| 0x10 || [[#svcGetCurrentProcessorNumber]] || None || W0/X0=cpuid
 
| 0x10 || [[#svcGetCurrentProcessorNumber]] || None || W0/X0=cpuid
 
|-
 
|-
| 0x11 || svcSignalEvent || W0=wevent_handle || W0=result
+
| 0x11 || [[#svcSignalEvent]] || W0=wevent_handle || W0=result
 
|-
 
|-
| 0x12 || svcClearEvent || W0=wevent_or_revent_handle || W0=result
+
| 0x12 || [[#svcClearEvent]] || W0=wevent_or_revent_handle || W0=result
 
|-
 
|-
 
| 0x13 || [[#svcMapSharedMemory]] || W0=shmem_handle, X1=addr, X2=size, W3=perm || W0=result
 
| 0x13 || [[#svcMapSharedMemory]] || W0=shmem_handle, X1=addr, X2=size, W3=perm || W0=result
Line 54: Line 56:  
| 0x16 || svcCloseHandle || W0=handle || W0=result
 
| 0x16 || svcCloseHandle || W0=handle || W0=result
 
|-
 
|-
| 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
 
| 0x18 || [[#svcWaitSynchronization]] || X1=handles_ptr, W2=num_handles, X3=timeout
Line 126: 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
 
| 0x36 || [8.0.0+] svcSynchronizePreemptionState || None || W0=result
Line 136: 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 142: 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 156: 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 172: Line 184:  
| 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=baseaddr, 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 182: Line 198:  
| 0x58 || [[#svcDetachDeviceAddressSpace]] || W0=device, X1=dev_as_handle || W0=result
 
| 0x58 || [[#svcDetachDeviceAddressSpace]] || W0=device, X1=dev_as_handle || W0=result
 
|-
 
|-
| 0x59 || [[#svcMapDeviceAddressSpaceByForce]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr, W5=perm || W0=result  
+
| 0x59 || [[#svcMapDeviceAddressSpaceByForce]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr, W5=perm
 +
R0=dev_as_handle, R1=proc_handle, R2=dev_map_addr_lower32, R3=dev_map_addr_upper32, R4=rev_as_size, R5=dev_as_addr_lower32, R6=dev_as_addr_upper32, R7=perm
 +
|| W0=result  
 
|-
 
|-
| 0x5A || [[#svcMapDeviceAddressSpaceAligned]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr, W5=perm || W0=result  
+
| 0x5A || [[#svcMapDeviceAddressSpaceAligned]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr, W5=perm
 +
R0=dev_as_handle, R1=proc_handle, R2=dev_map_addr_lower32, R3=dev_map_addr_upper32, R4=rev_as_size, R5=dev_as_addr_lower32, R6=dev_as_addr_upper32, R7=perm
 +
|| W0=result  
 
|-
 
|-
| 0x5B || svcMapDeviceAddressSpace || ||  
+
| 0x5B || svcMapDeviceAddressSpace || W1=dev_as_handle, W2=proc_handle, X3=dev_map_addr, X4=dev_as_size, X5=dev_as_addr, W6=perm
 +
R0=dev_map_addr_lower32, R1=dev_as_handle, R2=proc_handle, R3=dev_map_addr_upper32, R4=dev_as_size, R5=dev_as_addr_lower32, R6=dev_as_addr_upper32, R7=perm
 +
|| W0=result, X1=mapped_size
 +
R0=result, R1=mapped_size
 
|-
 
|-
| 0x5C || [[#svcUnmapDeviceAddressSpace]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr || W0=result
+
| 0x5C || [[#svcUnmapDeviceAddressSpace]] || W0=dev_as_handle, W1=proc_handle, X2=dev_map_addr, X3=dev_as_size, X4=dev_as_addr
 +
R0=dev_as_handle, R1=proc_handle, R2=dev_map_addr_lower32, R3=dev_map_addr_upper32, R4=dev_as_size, R5=dev_as_addr_lower32, R6=dev_as_addr_upper32
 +
|| W0=result
 
|-
 
|-
| 0x5D || svcInvalidateProcessDataCache || W0=process_handle, X1=addr, X2=size || W0=size
+
| 0x5D || svcInvalidateProcessDataCache || W0=process_handle, X1=addr, X2=size
 +
R0=process_handle, R1=size_lower32, R2=addr_lower32, R3=addr_upper32, R4=size_upper32
 +
|| W0=size
 
|-
 
|-
| 0x5E || svcStoreProcessDataCache || W0=process_handle, X1=addr, X2=size || W0=size
+
| 0x5E || svcStoreProcessDataCache || W0=process_handle, X1=addr, X2=size
 +
R0=process_handle, R1=size_lower32, R2=addr_lower32, R3=addr_upper32, R4=size_upper32
 +
|| W0=size
 
|-
 
|-
| 0x5F || svcFlushProcessDataCache || W0=process_handle, X1=addr, X2=size || W0=size
+
| 0x5F || svcFlushProcessDataCache || W0=process_handle, X1=addr, X2=size
 +
R0=process_handle, R1=size_lower32, R2=addr_lower32, R3=addr_upper32, R4=size_upper32
 +
|| W0=size
 
|-
 
|-
| 0x60 || svcDebugActiveProcess || X1=pid || W0=result, W1=debug_handle
+
| 0x60 || svcDebugActiveProcess || X1=pid
 +
R2=pid_lower32, R3=pid_upper32
 +
|| W0=result, W1=debug_handle
 
|-
 
|-
 
| 0x61 || svcBreakDebugProcess || W0=debug_handle || W0=result
 
| 0x61 || svcBreakDebugProcess || W0=debug_handle || W0=result
Line 212: Line 245:  
| 0x66 || svcGetThreadList || X1=tids_out_ptr, W2=max_out, W3=debug_handle_or_zero || W0=result, X1=num_out
 
| 0x66 || svcGetThreadList || X1=tids_out_ptr, W2=max_out, W3=debug_handle_or_zero || W0=result, X1=num_out
 
|-
 
|-
| 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]]
 +
R0=ThreadContext*, R1=debug_handle, R2=thread_id_lower32, R3=thread_id_upper32, R4=[[#ThreadContextFlags]]
 +
|| W0=result
 
|-
 
|-
| 0x68 || svcSetDebugThreadContext || W0=debug_handle, X1=thread_id, X2=ThreadContext*, W3=[[#ThreadContextFlags]] || W0=result
+
| 0x68 || svcSetDebugThreadContext || W0=debug_handle, X1=thread_id, X2=ThreadContext*, W3=[[#ThreadContextFlags]]
 +
R0=debug_handle, R1=ThreadContext*, R2=thread_id_lower32, R3=thread_id_upper32, R4=[[#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 222: Line 259:  
| 0x6B || svcWriteDebugProcessMemory || X0=debug_handle, X1=buffer*, X2=dst_addr, X3=size || W0=result
 
| 0x6B || svcWriteDebugProcessMemory || X0=debug_handle, X1=buffer*, X2=dst_addr, X3=size || W0=result
 
|-
 
|-
| 0x6C || [[#svcSetHardwareBreakPoint]] || W0=HardwareBreakpointId, X1=watchpoint_flags/breakpoint_flags, X2=watchpoint_value/debug_handle ||  
+
| 0x6C || [[#svcSetHardwareBreakPoint]] || W0=HardwareBreakpointId, X1=watchpoint_flags/breakpoint_flags, X2=watchpoint_value/debug_handle
 +
R0=HardwareBreakpointId, R1=value_lower32, R2=flags_lower32, R3=flags_upper32, R4=value_upper32
 +
|| W0=result
 
|-
 
|-
| 0x6D || svcGetDebugThreadParam || X2=debug_handle, X3=thread_id, W4=[[#DebugThreadParam]] || W0=result, X1=out0, W2=out1
+
| 0x6D || svcGetDebugThreadParam || X2=debug_handle, X3=thread_id, W4=[[#DebugThreadParam]]
 +
R0=thread_id_lower32, R1=thread_id_upper32, R2=debug_handle, R3=[[#DebugThreadParam]]
 +
|| W0=result, X1=out0, W2=out1
 +
R0=result, R1=out0_lower32, R2=out0_upper32, R3=out1
 
|- style="border-top: double"
 
|- style="border-top: double"
| 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
 +
R1=info_sub_id_lower32, R2=info_id, R3=handle, R4=info_sub_id_upper32
 +
|| W0=result, X1=out
 +
R0=result, R1=out_lower32, R2=out_upper32
 
|-
 
|-
| 0x70 || svcCreatePort || W2=max_sessions, W3=is_light, X4=name_ptr || W0=result, W1=serverport_handle, W2=clientport_handle
+
| 0x70 || svcCreatePort || W2=max_sessions, W3=is_light, X4=name_ptr
 +
R0=name_ptr, R2=max_sessions, R3=is_light
 +
|| 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 234: Line 281:  
| 0x72 || svcConnectToPort || W1=clientport_handle || W0=result, W1=session_handle
 
| 0x72 || svcConnectToPort || W1=clientport_handle || W0=result, W1=session_handle
 
|-
 
|-
| 0x73 || [[#svcSetProcessMemoryPermission]] || W0=process_handle, X1=addr, X2=size, W3=perm || W0=result
+
| 0x73 || [[#svcSetProcessMemoryPermission]] || W0=process_handle, X1=addr, X2=size, W3=perm
 +
R0=process_handle, R1=size_lower32, R2=addr_lower32, R3=addr_upper32, R4=size_upper32, R5=perm
 +
|| W0=result
 
|-
 
|-
| 0x74 || [[#svcMapProcessMemory]] || X0=dstaddr, W1=process_handle, X2=srcaddr, X3=size || W0=result
+
| 0x74 || [[#svcMapProcessMemory]] || X0=dstaddr, W1=process_handle, X2=srcaddr, X3=size
 +
R0=dstaddr, R1=process_handle, R2=srcaddr_lower32, R3=srcaddr_upper32, R4=size
 +
|| W0=result
 
|-
 
|-
| 0x75 || [[#svcUnmapProcessMemory]] || X0=dstaddr, W1=process_handle, X2=srcaddr, X3=size || W0=result
+
| 0x75 || [[#svcUnmapProcessMemory]] || X0=dstaddr, W1=process_handle, X2=srcaddr, X3=size
 +
R0=dstaddr, R1=process_handle, R2=srcaddr_lower32, R3=srcaddr_upper32, R4=size
 +
|| W0=result
 
|-
 
|-
| 0x76 || [[#svcQueryProcessMemory]] || X0=meminfo_ptr, W2=process_handle, X3=addr || W0=result, W1=pageinfo
+
| 0x76 || [[#svcQueryProcessMemory]] || X0=meminfo_ptr, W2=process_handle, X3=addr
 +
R0=meminfo_ptr, R1=addr_lower32, R2=process_handle, R3=addr_upper32
 +
|| W0=result, W1=pageinfo
 
|-
 
|-
| 0x77 || [[#svcMapProcessCodeMemory]] || W0=process_handle, X1=dstaddr, X2=srcaddr, X3=size || W0=result
+
| 0x77 || [[#svcMapProcessCodeMemory]] || W0=process_handle, X1=dstaddr, X2=srcaddr, X3=size
 +
R0=process_handle, R1=srcaddr_lower32, R2=dstaddr_lower32, R3=dstaddr_upper32, R4=srcaddr_lower32, R5=size_lower32, R6=size_upper32
 +
|| W0=result
 
|-
 
|-
| 0x78 || [[#svcUnmapProcessCodeMemory]] || W0=process_handle, X1=dstaddr, X2=srcaddr, X3=size || W0=result
+
| 0x78 || [[#svcUnmapProcessCodeMemory]] || W0=process_handle, X1=dstaddr, X2=srcaddr, X3=size
 +
R0=process_handle, R1=srcaddr_lower32, R2=dstaddr_lower32, R3=dstaddr_upper32, R4=srcaddr_lower32, R5=size_lower32, R6=size_upper32
 +
|| W0=result
 
|-
 
|-
 
| 0x79 || [[#svcCreateProcess]] || X1=procinfo_ptr, X2=caps_ptr, W3=cap_num ||  W0=result, W1=process_handle
 
| 0x79 || [[#svcCreateProcess]] || X1=procinfo_ptr, X2=caps_ptr, W3=cap_num ||  W0=result, W1=process_handle
 
|-
 
|-
| 0x7A || svcStartProcess || W0=process_handle, W1=main_thread_prio, W2=default_cpuid, W3=main_thread_stacksz || W0=result
+
| 0x7A || svcStartProcess || W0=process_handle, W1=main_thread_prio, W2=default_cpuid, W3=main_thread_stacksz
 +
R0=process_handle, R1=main_thread_prio, R2=default_cpuid, R3=main_thread_stacksz_lower32, R4=main_thread_stacksz_upper32
 +
|| W0=result
 
|-
 
|-
 
| 0x7B || svcTerminateProcess || W0=process_handle || W0=result
 
| 0x7B || svcTerminateProcess || W0=process_handle || W0=result
 
|-
 
|-
| 0x7C || [[#svcGetProcessInfo]] || W0=process_handle, W1=[[#ProcessInfoType]] || W0=result, X1=[[#ProcessState]]
+
| 0x7C || [[#svcGetProcessInfo]] || W0=process_handle, W1=[[#ProcessInfoType]]
 +
R1=process_handle, R2=[[#ProcessInfoType]]
 +
|| W0=result, X1=[[#ProcessState]]
 +
R0=result, R1=[[#ProcessState]]_lower32, R2=[[#ProcessState]]_upper32
 
|-
 
|-
 
| 0x7D || svcCreateResourceLimit || None || W0=result, W1=reslimit_handle  
 
| 0x7D || svcCreateResourceLimit || None || W0=result, W1=reslimit_handle  
 
|-
 
|-
| 0x7E || svcSetResourceLimitLimitValue || W0=reslimit_handle, W1=[[#LimitableResource]], X2=value || W0=result
+
| 0x7E || svcSetResourceLimitLimitValue || W0=reslimit_handle, W1=[[#LimitableResource]], X2=value
 +
R0=reslimit_handle, R1=[[#LimitableResource]], R2=value_lower32, R3=value_upper32
 +
|| 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
 +
R0=smc_sub_id, R1, R2, R3=smc_args
 +
|| X0,X1,X2,X3,X4,X5,X6,X7=result
 +
R0,R1,R2,R3=result
 
|}
 
|}
   Line 279: Line 348:  
Size must be a multiple of 0x200000 (2MB).
 
Size must be a multiple of 0x200000 (2MB).
   −
On success, the heap base-address (which is fixed by kernel, aslr'd) is written to OutAddr.
+
On success, the heap base-address (which is fixed by kernel, aslr'd, and always in the Heap memory region) is written to OutAddr.
   −
Uses current process pool partition.
+
Uses current process pool partition. The memory allocated counts towards the caller's process Memory ResourceLimit.
    
[2.0.0+] Size must be less than or equal to 4GB.
 
[2.0.0+] Size must be less than or equal to 4GB.
 +
 +
=== Result codes ===
 +
 +
'''0x0:''' Success.
 +
 +
'''0xCA01:''' Invalid size passed. It's either bigger than 4GB, or misaligned.
 +
 +
'''0xD001:''' Size is bigger than the Heap Region size.
 +
 +
'''0xCE01:''' KMemoryBlockAllocator slab allocator exhausted.
 +
 +
'''0xD401:''' The memory region is in an invalid state. Likely because a mapping was made in the heap region.
 +
 +
'''0x10801:''' Memory resource limit reached.
    
== svcSetMemoryPermission ==
 
== svcSetMemoryPermission ==
Line 308: Line 391:  
This can be used to move back and forth between ---, r-- and rw-.
 
This can be used to move back and forth between ---, r-- and rw-.
   −
== svcSetMemoryAttribute ==
+
=== Result codes ===
 +
 
 +
'''0x0:''' Success. The memory region was reprotected.
 +
 
 +
'''0xCC01:''' Unaligned address specified.
 +
 
 +
'''0xCA01:''' Unaligned or zero size specified.
 +
 
 +
'''0xD401:''' The provided memory region does not fall within the userland address space.
 +
 
 +
'''0xD801:''' Invalid permission specified. Valid permissions are ---, r-- and rw-.
 +
 
 +
'''0xD401:''' The provided memory region was in an invalid state. The region must have the PermissionChangeAllowed bit set in its [[#MemoryState]], and must not have the IsBorrowed or IsUncached [[#MemoryAttribute]].
 +
 
 +
'''0xCE01:''' Kernel resource exhausted.
 +
 
 +
== svcSetMemoryAttribute ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 440: Line 539:  
{| 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 613: Line 712:  
Cpu-id is an integer in the range 0-3.
 
Cpu-id is an integer in the range 0-3.
   −
== svcMapSharedMemory ==
+
== svcSignalEvent ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 620: Line 719:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) W0 || Handle<SharedMemory> || MemHandle
+
| (In) W0 || Handle<WritableEvent> || Event
 
|-
 
|-
| (In) X1 || void* || Addr
+
| (Out) X0 || [[#Result]] || Result
|-
  −
| (In) X2 || u64 || Size
  −
|-
  −
| (In) W3 || [[#Permission]] || Permissions
  −
|-
  −
| (Out) W0 || [[#Result]] || Ret
   
|}
 
|}
 
</div>
 
</div>
   −
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.
+
'''Description:''' Puts the given event in the signaled state.
 +
 
 +
Will wake up any thread currently waiting on this event. Can potentially trigger a reschedule.
   −
Increases reference count for the KSharedMemory object. Thus in order to release the memory associated with the object, all handles to it must be closed and all mappings must be unmapped.
+
Any calls to [[#svcWaitSynchronization]] on this handle will return immediately, until the event's signaled state is reset.
   −
== svcCreateTransferMemory ==
+
=== Result codes ===
   −
<div style="display: inline-block;">
+
'''0x0:''' Success. Event is now in signaled state.
{| class="wikitable" border="1"
+
 
 +
'''0xE401:''' Invalid handle. The handle either does not exist, or is not a WritableEvent.
 +
 
 +
== svcClearEvent ==
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 
|-
 
|-
 
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) X1 || void* || Addr
+
| (In) W0 || Handle<WritableEvent or ReadableEvent> || Event
|-
  −
| (In) X2 || u64 || Size
   
|-
 
|-
| (In) W3 || [[#Permission]] || Permissions
+
| (Out) X0 || [[#Result]] || Result
|-
  −
| (Out) W0 || [[#Result]] || Ret
  −
|-
  −
| (Out) W1 || Handle<TransferMemory> || Handle
   
|}
 
|}
 
</div>
 
</div>
   −
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].
+
'''Description:''' Takes the given event out of the signaled state.
 +
 
 +
=== Result codes ===
 +
 
 +
'''0x0:''' Success, the event is now in the not-signaled state.
   −
Executable bit perm not allowed.
+
'''0xE401:''' Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent.
   −
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.
+
'''0xFA01:''' The handle was not in a signaled state.
   −
== svcWaitSynchronization ==
+
== svcMapSharedMemory ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument64 || Argument32 || Type || Name
+
! Argument || Type || Name
 
|-
 
|-
| (In) X1 || R1 || Handle* || HandlesPtr
+
| (In) W0 || Handle<SharedMemory> || MemHandle
 
|-
 
|-
| (In) W2 || R2 || u64 || HandlesNum
+
| (In) X1 || void* || Addr
 
|-
 
|-
| (In) X3 || R0, R3 || u64 || Timeout
+
| (In) X2 || u64 || Size
 
|-
 
|-
| (Out) W0 || R0 || [[#Result]] || Ret
+
| (In) W3 || [[#Permission]] || Permissions
 
|-
 
|-
| (Out) W1 || R1 || u64 || HandleIndex
+
| (Out) W0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Works with num_handles <= 0x40.
     −
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.
+
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.
   −
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.
+
Increases reference count for the KSharedMemory object. Thus in order to release the memory associated with the object, all handles to it must be closed and all mappings must be unmapped.
   −
=== Object types ===
+
== svcCreateTransferMemory ==
   −
'''KDebug:''' signals when there is a new [[#DebugEventInfo|DebugEvent]] (retrievable via [[#svcGetDebugEvent]]).
+
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument || Type || Name
 +
|-
 +
| (In) X1 || void* || Addr
 +
|-
 +
| (In) X2 || u64 || Size
 +
|-
 +
| (In) W3 || [[#Permission]] || Permissions
 +
|-
 +
| (Out) W0 || [[#Result]] || Ret
 +
|-
 +
| (Out) W1 || Handle<TransferMemory> || Handle
 +
|}
 +
</div>
   −
'''KClientPort:''' signals when the number of sessions is less than the maximum allowed.
+
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].
   −
'''KProcess:''' signals when the process undergoes a state change (retrievable via [[#svcGetProcessInfo]]).
+
Executable bit perm not allowed.
   −
'''KReadableEvent:''' signals when the event's corresponding KWritableEvent has been signaled via svcSignalEvent.
+
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.
 
  −
'''KServerPort:''' signals when there is an incoming connection waiting to be [[#svcAcceptSession|accepted]].
     −
'''KServerSession:''' signals when there is an incoming message waiting to be [[#svcReplyAndReceive|received]] or the pipe is closed.
+
== svcResetSignal ==
 
  −
'''KThread:''' signals when the thread has exited.
  −
 
  −
=== Result codes ===
  −
 
  −
'''0x0:''' Success. One of the objects was signaled before the timeout expired, or one of the objects is a Session with a closed remote. Handle index is updated to indicate which object signaled.
  −
 
  −
'''0x7601:''' Thread termination requested. Handle index is not updated.
  −
 
  −
'''0xe401:''' Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.
  −
 
  −
'''0xe601:''' Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.
  −
 
  −
'''0xea01:''' Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.
  −
 
  −
'''0xec01:''' Interrupted. Returned when another thread uses [[#svcCancelSynchronization]] to cancel this thread. Handle index is not updated.
  −
 
  −
'''0xee01:''' Too many handles. Returned when the number of handles passed is > 0x40.
  −
 
  −
== svcCancelSynchronization ==
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 724: Line 815:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) W0 || Handle<Thread> || Handle
+
| (In) W0 || Handle<ReadableEvent> or Handle<Process> || Handle
 
|-
 
|-
 
| (Out) W0 || [[#Result]] || Ret
 
| (Out) W0 || [[#Result]] || Ret
Line 730: Line 821:  
</div>
 
</div>
   −
If the referenced thread is currently in a synchronization call ([[#svcWaitSynchronization]], [[#svcReplyAndReceive]] or [[#svcReplyAndReceiveLight]]), that call will be interrupted and return 0xec01.
+
Resets the signal on the given handle, ensuring future calls to [[#svcWaitSynchronization]] on this handle will sleep until the handle is signaled again. If the handle is a ReadableEvent, this is equivalent to calling svcClearEvent() on the handle.
If that thread is not currently executing such a synchronization call, the next call to a synchronization call will return 0xec01.
     −
This doesn't take force-pause (activity/debug pause) into account.
+
If the handle is a Process, it will clear the signaled state (which is set when the process changes [[#ProcessState]]. Once the process enters the Exited state, calling svcResetSignal on the process will no longer have an effect (the process is permanently signaled), and the syscall will return 0xFA01.
    
=== Result codes ===
 
=== Result codes ===
   −
'''0x0:''' Success. The thread was either interrupted or has had its flag set.
+
'''0x0:''' Success. The signal was reset.
 +
 
 +
'''0xE401:''' The handle is invalid or of the wrong type.
   −
'''0xe401:''' Invalid handle. The handle given was either invalid or not a thread handle.
+
'''0xFA01:''' The handle was not signaled, or the process is in exited state, causing it to be permanently signaled.
   −
== svcGetSystemTick ==
+
== svcWaitSynchronization ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 748: Line 840:  
! Argument64 || Argument32 || Type || Name
 
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (Out) X0 || R0, R1 || u64 || Ticks
+
| (In) X1 || R1 || Handle* || HandlesPtr
 +
|-
 +
| (In) W2 || R2 || u64 || HandlesNum
 +
|-
 +
| (In) X3 || R0, R3 || u64 || Timeout
 +
|-
 +
| (Out) W0 || R0 || [[#Result]] || Ret
 +
|-
 +
| (Out) W1 || R1 || u64 || HandleIndex
 
|}
 
|}
 
</div>
 
</div>
 +
Works with num_handles <= 0x40.
   −
Returns the value of cntpct_el0.
+
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.
   −
The frequency is 19200000 Hz (constant from official sw).
+
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.
   −
Official sw reads cntpct_el0 directly from usermode without using this SVC. [[ExeFS|sdk-nso]] has this SVC, but it's not known to be called anywhere.
+
=== Object types ===
   −
== svcSendSyncRequestWithUserBuffer ==
+
'''KDebug:''' signals when there is a new [[#DebugEventInfo|DebugEvent]] (retrievable via [[#svcGetDebugEvent]]).
   −
<div style="display: inline-block;">
+
'''KClientPort:''' signals when the number of sessions is less than the maximum allowed.
{| class="wikitable" border="1"
  −
|-
  −
! Argument || Type || Name
  −
|-
  −
| (In) X0 || void* || CmdPtr
  −
|-
  −
| (In) X1 || u64 || Size
  −
|-
  −
| (In) W2 || Handle<Session> || Handle
  −
|-
  −
| (Out) W0 || [[#Result]] || Ret
  −
|}
  −
</div>
     −
Size and CmdPtr must be 0x1000-aligned.
+
'''KProcess:''' signals when the process undergoes a state change (retrievable via [[#svcGetProcessInfo]]).
   −
=== Result codes ===
+
'''KReadableEvent:''' signals when the event's corresponding KWritableEvent has been signaled via svcSignalEvent.
   −
'''0x0:''' Success.
+
'''KServerPort:''' signals when there is an incoming connection waiting to be [[#svcAcceptSession|accepted]].
   −
'''0xcc01:''' CmdPtr is not 0x1000-aligned.
+
'''KServerSession:''' signals when there is an incoming message waiting to be [[#svcReplyAndReceive|received]] or the pipe is closed.
   −
'''0xca01:''' Size is not 0x1000-aligned.
+
'''KThread:''' signals when the thread has exited.
   −
'''0xce01:''' KSessionRequest allocation failed (unlikely) or pointer buffer size exceeded.
+
=== Result codes ===
   −
'''0xe401:''' Handles does not exist, or handle is not an instance of KClientSession.
+
'''0x0:''' Success. One of the objects was signaled before the timeout expired, or one of the objects is a Session with a closed remote. Handle index is updated to indicate which object signaled.
   −
== svcBreak ==
+
'''0x7601:''' Thread termination requested. Handle index is not updated.
 +
 
 +
'''0xe401:''' Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.
 +
 
 +
'''0xe601:''' Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.
 +
 
 +
'''0xea01:''' Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.
 +
 
 +
'''0xec01:''' Interrupted. Returned when another thread uses [[#svcCancelSynchronization]] to cancel this thread. Handle index is not updated.
 +
 
 +
'''0xee01:''' Too many handles. Returned when the number of handles passed is > 0x40.
 +
 
 +
== svcCancelSynchronization ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 796: Line 896:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) X0 || u64 || Break Reason
+
| (In) W0 || Handle<Thread> || Handle
 
|-
 
|-
| (In) X1 || u64 ||
+
| (Out) W0 || [[#Result]] || Ret
|-
  −
| (In) X2 || u64 || Info
  −
|-
  −
| (Out) W0 || Result || 0 (Success)
   
|}
 
|}
 
</div>
 
</div>
   −
If the process is attached, report the Break event. Then, if svcContinueDebugEvent didn't apply IgnoreException on the thread: if TPIDR_EL0 is 0, adjust ELR_EL1 to retry to svc instruction (and set TPIDR_EL0 to 1).
+
If the referenced thread is currently in a synchronization call ([[#svcWaitSynchronization]], [[#svcReplyAndReceive]] or [[#svcReplyAndReceiveLight]]), that call will be interrupted and return 0xec01.
 +
If that thread is not currently executing such a synchronization call, the next call to a synchronization call will return 0xec01.
   −
Otherwise, if bit31 in reason isn't set, perform crash reporting (see Exception Handling section below), if it doesn't terminate the process adjust ELR_EL1 as well.
+
This doesn't take force-pause (activity/debug pause) into account.
   −
Otherwise just return 0.
+
=== Result codes ===
   −
== svcGetInfo ==
+
'''0x0:''' Success. The thread was either interrupted or has had its flag set.
 +
 
 +
'''0xe401:''' Invalid handle. The handle given was either invalid or not a thread handle.
 +
 
 +
== svcGetSystemTick ==
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument64 || Argument32 || Type || Name
 +
|-
 +
| (Out) X0 || R0, R1 || u64 || Ticks
 +
|}
 +
</div>
 +
 
 +
Returns the value of cntpct_el0.
 +
 
 +
The frequency is 19200000 Hz (constant from official sw).
 +
 
 +
Official sw reads cntpct_el0 directly from usermode without using this SVC. [[ExeFS|sdk-nso]] has this SVC, but it's not known to be called anywhere.
 +
 
 +
== svcSendSyncRequestWithUserBuffer ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 819: Line 937:  
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) W1 || u32 || InfoId
+
| (In) X0 || void* || CmdPtr
 
|-
 
|-
| (In) W2 || Handle || Handle
+
| (In) X1 || u64 || Size
 
|-
 
|-
| (In) X3 || u64 || InfoSubId
+
| (In) W2 || Handle<Session> || Handle
 
|-
 
|-
 
| (Out) W0 || [[#Result]] || Ret
 
| (Out) W0 || [[#Result]] || Ret
|-
  −
| (Out) X1 || u64 || Out
   
|}
 
|}
 
</div>
 
</div>
<div style="display: inline-block; vertical-align:top;">
+
 
 +
Size and CmdPtr must be 0x1000-aligned.
 +
 
 +
=== Result codes ===
 +
 
 +
'''0x0:''' Success.
 +
 
 +
'''0xcc01:''' CmdPtr is not 0x1000-aligned.
 +
 
 +
'''0xca01:''' Size is not 0x1000-aligned.
 +
 
 +
'''0xce01:''' KSessionRequest allocation failed (unlikely) or pointer buffer size exceeded.
 +
 
 +
'''0xe401:''' Handles does not exist, or handle is not an instance of KClientSession.
 +
 
 +
== svcBreak ==
 +
 
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
 
! Argument || Type || Name
 
! Argument || Type || Name
 
|-
 
|-
| (In) R0 || u32 || InfoSubIdLower32
+
| (In) X0 || u64 || Break Reason
 
|-
 
|-
| (In) R1 || u32 || InfoId
+
| (In) X1 || u64 ||
 
|-
 
|-
| (In) R2 || Handle || Handle
+
| (In) X2 || u64 || Info
 
|-
 
|-
| (In) R3 || u32 || InfoSubIdUpper32
+
| (Out) W0 || Result || 0 (Success)
|-
+
|}
| (Out) R0 || [[#Result]] || Ret
  −
|-
  −
| (Out) R1 || u32 || OutLower32
  −
|-
  −
| (Out) R2 || u32 || OutUpper32
  −
|}
   
</div>
 
</div>
    +
If the process is attached, report the Break event. Then, if svcContinueDebugEvent didn't apply IgnoreException on the thread: if TPIDR_EL0 is 0, adjust ELR_EL1 to retry to svc instruction (and set TPIDR_EL0 to 1).
   −
{| class=wikitable
+
Otherwise, if bit31 in reason isn't set, perform crash reporting (see Exception Handling section below), if it doesn't terminate the process adjust ELR_EL1 as well.
! Handle type || Id0 || Id1 || Description
+
 
 +
Otherwise just return 0.
 +
 
 +
== svcGetInfo ==
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 
|-
 
|-
| Process || 0 || 0 || AllowedCpuIdBitmask
+
! Argument || Type || Name
 
|-
 
|-
| Process || 1 || 0 || AllowedThreadPrioBitmask
+
| (In) W1 || u32 || InfoId
 
|-
 
|-
| Process || 2 || 0 || AliasRegionBaseAddr
+
| (In) W2 || Handle || Handle
 
|-
 
|-
| Process || 3 || 0 || AliasRegionSize
+
| (In) X3 || u64 || InfoSubId
 
|-
 
|-
| Process || 4 || 0 || HeapRegionBaseAddr
+
| (Out) W0 || [[#Result]] || Ret
 
|-
 
|-
| Process || 5 || 0 || HeapRegionSize
+
| (Out) X1 || u64 || Out
 +
|}
 +
</div>
 +
<div style="display: inline-block; vertical-align:top;">
 +
{| class="wikitable" border="1"
 
|-
 
|-
| Process || 6 || 0 || TotalMemoryAvailable. Total memory available(free+used).
+
! Argument || Type || Name
 
|-
 
|-
| Process || 7 || 0 || TotalMemoryUsage. Total used size of codebin memory + main-thread stack + allocated heap.
+
| (In) R0 || u32 || InfoSubIdLower32
 
|-
 
|-
| Zero    || 8 || 0 || IsCurrentProcessBeingDebugged
+
| (In) R1 || u32 || InfoId
 
|-
 
|-
| Zero    || 9 || 0 || Returns ResourceLimit handle for current process. Used by [[Process_Manager_services|PM]].
+
| (In) R2 || Handle || Handle
 
|-
 
|-
| Zero    || 10 || -1, {current coreid} || IdleTickCount
+
| (In) R3 || u32 || InfoSubIdUpper32
 
|-
 
|-
| Zero    || 11 || 0-3 || RandomEntropy from current process. TRNG. Used to seed usermode PRNGs.
+
| (Out) R0 || [[#Result]] || Ret
 
|-
 
|-
| Process || 12 || 0 || [2.0.0+] AddressSpaceBaseAddr
+
| (Out) R1 || u32 || OutLower32
 
|-
 
|-
| Process || 13 || 0 || [2.0.0+] AddressSpaceSize
+
| (Out) R2 || u32 || OutUpper32
 +
|}
 +
</div>
 +
 
 +
 
 +
{| class=wikitable
 +
! Handle type || Id0 || Id1 || Description
 
|-
 
|-
| Process || 14 || 0 || [2.0.0+] StackRegionBaseAddr
+
| 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.
 +
|-
 +
| Zero    || 8 || 0 || IsCurrentProcessBeingDebugged
 +
|-
 +
| Zero    || 9 || 0 || Returns ResourceLimit handle for current process. Used by [[Process_Manager_services|PM]].
 +
|-
 +
| Zero    || 10 || -1, {current coreid} || IdleTickCount
 +
|-
 +
| Zero    || 11 || 0-3 || RandomEntropy from current process. TRNG. Used to seed usermode PRNGs.
 +
|-
 +
| Process || 12 || 0 || [2.0.0+] AddressSpaceBaseAddr
 +
|-
 +
| Process || 13 || 0 || [2.0.0+] AddressSpaceSize
 +
|-
 +
| Process || 14 || 0 || [2.0.0+] StackRegionBaseAddr
 
|-
 
|-
 
| Process || 15 || 0 || [2.0.0+] StackRegionSize
 
| Process || 15 || 0 || [2.0.0+] StackRegionSize
Line 902: Line 1,074:  
|-
 
|-
 
| Process || 22 || 0 || [6.0.0+] TotalMemoryUsedWithoutMmHeap
 
| Process || 22 || 0 || [6.0.0+] TotalMemoryUsedWithoutMmHeap
 +
|-
 +
| Process || 23 || 0 || [9.0.0+]
 
|-
 
|-
 
| 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.
 
| 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 950: Line 1,124:  
{| 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 1,008: Line 1,182:  
{| 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,162: Line 1,336:  
| (Out) X1 || u64 || PhysAddr
 
| (Out) X1 || u64 || PhysAddr
 
|-
 
|-
| (Out) X2 || u64 || KernelAddr
+
| (Out) X2 || u64 || BaseAddr
 
|-
 
|-
 
| (Out) X3 || u64 || Size
 
| (Out) X3 || u64 || Size
 
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Query the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address.
 +
 +
The returned BaseAddr is the virtual address of that page-aligned mapping, while PhysAddr is the physical address of that page. Size is the amount of continuous physical memory in that mapping.
    
== svcQueryIoMapping ==
 
== svcQueryIoMapping ==
Line 1,173: Line 1,351:  
{| 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,192: Line 1,370:  
{| 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,247: Line 1,425:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<DeviceAddressSpace> || DeviceAsHandle
+
| (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAsHandle
 
|-
 
|-
| (In) W1 || Handle<Process> || ProcessHandle
+
| (In) W1 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X2 || void* || SrcAddr
+
| (In) X2 || R2, R3 || void* || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || DeviceAsSize
+
| (In) X3 || R4 || u64 || DeviceAsSize
 
|-
 
|-
| (In) X4 || u64 || DeviceAsAddr
+
| (In) X4 || R5, R6 || u64 || DeviceAsAddr
 
|-
 
|-
| (In) W5 || [[#Permission]] || Permissions
+
| (In) W5 || R7 || [[#Permission]] || Permissions
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,276: Line 1,454:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<DeviceAddressSpace> || DeviceAsHandle
+
| (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAsHandle
 
|-
 
|-
| (In) W1 || Handle<Process> || ProcessHandle
+
| (In) W1 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X2 || void* || SrcAddr
+
| (In) X2 || R2, R3 || void* || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || DeviceAsSize
+
| (In) X3 || R4 || u64 || DeviceAsSize
 
|-
 
|-
| (In) X4 || u64 || DeviceAsAddr
+
| (In) X4 || R5, R6 || u64 || DeviceAsAddr
 
|-
 
|-
| (In) W5 || [[#Permission]] || Permissions
+
| (In) W5 || R7 || [[#Permission]] || Permissions
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,303: Line 1,481:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<DeviceAddressSpace> || DeviceAsHandle
+
| (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAsHandle
 
|-
 
|-
| (In) W1 || Handle<Process> || ProcessHandle
+
| (In) W1 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X2 || void* || SrcAddr
+
| (In) X2 || R2, R3 || void* || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || DeviceAsSize
+
| (In) X3 || R4 || u64 || DeviceAsSize
 
|-
 
|-
| (In) X4 || u64 || DeviceAsAddr
+
| (In) X4 || R5, R6 || u64 || DeviceAsAddr
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,380: Line 1,558:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<Process> || ProcessHandle
+
| (In) W0 || R0 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X1 || u64 || Addr
+
| (In) X1 || R2, R3 || u64 || Addr
 
|-
 
|-
| (In) X2 || u64 || Size
+
| (In) X2 || R1, R4 || u64 || Size
 
|-
 
|-
| (In) W3 || void* || Perm
+
| (In) W3 || R5 || void* || Perm
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,403: Line 1,581:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X0 || u64 || DstAddr
+
| (In) X0 || R0 || u64 || DstAddr
 
|-
 
|-
| (In) W1 || Handle<Process> || ProcessHandle
+
| (In) W1 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X2 || void* || SrcAddr
+
| (In) X2 || R2, R3 || void* || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || Size
+
| (In) X3 || R4 || u64 || Size
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,426: Line 1,604:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X0 || void* || DstAddr
+
| (In) X0 || R0 || void* || DstAddr
 
|-
 
|-
| (In) W1 || Handle<Process> || ProcessHandle
+
| (In) W1 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X2 || u64 || SrcAddr
+
| (In) X2 || R2, R3 || u64 || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || Size
+
| (In) X3 || R4 || u64 || Size
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,447: Line 1,625:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X0 || [[#MemoryInfo]]* || MemInfoPtr
+
| (In) X0 || R0 || [[#MemoryInfo]]* || MemInfoPtr
 
|-
 
|-
| (In) W2 || Handle<Process> || ProcessHandle
+
| (In) W2 || R2 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X3 || u64 || Addr
+
| (In) X3 || R1, R3 || u64 || Addr
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || PageInfo || PageInfo
+
| (Out) W1 || R1 || PageInfo || PageInfo
 
|}
 
|}
 
</div>
 
</div>
Line 1,468: Line 1,646:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<Process> || ProcessHandle
+
| (In) W0 || R0 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X1 || u64 || DstAddr
+
| (In) X1 || R2, R3 || u64 || DstAddr
 
|-
 
|-
| (In) X2 || u64 || SrcAddr
+
| (In) X2 || R1, R4 || u64 || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || Size
+
| (In) X3 || R5, R6 || u64 || Size
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,489: Line 1,667:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || Handle<Process> || ProcessHandle
+
| (In) W0 || R0 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) X1 || u64 || DstAddr
+
| (In) X1 || R2, R3 || u64 || DstAddr
 
|-
 
|-
| (In) X2 || u64 || SrcAddr
+
| (In) X2 || R1, R4 || u64 || SrcAddr
 
|-
 
|-
| (In) X3 || u64 || Size
+
| (In) X3 || R5, R6 || u64 || Size
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,549: Line 1,727:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 +
|-
 +
| (In) W0 || R1 || Handle<Process> || ProcessHandle
 
|-
 
|-
| (In) W0 || Handle<Process> || ProcessHandle
+
| (In) W1 || R2 || [[#ProcessInfoType]] || InfoType
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|-
 
|-
| (Out) W1 || [[#ProcessState]] || State
+
| (Out) X1 || R1, R2 || [[#ProcessState]] || State
 
|}
 
|}
 
</div>
 
</div>
Line 1,566: Line 1,746:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) X0 || u64 || [[SMC#ID_0|Function ID]]
+
| (In) X0 || R0 || u64 || [[SMC#ID_0|Function ID]]
 
|-
 
|-
| (In) X1-X7 || u64 || SMC sub-arguments
+
| (In) X1-X7 || R1-R3 || u64 || SMC sub-arguments
 
|-
 
|-
| (Out) X0 || [[SMC#Errors|SMC Result]] || Result of SMC
+
| (Out) X0 || R0 || [[SMC#Errors|SMC Result]] || Result of SMC
 
|-
 
|-
| (Out) X1-X7 || u64 || SMC sub-output
+
| (Out) X1-X7 || R1-R3 || u64 || SMC sub-output
 
|}
 
|}
 
</div>
 
</div>
Line 1,602: Line 1,782:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Argument || Type || Name
+
! Argument64 || Argument32 || Type || Name
 
|-
 
|-
| (In) W0 || u32 || hardware_breakpoint_id
+
| (In) W0 || R0 || u32 || hardware_breakpoint_id
 
|-
 
|-
| (In) W1 || u64 || flags
+
| (In) X1 || R2, R3 || u64 || flags
 
|-
 
|-
| (In) W2 || u64 || value
+
| (In) X2 || R1, R4 || u64 || value
 
|-
 
|-
| (Out) W0 || [[#Result]] || Ret
+
| (Out) W0 || R0 || [[#Result]] || Ret
 
|}
 
|}
 
</div>
 
</div>
Line 1,910: Line 2,090:  
== MemoryState ==
 
== MemoryState ==
 
{| class=wikitable
 
{| class=wikitable
! Bits || Description
+
! Bits || Description || Meaning
 
|-
 
|-
| 7-0 || Type
+
| 7-0 || Type ||
 
|-
 
|-
| 8 || [[#svcSetMemoryPermission|PermissionChangeAllowed]]
+
| 8 || [[#svcSetMemoryPermission|PermissionChangeAllowed]] ||
 
|-
 
|-
| 9 || ForceReadWritableByDebugSyscalls
+
| 9 || ForceReadWritableByDebugSyscalls || Allows using [[#svcWriteDebugProcessMemory]] on segments mapped read-only.
 
|-
 
|-
| 10 || IpcSendAllowed
+
| 10 || IpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=0.
 
|-
 
|-
| 11 || NonDeviceIpcSendAllowed
+
| 11 || NonDeviceIpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=1.
 
|-
 
|-
| 12 || NonSecureIpcSendAllowed
+
| 12 || NonSecureIpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=3.
 
|-
 
|-
| 14 || [[#svcSetProcessMemoryPermission|ProcessPermissionChangeAllowed]]
+
| 14 || [[#svcSetProcessMemoryPermission|ProcessPermissionChangeAllowed]] ||
 
|-
 
|-
| 15 || [[#svcMapMemory|MapAllowed]]
+
| 15 || [[#svcMapMemory|MapAllowed]] ||
 
|-
 
|-
| 16 || [[#svcUnmapProcessCodeMemory|UnmapProcessCodeMemoryAllowed]]
+
| 16 || [[#svcUnmapProcessCodeMemory|UnmapProcessCodeMemoryAllowed]] ||
 
|-
 
|-
| 17 || [[#svcCreateTransferMemory|TransferMemoryAllowed]]
+
| 17 || [[#svcCreateTransferMemory|TransferMemoryAllowed]] ||
 
|-
 
|-
| 18 || [[#svcQueryPhysicalAddress|QueryPhysicalAddressAllowed]]
+
| 18 || [[#svcQueryPhysicalAddress|QueryPhysicalAddressAllowed]] ||
 
|-
 
|-
| 19 || MapDeviceAllowed ([[#svcMapDeviceAddressSpace]] and [[#svcMapDeviceAddressSpaceByForce]])
+
| 19 || MapDeviceAllowed ([[#svcMapDeviceAddressSpace]] and [[#svcMapDeviceAddressSpaceByForce]]) ||
 
|-
 
|-
| 20 || [[#svcMapDeviceAddressSpaceAligned|MapDeviceAlignedAllowed]]
+
| 20 || [[#svcMapDeviceAddressSpaceAligned|MapDeviceAlignedAllowed]] ||
 
|-
 
|-
| 21 || [[#svcSendSyncRequestWithUserBuffer|IpcBufferAllowed]]
+
| 21 || [[#svcSendSyncRequestWithUserBuffer|IpcBufferAllowed]] ||
 
|-
 
|-
| 22 || IsPoolAllocated/IsReferenceCounted
+
| 22 || IsPoolAllocated/IsReferenceCounted || The physical memory blocks backing this region are refcounted.
 
|-
 
|-
| 23 || [[#svcMapProcessMemory|MapProcessAllowed]]
+
| 23 || [[#svcMapProcessMemory|MapProcessAllowed]] ||
 
|-
 
|-
| 24 || [[#svcSetMemoryAttribute|AttributeChangeAllowed]]
+
| 24 || [[#svcSetMemoryAttribute|AttributeChangeAllowed]] ||
 
|-
 
|-
| 25 || [4.0.0+] CodeMemoryAllowed
+
| 25 || [4.0.0+] [[#svcCreateCodeMemory|CodeMemoryAllowed]] ||
 
|}
 
|}
  
151

edits

Navigation menu