<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PixelyIon</id>
	<title>Nintendo Switch Brew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PixelyIon"/>
	<link rel="alternate" type="text/html" href="https://switchbrew.org/wiki/Special:Contributions/PixelyIon"/>
	<updated>2026-05-17T06:52:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=SVC&amp;diff=10704</id>
		<title>SVC</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=SVC&amp;diff=10704"/>
		<updated>2021-02-20T05:38:55Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: Add Argument32 value for Result in WaitForAddress and SignalToAddress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
= System calls =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! ID || Return Type || Name || Arguments&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || Result || [[#SetHeapSize|SetHeapSize]] || uintptr_t *out_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || Result || [[#SetMemoryPermission|SetMemoryPermission]] || uintptr_t address, size_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || Result || [[#SetMemoryAttribute|SetMemoryAttribute]] || uintptr_t address, size_t size, uint32_t mask, uint32_t attr&lt;br /&gt;
|-&lt;br /&gt;
| 0x04 || Result || [[#MapMemory|MapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x05 || Result || [[#UnmapMemory|UnmapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x06 || Result || [[#QueryMemory|QueryMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x07 || void || [[#ExitProcess|ExitProcess]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x08 || Result || [[#CreateThread|CreateThread]] || Handle *out_handle, ThreadFunc func, uintptr_t arg, uintptr_t stack_bottom, int32_t priority, int32_t core_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x09 || Result || [[#StartThread|StartThread]] || Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A || void || [[#ExitThread|ExitThread]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x0B || void || [[#SleepThread|SleepThread]] || int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || Result || [[#GetThreadPriority|GetThreadPriority]] || int32_t *out_priority, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D || Result || [[#SetThreadPriority|SetThreadPriority]] || Handle thread_handle, int32_t priority&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E || Result || [[#GetThreadCoreMask|GetThreadCoreMask]] || int32_t *out_core_id, uint64_t *out_affinity_mask, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F || Result || [[#SetThreadCoreMask|SetThreadCoreMask]] || Handle thread_handle, int32_t core_id, uint64_t affinity_mask&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || int32_t || [[#GetCurrentProcessorNumber|GetCurrentProcessorNumber]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x11 || Result || [[#SignalEvent|SignalEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x12 || Result || [[#ClearEvent|ClearEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x13 || Result || [[#MapSharedMemory|MapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || Result || [[#UnmapSharedMemory|UnmapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x15 || Result || [[#CreateTransferMemory|CreateTransferMemory]] || Handle *out_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x16 || Result || [[#CloseHandle|CloseHandle]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x17 || Result || [[#ResetSignal|ResetSignal]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || Result || [[#WaitSynchronization|WaitSynchronization]] || int32_t *out_index, const Handle *handles, int32_t numHandles, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x19 || Result || [[#CancelSynchronization|CancelSynchronization]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A || Result || [[#ArbitrateLock|ArbitrateLock]] || Handle thread_handle, uintptr_t address, uint32_t tag&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B || Result || [[#ArbitrateUnlock|ArbitrateUnlock]] || uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || Result || [[#WaitProcessWideKeyAtomic|WaitProcessWideKeyAtomic]] || uintptr_t address, uintptr_t cv_key, uint32_t tag, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D || void || [[#SignalProcessWideKey|SignalProcessWideKey]] || uintptr_t cv_key, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E || int64_t || [[#GetSystemTick|GetSystemTick]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x1F || Result || [[#ConnectToNamedPort|ConnectToNamedPort]] || Handle *out_handle, const char *name&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Result || [[#SendSyncRequestLight|SendSyncRequestLight]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x21 || Result || [[#SendSyncRequest|SendSyncRequest]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x22 || Result || [[#SendSyncRequestWithUserBuffer|SendSyncRequestWithUserBuffer]] || uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x23 || Result || [[#SendAsyncRequestWithUserBuffer|SendAsyncRequestWithUserBuffer]] || Handle *out_event_handle, uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || Result || [[#GetProcessId|GetProcessId]] || uint64_t *out_process_id, Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x25 || Result || [[#GetThreadId|GetThreadId]] || uint64_t *out_thread_id, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x26 || void || [[#Break|Break]] || BreakReason break_reason, uintptr_t arg, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x27 || Result || [[#OutputDebugString|OutputDebugString]] || const char *debug_str, size_t len&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || void || [[#ReturnFromException|ReturnFromException]] || Result result&lt;br /&gt;
|-&lt;br /&gt;
| 0x29 || Result || [[#GetInfo|GetInfo]] || uint64_t *out, InfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x2A || void || [[#FlushEntireDataCache|FlushEntireDataCache]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x2B || Result || [[#FlushDataCache|FlushDataCache]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2C  || Result || [[#MapPhysicalMemory|MapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2D  || Result || [[#UnmapPhysicalMemory|UnmapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0-5.1.0] 0x2E  || Result || GetFutureThreadInfo || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags, int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| [6.0.0+] 0x2E  || Result || [[#GetDebugFutureThreadInfo|GetDebugFutureThreadInfo]] || arch::LastThreadContext *out_context, uint64_t *thread_id, Handle debug_handle, int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x2F || Result || [[#GetLastThreadInfo|GetLastThreadInfo]] || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || Result || [[#GetResourceLimitLimitValue|GetResourceLimitLimitValue]] || int64_t *out_limit_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x31 || Result || [[#GetResourceLimitCurrentValue|GetResourceLimitCurrentValue]] || int64_t *out_current_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x32 || Result || [[#SetThreadActivity|SetThreadActivity]] || Handle thread_handle, ThreadActivity thread_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x33  || Result || [[#GetThreadContext3|GetThreadContext3]] || ThreadContext *out_context, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x34 || Result || [[#WaitForAddress|WaitForAddress]] || uintptr_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x35 || Result || [[#SignalToAddress|SignalToAddress]] || uintptr_t address, SignalType signal_type, int32_t value, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| [8.0.0+] 0x36 || void || [[#SynchronizePreemptionState|SynchronizePreemptionState]] || &lt;br /&gt;
|-&lt;br /&gt;
| [11.0.0+] 0x37 || Result || [[#GetResourceLimitPeakValue|GetResourceLimitPeakValue]] || int64_t *out_peak_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [1.0.0-3.0.2] 0x3C || void || [[#DumpInfo|DumpInfo]] || DumpInfoType dump_info_type, uint64_t arg&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3C || void || [[#KernelDebug|KernelDebug]] || KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3D || void || [[#ChangeKernelTraceState|ChangeKernelTraceState]] || KernelTraceState kern_trace_state&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| 0x40 || Result || [[#CreateSession|CreateSession]] || Handle *out_server_session_handle, Handle *out_client_session_handle, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x41 || Result || [[#AcceptSession|AcceptSession]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x42 || Result || [[#ReplyAndReceiveLight|ReplyAndReceiveLight]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x43 || Result || [[#ReplyAndReceive|ReplyAndReceive]] || int32_t *out_index, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x44 || Result || [[#ReplyAndReceiveWithUserBuffer|ReplyAndReceiveWithUserBuffer]] || int32_t *out_index, uintptr_t message_buffer, size_t message_buffer_size, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x45 || Result || [[#CreateEvent|CreateEvent]] || Handle *out_write_handle, Handle *out_read_handle&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x48 || Result || [[#MapPhysicalMemoryUnsafe|MapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x49 || Result || [[#UnmapPhysicalMemoryUnsafe|UnmapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x4A || Result || [[#SetUnsafeLimit|SetUnsafeLimit]] || size_t limit&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4B || Result || [[#CreateCodeMemory|CreateCodeMemory]] || Handle *out_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4C || Result || [[#ControlCodeMemory|ControlCodeMemory]] || Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x4D || void || [[#SleepSystem|SleepSystem]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x4E || Result || [[#ReadWriteRegister|ReadWriteRegister]] || uint32_t *out_value, PhysicalAddress address, uint32_t mask, uint32_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x4F || Result || [[#SetProcessActivity|SetProcessActivity]] || Handle process_handle, ProcessActivity process_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || Result || [[#CreateSharedMemory|CreateSharedMemory]] || Handle *out_handle, size_t size, MemoryPermission owner_perm, MemoryPermission remote_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x51 || Result || [[#MapTransferMemory|MapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size, MemoryPermission owner_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x52 || Result || [[#UnmapTransferMemory|UnmapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x53 || Result || [[#CreateInterruptEvent|CreateInterruptEvent]] || Handle *out_read_handle, int32_t interrupt_id, InterruptType interrupt_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x54 || Result || [[#QueryPhysicalAddress|QueryPhysicalAddress]] || arch::PhysicalMemoryInfo *out_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x55 || Result || [[#QueryIoMapping|QueryIoMapping]] || uintptr_t *out_address, [10.0.0+] size_t *out_size, PhysicalAddress physical_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x56 || Result || [[#CreateDeviceAddressSpace|CreateDeviceAddressSpace]] || Handle *out_handle, uint64_t das_address, uint64_t das_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x57 || Result || [[#AttachDeviceAddressSpace|AttachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || Result || [[#DetachDeviceAddressSpace|DetachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x59 || Result || [[#MapDeviceAddressSpaceByForce|MapDeviceAddressSpaceByForce]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5A || Result || [[#MapDeviceAddressSpaceAligned|MapDeviceAddressSpaceAligned]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5B || Result || [[#MapDeviceAddressSpace|MapDeviceAddressSpace]] || size_t *out_mapped_size, Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5C || Result || [[#UnmapDeviceAddressSpace|UnmapDeviceAddressSpace]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address&lt;br /&gt;
|-&lt;br /&gt;
| 0x5D || Result || [[#InvalidateProcessDataCache|InvalidateProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5E || Result || [[#StoreProcessDataCache|StoreProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5F || Result || [[#FlushProcessDataCache|FlushProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || Result || [[#DebugActiveProcess|DebugActiveProcess]] || Handle *out_handle, uint64_t process_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x61 || Result || [[#BreakDebugProcess|BreakDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x62 || Result || [[#TerminateDebugProcess|TerminateDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x63 || Result || [[#GetDebugEvent|GetDebugEvent]] || arch::DebugEventInfo *out_info, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || Result || [[#ContinueDebugEvent|ContinueDebugEvent]] || Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids&lt;br /&gt;
|-&lt;br /&gt;
| 0x65 || Result || [[#GetProcessList|GetProcessList]] || int32_t *out_num_processes, uint64_t *out_process_ids, int32_t max_out_count&lt;br /&gt;
|-&lt;br /&gt;
| 0x66 || Result || [[#GetThreadList|GetThreadList]] || int32_t *out_num_threads, uint64_t *out_thread_ids, int32_t max_out_count, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x67 || Result || [[#GetDebugThreadContext|GetDebugThreadContext]] || ThreadContext *out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || Result || [[#SetDebugThreadContext|SetDebugThreadContext]] || Handle debug_handle, uint64_t thread_id, const ThreadContext *context, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x69 || Result || [[#QueryDebugProcessMemory|QueryDebugProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x6A || Result || [[#ReadDebugProcessMemory|ReadDebugProcessMemory]] || uintptr_t buffer, Handle debug_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6B || Result || [[#WriteDebugProcessMemory|WriteDebugProcessMemory]] || Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || Result || [[#SetHardwareBreakPoint|SetHardwareBreakPoint]] || HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x6D || Result || [[#GetDebugThreadParam|GetDebugThreadParam]] || uint64_t *out_64, uint32_t *out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x6F || Result || [[#GetSystemInfo|GetSystemInfo]] || uint64_t *out, SystemInfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || Result || [[#CreatePort|CreatePort]] || Handle *out_server_handle, Handle *out_client_handle, int32_t max_sessions, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x71 || Result || [[#ManageNamedPort|ManageNamedPort]] || Handle *out_server_handle, const char *name, int32_t max_sessions&lt;br /&gt;
|-&lt;br /&gt;
| 0x72 || Result || [[#ConnectToPort|ConnectToPort]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x73 || Result || [[#SetProcessMemoryPermission|SetProcessMemoryPermission]] || Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x74 || Result || [[#MapProcessMemory|MapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x75 || Result || [[#UnmapProcessMemory|UnmapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x76 || Result || [[#QueryProcessMemory|QueryProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uint64_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x77 || Result || [[#MapProcessCodeMemory|MapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x78 || Result || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x79 || Result || [[#CreateProcess|CreateProcess]] || Handle *out_handle, const arch::CreateProcessParameter *parameters, const uint32_t *caps, int32_t num_caps&lt;br /&gt;
|-&lt;br /&gt;
| 0x7A || Result || [[#StartProcess|StartProcess]] || Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x7B || Result || [[#TerminateProcess|TerminateProcess]] || Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7C || Result || [[#GetProcessInfo|GetProcessInfo]] || int64_t *out_info, Handle process_handle, ProcessInfoType info_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x7D || Result || [[#CreateResourceLimit|CreateResourceLimit]] || Handle *out_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7E || Result || [[#SetResourceLimitLimitValue|SetResourceLimitLimitValue]] || Handle resource_limit_handle, LimitableResource which, int64_t limit_value&lt;br /&gt;
|-&lt;br /&gt;
| 0x7F || void || [[#CallSecureMonitor|CallSecureMonitor]] || SecureMonitorArguments *args&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SetHeapSize ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint32_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || void* || HeapAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the process heap to a given Size. It can both extend and shrink the heap.&lt;br /&gt;
&lt;br /&gt;
Size must be a multiple of 0x200000 (2MB).&lt;br /&gt;
&lt;br /&gt;
On success, the heap base-address (which is fixed by kernel, aslr&#039;d, and always in the Heap memory region) is written to HeapAddress.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition. The memory allocated counts towards the caller&#039;s process Memory ResourceLimit.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Size must be less than or equal to 4GB.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Invalid size passed. It&#039;s either bigger than 4GB, or misaligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD001:&#039;&#039;&#039; Size is bigger than the Heap Region size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; KMemoryBlockAllocator slab allocator exhausted.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The memory region is in an invalid state. Likely because a mapping was made in the heap region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x10801:&#039;&#039;&#039; Memory resource limit reached.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes permission of page-aligned memory region.&lt;br /&gt;
&lt;br /&gt;
Bit2 of permission (exec) is not allowed. Setting write-only is not allowed either (bit1).&lt;br /&gt;
&lt;br /&gt;
This can be used to move back and forth between ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The memory region was reprotected.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Unaligned address specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Unaligned or zero size specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The provided memory region does not fall within the userland address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD801:&#039;&#039;&#039; Invalid permission specified. Valid permissions are ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The provided memory region was in an invalid state. The region must have the [[#MemoryState|FlagCanReprotect]] state, and must not have the [[#MemoryAttribute|Locked]] or [[#MemoryAttribute|Uncached]] attributes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; Kernel resource exhausted.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryAttribute ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Mask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes attribute of page-aligned memory region. The only allowed combination of Value and Mask is 0x8, which means only bit3 in [[#MemoryAttribute]] can be set or cleared.&lt;br /&gt;
&lt;br /&gt;
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU.&lt;br /&gt;
&lt;br /&gt;
What happens &amp;quot;under the hood&amp;quot; is the &amp;quot;Memory Attribute Indirection Register&amp;quot; index is changed from 2 to 3 in the MMU descriptor.&lt;br /&gt;
&lt;br /&gt;
== MapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps a memory range into a different range.&lt;br /&gt;
&lt;br /&gt;
Mainly used for adding guard pages around stack.&lt;br /&gt;
&lt;br /&gt;
Source range gets reprotected to --- (it can no longer be accessed), and bit0 is set in the source [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
[1.0.0] This could be used to map into either the Alias Region or the Stack region.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] This can only be used to map into the Stack region.&lt;br /&gt;
&lt;br /&gt;
Code can get the range of the Alias region from [[#GetInfo]] id0=2,3, and on 2.0.0+ the range of the Stack region via [[#GetInfo]] id0=14, 15 (on 1.0.0, the Stack region had hardcoded limits).&lt;br /&gt;
&lt;br /&gt;
When mapped into the Alias region, the mapped memory will have state 0x482907.&lt;br /&gt;
&lt;br /&gt;
When mapped into the Stack region, the mapped memory will have state 0x5C3C0B.&lt;br /&gt;
&lt;br /&gt;
== UnmapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps a region that was previously mapped with [[#MapMemory]].&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to unmap ranges partially, you don&#039;t need to unmap the entire range &amp;quot;in one go&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The srcaddr/dstaddr must match what was given when the pages were originally mapped.&lt;br /&gt;
&lt;br /&gt;
== QueryMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address.&lt;br /&gt;
&lt;br /&gt;
Outputs a [[#MemoryInfo]] struct.&lt;br /&gt;
&lt;br /&gt;
== ExitProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current process.&lt;br /&gt;
&lt;br /&gt;
== CreateThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void(*)(void*) || Entry&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || void* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || void* || StackTop&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || int32_t || ProcessorId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a thread in the current process.&lt;br /&gt;
&lt;br /&gt;
ProcessorId must be 0,1,2,3 or -2, where -2 uses the default CpuId for process.&lt;br /&gt;
&lt;br /&gt;
== StartThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starts the thread for the provided handle.&lt;br /&gt;
&lt;br /&gt;
== ExitThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current thread.&lt;br /&gt;
&lt;br /&gt;
== SleepThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0, R1 || uint64_t || Nanoseconds&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sleeps for a specified amount of time, or yields the thread.&lt;br /&gt;
&lt;br /&gt;
Setting nanoseconds to 0, -1, or -2 indicates a yielding type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Yielding without core migration&lt;br /&gt;
|-&lt;br /&gt;
| -1 || Yielding with core migration&lt;br /&gt;
|-&lt;br /&gt;
| -2 || Yielding to any other thread&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || int32_t || Priority&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
Priority is a number 0-0x3F. Lower value means higher priority.&lt;br /&gt;
&lt;br /&gt;
== GetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== GetCurrentProcessorNumber ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || uint32_t || CpuId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets which cpu is executing the current thread.&lt;br /&gt;
&lt;br /&gt;
CpuId is an integer in the range 0-3.&lt;br /&gt;
&lt;br /&gt;
== SignalEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puts the given event in the signaled state.&lt;br /&gt;
&lt;br /&gt;
Will wake up any thread currently waiting on this event. Can potentially trigger a reschedule.&lt;br /&gt;
&lt;br /&gt;
Any calls to [[#WaitSynchronization]] on this handle will return immediately, until the event&#039;s signaled state is reset.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Event is now in signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
== ClearEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; or Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes the given event out of the signaled state.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success, the event is now in the not-signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not in a signaled state.&lt;br /&gt;
&lt;br /&gt;
== MapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== UnmapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
Executable bit perm not allowed.&lt;br /&gt;
&lt;br /&gt;
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.&lt;br /&gt;
&lt;br /&gt;
== CloseHandle ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResetSignal ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;ReadableEvent&amp;gt; or Handle&amp;lt;Process&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Resets the signal on the given handle, ensuring future calls to [[#WaitSynchronization]] on this handle will sleep until the handle is signaled again. If the handle is a ReadableEvent, this is equivalent to calling ClearEvent() on the handle.&lt;br /&gt;
&lt;br /&gt;
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 ResetSignal on the process will no longer have an effect (the process is permanently signaled), and the syscall will return 0xFA01.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The signal was reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The handle is invalid or of the wrong type.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not signaled, or the process is in exited state, causing it to be permanently signaled.&lt;br /&gt;
&lt;br /&gt;
== WaitSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle* || HandlesPtr&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || HandlesNum&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint64_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Works with HandlesNum &amp;lt;= 0x40.&lt;br /&gt;
&lt;br /&gt;
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.&lt;br /&gt;
&lt;br /&gt;
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.&lt;br /&gt;
&lt;br /&gt;
=== Object types ===&lt;br /&gt;
&#039;&#039;&#039;KDebug:&#039;&#039;&#039; signals when there is a new [[#DebugEventInfo|DebugEvent]] (retrievable via [[#GetDebugEvent]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KClientPort:&#039;&#039;&#039; signals when the number of sessions is less than the maximum allowed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KProcess:&#039;&#039;&#039; signals when the process undergoes a state change (retrievable via [[#GetProcessInfo]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KReadableEvent:&#039;&#039;&#039; signals when the event&#039;s corresponding KWritableEvent has been signaled via [[#SignalEvent]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerPort:&#039;&#039;&#039; signals when there is an incoming connection waiting to be [[#AcceptSession|accepted]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerSession:&#039;&#039;&#039; signals when there is an incoming message waiting to be [[#ReplyAndReceive|received]] or the pipe is closed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KThread:&#039;&#039;&#039; signals when the thread has exited.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x7601:&#039;&#039;&#039; Thread termination requested. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xec01:&#039;&#039;&#039; Interrupted. Returned when another thread uses [[#CancelSynchronization]] to cancel this thread. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; Too many handles. Returned when the number of handles passed is &amp;gt; 0x40.&lt;br /&gt;
&lt;br /&gt;
== CancelSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the referenced thread is currently in a synchronization call ([[#WaitSynchronization]], [[#ReplyAndReceive]] or [[#ReplyAndReceiveLight]]), that call will be interrupted and return 0xec01.&lt;br /&gt;
If that thread is not currently executing such a synchronization call, the next call to a synchronization call will return 0xec01.&lt;br /&gt;
&lt;br /&gt;
This doesn&#039;t take force-pause (activity/debug pause) into account.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The thread was either interrupted or has had its flag set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. The handle given was either invalid or not a thread handle.&lt;br /&gt;
&lt;br /&gt;
== ArbitrateLock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;                                  &lt;br /&gt;
&lt;br /&gt;
== ArbitrateUnlock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitProcessWideKeyAtomic ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || KeyAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || TagAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalProcessWideKey ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || int32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemTick ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0, R1 || uint64_t || Ticks&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the value of cntpct_el0.&lt;br /&gt;
&lt;br /&gt;
The frequency is 19200000 Hz (constant from official sw).&lt;br /&gt;
&lt;br /&gt;
Official sw reads cntpct_el0 directly from usermode without using this SVC. [[ExeFS|sdk-nso]] has this SVC, but it&#039;s not known to be called anywhere.&lt;br /&gt;
&lt;br /&gt;
== ConnectToNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || PortName&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequest ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xcc01:&#039;&#039;&#039; Address is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xca01:&#039;&#039;&#039; Size is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xce01:&#039;&#039;&#039; KSessionRequest allocation failed (unlikely) or pointer buffer size exceeded.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Handles does not exist, or handle is not an instance of KClientSession.&lt;br /&gt;
&lt;br /&gt;
== SendAsyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
== GetProcessId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ProcessId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ThreadId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Break ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#BreakReason]] || BreakReason&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Info&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the process is attached, report the Break event. Then, if [[#ContinueDebugEvent]] didn&#039;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).&lt;br /&gt;
&lt;br /&gt;
Otherwise, if bit31 in reason isn&#039;t set, perform crash reporting (see Exception Handling section below), if it doesn&#039;t terminate the process adjust ELR_EL1 as well.&lt;br /&gt;
&lt;br /&gt;
Otherwise just return 0.&lt;br /&gt;
&lt;br /&gt;
== OutputDebugString ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || char* || String&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReturnFromException ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#InfoType]] || InfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || uint64_t || InfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Info&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushEntireDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Acts like [[#SetHeapSize]] except you can allocate heap at any address you&#039;d like.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Invalid size passed. It&#039;s either zero or not 4k-aligned&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Invalid address. (not 4k-aligned)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xDC01:&#039;&#039;&#039; Invalid memory range. It&#039;s either causes overflow, or does not fall into &amp;quot;reserved&amp;quot; address range (aka Alias). See AliasRegionAddress at [[#InfoType]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; Invalid state. (not enough SystemResource (see [[NPDM#SystemResourceSize]]))&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugFutureThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetLastThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || LimitValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitCurrentValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || CurrentValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetThreadActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ThreadActivity]] || ThreadActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadContext3 ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitForAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#ArbitrationType]] || ArbitrationType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalToAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#SignalType]] || SignalType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || uint32_t || NumToSignal&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0  || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SynchronizePreemptionState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitPeakValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || PeakValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DumpInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DumpInfoType]] || DumpInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || DumpInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] This function was removed and replaced by [[#KernelDebug]].&lt;br /&gt;
&lt;br /&gt;
== KernelDebug ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelDebugType]] || KernelDebugType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== ChangeKernelTraceState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelTraceState]] || KernelTraceState&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== CreateSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ClientSession&amp;gt; || ClientSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== AcceptSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || PortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0xf201:&#039;&#039;&#039; No session waiting to be accepted&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Port&amp;gt; or Handle&amp;lt;ServerSession&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceive ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is not zero, a reply from the TLS will be sent to that session.&lt;br /&gt;
Then it will wait until either of the passed sessions has an incoming message, is closed, a passed port has an incoming connection, or the timeout expires.&lt;br /&gt;
If there is an incoming message, it is copied to the TLS.&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is zero, the TLS should contain a blank message. If this message has a C descriptor, the buffer it points to will be used as the pointer buffer. See [[IPC_Marshalling#IPC_buffers]]. Note that a pointer buffer cannot be specified if ReplyTargetSessionHandle is not zero.&lt;br /&gt;
&lt;br /&gt;
After being validated, passed handles will be enumerated in order; even if a session has been closed, if one that appears earlier in the list has an incoming message, it will take priority and a result code of 0x0 will be returned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Either a session has an incoming message or a port has an incoming connection. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. No handles were signalled before the timeout expired. HandleIndex is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf601:&#039;&#039;&#039; Port remote dead. One of the sessions has been closed. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X6 || R5, R6 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;WritableEvent&amp;gt; || WritableEventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapPhysicalMemory]] except it always uses pool partition 0.&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetUnsafeLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || uint64_t || Limit&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes an address range with backing memory to create the code memory object.&lt;br /&gt;
&lt;br /&gt;
The memory is initially memset to 0xFF after being locked.&lt;br /&gt;
&lt;br /&gt;
== ControlCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#CodeMemoryOperation]] || CodeMemoryOperation&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4, R5 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R6 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the backing memory for a CodeMemory object into the current process.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapOwner]], memory permission must be RW-.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapSlave]], memory permission must be R-- or R-X.&lt;br /&gt;
&lt;br /&gt;
Operations [[#CodeMemoryOperation|UnmapOwner/UnmapSlave]] unmap memory that was previously mapped this way.&lt;br /&gt;
&lt;br /&gt;
This allows one &amp;quot;secure JIT&amp;quot; process to map the code memory as RW-, and the other &amp;quot;slave&amp;quot; process to map it R-X.&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] Error 0xE401 is now returned when the process owner of the Code memory object is the same as the current process.&lt;br /&gt;
&lt;br /&gt;
== SleepSystem ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadWriteRegister ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || RegisterAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R0 || uint32_t || RwMask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R1 || uint32_t || InValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || OutValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read/write IO registers with a hardcoded whitelist. Input address is physical-address and must be aligned to 4.&lt;br /&gt;
&lt;br /&gt;
rw_mask is 0 for reading and 0xffffffff for writing. You can also write individual bits by using a mask value.&lt;br /&gt;
&lt;br /&gt;
You can only write to registers inside physical pages 0x70019000 (MC), 0x7001C000 (MC0), 0x7001D000 (MC1), and they all share the same whitelist.&lt;br /&gt;
&lt;br /&gt;
The whitelist is same for writing as for reading.&lt;br /&gt;
&lt;br /&gt;
The whitelist is:&lt;br /&gt;
&lt;br /&gt;
0x054, 0x090, 0x094, 0x098, 0x09c, 0x0a0, 0x0a4, 0x0a8, 0x0ac, 0x0b0, 0x0b4, 0x0b8, 0x0bc, 0x0c0, 0x0c4, 0x0c8, 0x0d0, 0x0d4, 0x0d8, 0x0dc, 0x0e0, 0x100, 0x108, 0x10c, 0x118, 0x11c, 0x124, 0x128, 0x12c, 0x130, 0x134, 0x138, 0x13c, 0x158, 0x15c, 0x164, 0x168, 0x16c, 0x170, 0x174, 0x178, 0x17c, 0x200, 0x204, 0x2e4, 0x2e8, 0x2ec, 0x2f4, 0x2f8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37c, 0x380, 0x390, 0x394, 0x398, 0x3ac, 0x3b8, 0x3bc, 0x3c0, 0x3c4, 0x3d8, 0x3e8, 0x41c, 0x420, 0x424, 0x428, 0x42c, 0x430, 0x44c, 0x47c, 0x480, 0x484, 0x50c, 0x554, 0x558, 0x55c, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69c, 0x6a0, 0x6a4, 0x6c0, 0x6c4, 0x6f0, 0x6f4, 0x960, 0x970, 0x974, 0xa20, 0xa24, 0xb88, 0xb8c, 0xbc4, 0xbc8, 0xbcc, 0xbd0, 0xbd4, 0xbd8, 0xbdc, 0xbe0, 0xbe4, 0xbe8, 0xbec, 0xc00, 0xc5c, 0xcac&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Whitelist was extended with 0x4c4, 0x4c8, 0x4cc, 0x584, 0x588, 0x58c.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] The IO registers in range 0x7000E400 (PMC) size 0xC00 skip the whitelist, and do a TrustZone call using [[SMC#ReadWriteRegister|ReadWriteRegister]].&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] Access to the Memory Controller (0x70019000) also uses smcReadWriteRegister.&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by that SMC, relative to the start of the PMC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x00c, 0x010, 0x014, 0x01c, 0x020, 0x02c, 0x030, 0x034, 0x038, 0x03c, 0x040, 0x044, 0x048, 0x0dc, 0x0e0, 0x0e4, 0x160, 0x164, 0x168, 0x170, 0x1a8, 0x1b8, 0x1bc, 0x1c0, 0x1c4, 0x1c8, 0x2b4, 0x2d4, 0x440, 0x4d8&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by the SMC [[SMC#ReadWriteRegister|ReadWriteRegister]] (checked in addition to the whitelist in the ReadWriteRegister SVC), relative to the start of the MC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x004, 0x008, 0x00C, 0x010, 0x01C, 0x020, 0x030, 0x034, 0x050, 0x054, 0x090, 0x094, 0x098, 0x09C, 0x0A0, 0x0A4, 0x0A8, 0x0AC, 0x0B0, 0x0B4, 0x0B8, 0x0BC, 0x0C0, 0x0C4, 0x0C8, 0x0D0, 0x0D4, 0x0D8, 0x0DC, 0x0E0, 0x100, 0x108, 0x10C, 0x118, 0x11C, 0x124, 0x128, 0x12C, 0x130, 0x134, 0x138, 0x13C, 0x158, 0x15C, 0x164, 0x168, 0x16C, 0x170, 0x174, 0x178, 0x17C, 0x200, 0x204, 0x238, 0x240, 0x244, 0x250, 0x254, 0x258, 0x264, 0x268, 0x26C, 0x270, 0x274, 0x280, 0x284, 0x288, 0x28C, 0x294, 0x2E4, 0x2E8, 0x2EC, 0x2F4, 0x2F8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37C, 0x380, 0x390, 0x394, 0x398, 0x3AC, 0x3B8, 0x3BC, 0x3C0, 0x3C4, 0x3D8, 0x3E8, 0x41C, 0x420, 0x424, 0x428, 0x42C, 0x430, 0x44C, 0x47C, 0x480, 0x484, 0x4C4, 0x4C8, 0x4CC, 0x50C, 0x554, 0x558, 0x55C, 0x584, 0x588, 0x58C, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69C, 0x6A0, 0x6A4, 0x6C0, 0x6C4, 0x6F0, 0x6F4, 0x960, 0x970, 0x974, 0x9B8, 0xA20, 0xA24, 0xA88, 0xA94, 0xA98, 0xA9C, 0xAA0, 0xAA4, 0xAA8, 0xAAC, 0xAB0, 0xAB4, 0xAB8, 0xABC, 0xAC0, 0xAC4, 0xAC8, 0xACC, 0xAD0, 0xAD4, 0xAD8, 0xADC, 0xAE0, 0xB88, 0xB8C, 0xBC4, 0xBC8, 0xBCC, 0xBD0, 0xBD4, 0xBD8, 0xBDC, 0xBE0, 0xBE4, 0xBE8, 0xBEC, 0xC00, 0xC5C, 0xCAC&lt;br /&gt;
&lt;br /&gt;
== SetProcessActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ProcessActivity]] || ProcessActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || LocalMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || RemoteMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other perm can be used to enforce permission 1, 3, or 0x10000000 if don&#039;t care.&lt;br /&gt;
&lt;br /&gt;
Allocates memory from the current process&#039; pool partition.&lt;br /&gt;
&lt;br /&gt;
== MapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error.&lt;br /&gt;
&lt;br /&gt;
== UnmapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size must match size given in map syscall, otherwise there&#039;s an invalid-size error.&lt;br /&gt;
&lt;br /&gt;
== CreateInterruptEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#Interrupt]] || Interrupt&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#InterruptType]] || InterruptType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates an event handle for the given IRQ number. Waiting on this handle will wait until the IRQ is triggered. The InterruptType argument configures the triggering. If it is 0, the IRQ is active HIGH level sensitive, if it is 1 it is rising-edge sensitive.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Flags was &amp;gt; 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF201:&#039;&#039;&#039; IRQ above 0x3FF or outside the [[NPDM#Kernel_Access_Control|IRQ access mask]] was given.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; A SlabHeap was exhausted (too many interrupts created).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF401:&#039;&#039;&#039; IRQ already has an event registered.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD201:&#039;&#039;&#039; The handle table is full. Try closing some handles.&lt;br /&gt;
&lt;br /&gt;
== QueryPhysicalAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || VirtualAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]]|| Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || PhysicalMemoryInfoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || PhysicalMemoryInfoBaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || PhysicalMemoryInfoSize&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address.&lt;br /&gt;
&lt;br /&gt;
The returned PhysicalMemoryInfoBaseAddress is the virtual address of that page-aligned mapping, while PhysicalMemoryInfoAddress is the physical address of that page. PhysicalMemoryInfoSize is the amount of continuous physical memory in that mapping.&lt;br /&gt;
&lt;br /&gt;
== QueryIoMapping ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || IoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || void* || VirtualAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a virtual address mapped to a given IO range.&lt;br /&gt;
&lt;br /&gt;
== CreateDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || DeviceAddressSpaceStartAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0, R1 || uint64_t || DeviceAddressSpaceEndAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a virtual address space for binding device address spaces and returns a handle.&lt;br /&gt;
&lt;br /&gt;
StartAddr is normally set to 0 and EndAddr is normally set to 0xFFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== AttachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attaches a device address space to a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== DetachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Detaches a device address space from a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceByForce ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]).&lt;br /&gt;
&lt;br /&gt;
The userspace destination address must have the [[SVC#MemoryState|FlagCanDeviceMap]] bit set. Bit [[SVC#MemoryAttribute|DeviceShared]] will be set after mapping.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceAligned ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState|FlagCanAlignedDeviceMap]] bit set instead.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X5 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W6 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || uint64_t || Size&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== UnmapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps an attached device address space from an userspace address.&lt;br /&gt;
&lt;br /&gt;
== InvalidateProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== StoreProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DebugActiveProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BreakDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DebugEventInfo]]* || DebugEventInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || uint32_t || [[#ContinueDebugFlags]] ([1.0.0-2.3.0] [[#ContinueDebugFlagsOld]])&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 ([1.0.0-2.3.0] R2, R3) || uint64_t* ([1.0.0-2.3.0] uint64_t)|| ThreadIdList ([1.0.0-2.3.0] ThreadId)&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || uint64_t || [3.0.0+] NumThreadIds&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maximum NumThreadIds is 64. 0 means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The process has been resumed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid debug handle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf401:&#039;&#039;&#039; Process has debug events queued or is already running.&lt;br /&gt;
&lt;br /&gt;
== GetProcessList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ProcessIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ProcessIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumProcesses&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fills the provided array with the pids of currently living processes. A process &amp;quot;lives&amp;quot; so long as it is currently running or a handle to it still exists.&lt;br /&gt;
&lt;br /&gt;
It returns the total number of processes currently alive. If this number is bigger than the size of ProcessIdBuffer, the user won&#039;t have all the pids.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xd401:&#039;&#039;&#039; The provided buffer is outside the process address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; copyToUser failed. The provided buffer is not user-accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; The provided buffer size is too big. Max value is 0xFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== GetThreadList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ThreadIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ThreadIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumThreads&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== QueryDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WriteDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetHardwareBreakPoint ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || [[#HardwareBreakPointRegisterName]] || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || Flags&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets one of the AArch64 hardware breakpoints. The nintendo switch has 6 hardware breakpoints, and 4 hardware watchpoints. The syscall has two behaviors depending on the value of HardwareBreakPointRegisterName:&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName &amp;lt; 0x10, then it sets one of the AArch64 hardware breakpoints. Flags will go to DBGBCRn_EL1, and value to DBGBVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0x7F01E1. Furthermore, the kernel will or it with 0x4004, in order to set various security flags to guarantee the watchpoints only triggers for code in EL0. If the user asks for a Breakpoint Type of ContextIDR match, the kernel shall use the given DebugHandle to set DBGBVRn_EL1 to the ContextID of the debugged process.&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName is between 0x10 and 0x20 (exclusive), then it sets one of the AArch64 hardware watchpoints. Flags will go to DBGWCRn_EL1, and the value to DBGWVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0xFF0F1FF9. Furthermore, the kernel will or it with 0x104004. This will set various security flags, and set the watchpoint type to be a Linked Watchpoint. This means that you need to link it to a Linked ContextIDR breakpoint. Check the ARM documentation for more information.&lt;br /&gt;
&lt;br /&gt;
Note that HardwareBreakPointRegisterName 0 to 4 match only to Virtual Address, while HardwareBreakPointRegisterName 5 and 6 match against either Virtual Address, ContextID, or VMID. As such, if you are configuring a breakpoint to link for a watchpoint, make sure you use hardware_breakpoint_id 5 or 6.&lt;br /&gt;
&lt;br /&gt;
For more documentation for hardware breakpoints, check out the AArch64 documentation for the [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488h/way1382455558968.html DBGBCRn_EL1 register] and the [http://infocenter.arm.com/help/topic/com.arm.doc.ddi0488h/way1382455560629.html DBGWCRn_EL1 register]&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadParam ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R3 || [[#DebugThreadParam]] || DebugThreadParam&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Out0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R3 || uint32_t || Out1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#SystemInfoType]] || SystemInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || SystemInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || SystemInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreatePort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R2 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ManageNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ConnectToPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetProcessMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Addr&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R5 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets the memory permissions for the specified memory with the supplied process handle.&lt;br /&gt;
&lt;br /&gt;
This throws an error(0xD801) when the input perm is &amp;gt;0x5, hence -WX and RWX are not allowed.&lt;br /&gt;
&lt;br /&gt;
== MapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the src address from the supplied process handle into the current process.&lt;br /&gt;
&lt;br /&gt;
This allows mapping code and rodata with RW- permission.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessMemory]].&lt;br /&gt;
&lt;br /&gt;
== QueryProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R1, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equivalent to [[#QueryMemory]] except takes a process handle.&lt;br /&gt;
&lt;br /&gt;
== MapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a process handle, and maps normal heap in that process as executable code in that process. Used when loading NROs. This does not support using the current-process handle alias.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessCodeMemory]].&lt;br /&gt;
&lt;br /&gt;
== CreateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#CreateProcessParameter]]* || CreateProcessParameter&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint32_t* || Capabilities&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || int32_t || CapabilitiesNum&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a [[#CreateProcessParameter]] as input.&lt;br /&gt;
Capabilities points to an array of [[NPDM#Kernel_Access_Control|kernel capabilities]].&lt;br /&gt;
CapabilitiesNum is a number of capabilities in the Capabilities array (number of element, not number of bytes).&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Attempted to map more code pages than available in address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Provided CodeAddr is invalid (make sure it&#039;s in range?)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The resource handle passed is invalid.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE601:&#039;&#039;&#039; Attempt to copy procinfo from user-supplied pointer failed. Attempt to copy capabilities_num from user-supplied pointer failed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE801:&#039;&#039;&#039; Attempted to create a 32-bit process with a 36-bit address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Unused bits are set in mmuflags. Unknown address space type used.&lt;br /&gt;
&lt;br /&gt;
== StartProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || MainThreadPriority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || DefaultCpuId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || MainThreadStackSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetProcessInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R2 || [[#ProcessInfoType]] || ProcessInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || [[#ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns an enum with value 0-7.&lt;br /&gt;
&lt;br /&gt;
== CreateResourceLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || int64_t || LimitValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CallSecureMonitor ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || uint64_t || [[SMC#Secure_Monitor_calls|FunctionId]]&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1-X7 || R1-R7 || uint64_t || SMC arguments&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[SMC#Result|Result]] || SMC result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1-X7 || R1-R7 || uint64_t || SMC output&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes in a SMC function ID in X0, and arguments for that SMC function in X1-X7.&lt;br /&gt;
&lt;br /&gt;
Passing an invalid SMC function ID or calling from a core other than core 3 will result in a secure monitor panic.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
== Debugging ==&lt;br /&gt;
[2.0.0+] Exactly 6 debug SVCs require that [[SPL_services#GetConfig|IsDebugMode]] is non-zero. Error 0x4201 is returned otherwise.&lt;br /&gt;
* BreakDebugProcess&lt;br /&gt;
* ContinueDebugEvent&lt;br /&gt;
* WriteDebugProcessMemory&lt;br /&gt;
* SetDebugThreadContext&lt;br /&gt;
* TerminateDebugProcess&lt;br /&gt;
* SetHardwareBreakPoint&lt;br /&gt;
&lt;br /&gt;
DebugActiveProcess stops execution of the target process, the normal method for resuming it requires ContinueDebugEvent(see above). Closing the debug handle also results in execution being resumed.&lt;br /&gt;
&lt;br /&gt;
= Enum/Structures =&lt;br /&gt;
== InfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || InfoType || InfoSubType || Description&lt;br /&gt;
|-&lt;br /&gt;
| Process || 0 || 0 || CoreMask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 1 || 0 || PriorityMask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 2 || 0 || AliasRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 3 || 0 || AliasRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 4 || 0 || HeapRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 5 || 0 || HeapRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 6 || 0 || TotalMemorySize. Total memory available(free+used).&lt;br /&gt;
|-&lt;br /&gt;
| Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap.&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 8 || 0 || DebuggerAttached&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 9 || 0 || ResourceLimit&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 10 || -1, {current coreid} || IdleTickCount&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs.&lt;br /&gt;
|-&lt;br /&gt;
| Process || 12 || 0 || [2.0.0+] AslrRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 13 || 0 || [2.0.0+] AslrRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 14 || 0 || [2.0.0+] StackRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 15 || 0 || [2.0.0+] StackRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal&lt;br /&gt;
|-&lt;br /&gt;
| Process || 17 || 0 || [3.0.0+] SystemResourceSizeUsed&lt;br /&gt;
|-&lt;br /&gt;
| Process || 18 || 0 || [3.0.0+] ProgramId&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound&lt;br /&gt;
|-&lt;br /&gt;
| Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 22 || 0 || [6.0.0+] UsedNonSystemMemorySize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 23 || 0 || [9.0.0+] IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| Process || 24 || 0 || [11.0.0+] FreeThreadCount&lt;br /&gt;
|-&lt;br /&gt;
| Thread  || 0xF0000002 || 0-3, -1 || ThreadTickCount. When 0-3 are passed, gets specific core CPU ticks spent on thread. When -1 is passed, gets total CPU ticks spent on thread.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SystemInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || SystemInfoType || SystemInfoSubType || Description&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 0 || TotalPhysicalMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 1 || TotalPhysicalMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 2 || TotalPhysicalMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 0 || UsedPhysicalMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 1 || UsedPhysicalMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 2 || UsedPhysicalMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 0 || InitialProcessIdRange_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 1 || InitialProcessIdRange_UpperBound&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ThreadContextFlags ==&lt;br /&gt;
Bitfield of one of more of these:&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 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.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || Control registers || Reads/writes the FP, LR, PC, SP, PSTATE, and TPIDR registers.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Floating-point registers || Reads/writes the floating-point vector registers.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || Floating-point control registers || Reads/writes the FPCR and FPSR registers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DeviceName ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AFI&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AVPC&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DC&lt;br /&gt;
|-&lt;br /&gt;
| 3 || DCB&lt;br /&gt;
|-&lt;br /&gt;
| 4 || HC&lt;br /&gt;
|-&lt;br /&gt;
| 5 || HDA&lt;br /&gt;
|-&lt;br /&gt;
| 6 || ISP2&lt;br /&gt;
|-&lt;br /&gt;
| 7 || MSENCNVENC&lt;br /&gt;
|-&lt;br /&gt;
| 8 || NV&lt;br /&gt;
|-&lt;br /&gt;
| 9 || NV2&lt;br /&gt;
|-&lt;br /&gt;
| 10 || PPCS&lt;br /&gt;
|-&lt;br /&gt;
| 11 || SATA&lt;br /&gt;
|-&lt;br /&gt;
| 12 || VI&lt;br /&gt;
|-&lt;br /&gt;
| 13 || VIC&lt;br /&gt;
|-&lt;br /&gt;
| 14 || XUSB_HOST&lt;br /&gt;
|-&lt;br /&gt;
| 15 || XUSB_DEV&lt;br /&gt;
|-&lt;br /&gt;
| 16 || TSEC&lt;br /&gt;
|-&lt;br /&gt;
| 17 || PPCS1&lt;br /&gt;
|-&lt;br /&gt;
| 18 || DC1&lt;br /&gt;
|-&lt;br /&gt;
| 19 || SDMMC1A&lt;br /&gt;
|-&lt;br /&gt;
| 20 || SDMMC2A&lt;br /&gt;
|-&lt;br /&gt;
| 21 || SDMMC3A&lt;br /&gt;
|-&lt;br /&gt;
| 22 || SDMMC4A&lt;br /&gt;
|-&lt;br /&gt;
| 23 || ISP2B&lt;br /&gt;
|-&lt;br /&gt;
| 24 || GPU&lt;br /&gt;
|-&lt;br /&gt;
| 25 || GPUB&lt;br /&gt;
|-&lt;br /&gt;
| 26 || PPCS2&lt;br /&gt;
|-&lt;br /&gt;
| 27 || NVDEC&lt;br /&gt;
|-&lt;br /&gt;
| 28 || APE&lt;br /&gt;
|-&lt;br /&gt;
| 29 || SE&lt;br /&gt;
|-&lt;br /&gt;
| 30 || NVJPG&lt;br /&gt;
|-&lt;br /&gt;
| 31 || HC1&lt;br /&gt;
|-&lt;br /&gt;
| 32 || SE1&lt;br /&gt;
|-&lt;br /&gt;
| 33 || AXIAP&lt;br /&gt;
|-&lt;br /&gt;
| 34 || ETR&lt;br /&gt;
|-&lt;br /&gt;
| 35 || TSECB&lt;br /&gt;
|-&lt;br /&gt;
| 36 || TSEC1&lt;br /&gt;
|-&lt;br /&gt;
| 37 || TSECB1&lt;br /&gt;
|-&lt;br /&gt;
| 38 || NVDEC1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CodeMemoryOperation ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || MapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 1 || MapSlave&lt;br /&gt;
|-&lt;br /&gt;
| 2 || UnmapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 3 || UnmapSlave&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LimitableResource ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || PhysicalMemoryMax || Bytes of memory a process may allocate.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || ThreadCountMax || Amount of threads a process can create.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || EventCountMax || Amount of events a process can create through [[#CreateEvent]] or [[#SendAsyncRequestWithUserBuffer]].&lt;br /&gt;
|-&lt;br /&gt;
| 3 || TransferMemoryCountMax || Amount of TransferMemory a process can create through [[#CreateTransferMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SessionCountMax || Amount of session a process can create through [[#CreateSession]], [[#ConnectToPort]] or [[#ConnectToNamedPort]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ThreadActivity =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessActivity ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#ProcessState|ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Created ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CreatedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Started ||&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Crashed || Processes will not enter this state unless they were created with [[#CreateProcessParameter|EnableDebug]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || StartedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Exiting ||&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Exited ||&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebugSuspended ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DebugThreadParam ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || DynamicPriority&lt;br /&gt;
|-&lt;br /&gt;
| 1 || SchedulingStatus&lt;br /&gt;
|-&lt;br /&gt;
| 2 || PreferredCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 3 || CurrentCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 4 || AffinityMask&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Dynamic priority: output in out2&lt;br /&gt;
&lt;br /&gt;
Scheduling status: out1 contains bit0: is debug-suspended, bit1: is user-suspended ([[#SetThreadActivity]] 1 or [[#SetProcessActivity]] 1).&lt;br /&gt;
Out2 contains {suspended, idle, running, terminating} =&amp;gt; {5, 0, 1, 4}&lt;br /&gt;
&lt;br /&gt;
PreferredCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
CurrentCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
AffinityMask: output in out1&lt;br /&gt;
&lt;br /&gt;
== CreateProcessParameter ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 12 || || ProcessName (doesn&#039;t have to be null-terminated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || 4 || || ProcessCategory (0: regular title, 1: kernel built-in)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 8 || || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 8 || || CodeAddr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || || CodeNumPages&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || || Flags&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit0 || Is64BitInstruction&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit3-1 || [[#AddressSpaceType]]&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit4 || [2.0.0+] EnableDebug&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit5 || EnableAslr&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit6 || IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit7 || [4.0.0] UseSecureMemory&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit10-7 || [5.0.0+] MemoryRegion (0 = Application, 1 = Applet, 2 = SecureSystem, 3 = NonSecureSystem)&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit11 || [7.0.0+] OptimizeMemoryAllocation (only allowed in combination with IsApplication)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 4 || || ResourceLimitHandle (can be zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 4 || || [3.0.0+] SystemResourceNumPages&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
On [1.0.0] there&#039;s only one MemoryRegion.&lt;br /&gt;
&lt;br /&gt;
On [2.0.0-4.0.0] MemoryRegion is 1 for built-ins and 0 for rest.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] MemoryRegion is specified in CreateProcessArgs. There are now 4 pool partitions.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory.&lt;br /&gt;
&lt;br /&gt;
The PersonalMmHeap are allocated as follows:&lt;br /&gt;
* For the application, normal insecure pool is used. Carveout 5 is used to provide protection.&lt;br /&gt;
* For the applet, a pre-allocated secure pool segment of size 0x400000 is used.&lt;br /&gt;
* For sysmodules, secure pool is allocated.&lt;br /&gt;
&lt;br /&gt;
=== AddressSpaceType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Type || Name || Width || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AddressSpace32Bit || 32 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AddressSpace64BitOld || 36 ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || AddressSpace32BitNoReserved || 32 || Appears to be missing map region [?]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [2.0.0+] AddressSpace64Bit || 39 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryInfo ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8 || BaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 8 || Size&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 4 || [[#MemoryType]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || 4 || [[#MemoryAttribute]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 4 || [[#MemoryPermission]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || 4 || IpcRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || DeviceRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || Padding: always zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryPermission ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Read || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Write || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 28 || DontCare ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryAttribute ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Locked || Used by MapMemory, as an async IPC user buffer.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || IpcLocked || True when IpcRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DeviceShared || True when DeviceRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Uncached || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Description || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 7-0 || [[#MemoryType]] || &lt;br /&gt;
|-&lt;br /&gt;
| 8 || [[#SetMemoryPermission|FlagCanReprotect]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 9 || FlagCanDebug || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || FlagCanUseIpc || Allows sending this region as an IPC A/B/W buffer with flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 11 || FlagCanUseNonDeviceIpc || Allows sending this region as an IPC A/B/W buffer with flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || FlagCanUseNonSecureIpc || Allows sending this region as an IPC A/B/W buffer with flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || FlagMapped ||&lt;br /&gt;
|-&lt;br /&gt;
| 14 || [[#SetProcessMemoryPermission|FlagCode]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 15 || [[#MapMemory|FlagCanAlias]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 16 || [[#MapProcessCodeMemory|FlagCanCodeAlias]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 17 || [[#CreateTransferMemory|FlagCanTransfer]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 18 || [[#QueryPhysicalAddress|FlagCanQueryPhysical]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 19 || [[#MapDeviceAddressSpace|FlagCanDeviceMap]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 20 || [[#MapDeviceAddressSpaceAligned|FlagCanAlignedDeviceMap]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 21 || [[#SendSyncRequestWithUserBuffer|FlagCanIpcUserBuffer]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 22 || FlagReferenceCounted || The physical memory blocks backing this region are refcounted.&lt;br /&gt;
|-&lt;br /&gt;
| 23 || [[#MapProcessMemory|FlagCanMapProcess]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 24 || [[#SetMemoryAttribute|FlagCanChangeAttribute]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 25 || [4.0.0+] [[#CreateCodeMemory|FlagCanCodeMemory]] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== MemoryType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000000 || Free ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002001 || Io || Mapped by kernel capability parsing in [[#CreateProcess]]. &lt;br /&gt;
|-&lt;br /&gt;
| 0x00042002 || Static || Mapped by kernel capability parsing in [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DC7E03 || Code || Mapped during [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FEBD04&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FEBD04&lt;br /&gt;
|| CodeData || Transition from 0xDC7E03 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
0x017EBD05&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x037EBD05&lt;br /&gt;
|| Normal || Mapped using [[#SetHeapSize]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402006 || Shared || Mapped using [[#MapSharedMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00482907 || [1.0.0] Alias || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DD7E08 || AliasCode || Mapped using [[#MapProcessCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FFBD09&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FFBD09&lt;br /&gt;
|| AliasCodeData || Transition from 0xDD7E08 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0A || [[IPC_Marshalling|Ipc]] || IPC buffers with descriptor flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0B || Stack || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040200C || [[Thread Local Storage|ThreadLocal]] || Mapped during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C380E || SharedTransfered || Mapped using [[#MapTransferMemory]] when the owning process has perm!=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000010 || Inaccessible ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002013 || Kernel || Mapped in kernel during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402214 || [4.0.0+] GeneratedCode || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402015 || [4.0.0+] CodeOut || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ArbitrationType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || WaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || DecrementAndWaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || WaitIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SignalType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || Signal&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || SignalAndIncrementIfEqual&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || SignalAndModifyBasedOnWaitingThreadCountIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlagsOld ==&lt;br /&gt;
[1.0.0-2.3.0]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: ResumeAllThreads or debug-suspended-thread-id needed)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || SwallowException&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || ResumeAllThreads&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlags ==&lt;br /&gt;
[3.0.0+]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: doesn&#039;t need to be set in the same call than Resume)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || DontCatchExceptions&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Resume&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || IgnoreOtherThreadsExceptions&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
IgnoreExceptionsOfOthers is like IgnoreException but acts on all threads that aren&#039;t in the input list. The affected threads are resumed.&lt;br /&gt;
&lt;br /&gt;
Only one of of Resume and IgnoreOtherThreadsExceptions can be set at a time.&lt;br /&gt;
&lt;br /&gt;
If the input number of threads is 0, this means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== DebugEventInfo ==&lt;br /&gt;
The below table is for the Aarch64 version of the system call. For A32, all u64 fields but title/process/thread id are actually u32, making the structure 0x28-byte-big (0x40 for a64).&lt;br /&gt;
&lt;br /&gt;
Size: 0x40&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || u32 || EventType&lt;br /&gt;
|-&lt;br /&gt;
| 4 || u32 || Flags (bit0: NeedsContinue)&lt;br /&gt;
|-&lt;br /&gt;
| 8 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || || PerTypeSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachProcess specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || char[12] || ProcessName&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || u32 || MmuFlags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || [5.0.0+] UserExceptionContextAddr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachThread specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || TlsPtr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u64 || Entrypoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exit specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32|| Type (0=PausedThread, 1=RunningThread, 2=ExitedProcess, 3=TerminatedProcess)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exception specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32 || ExceptionType&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || FaultRegister&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || || PerExceptionSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugEventType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AttachProcess&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AttachThread&lt;br /&gt;
|-&lt;br /&gt;
| 2 || ExitProcess&lt;br /&gt;
|-&lt;br /&gt;
| 3 || ExitThread&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Exception&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugExceptionType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Trap (*)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || InstructionAbort&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DataAbortMisc (**)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || PcSpAlignmentFault&lt;br /&gt;
|-&lt;br /&gt;
| 4 || DebuggerAttached&lt;br /&gt;
|-&lt;br /&gt;
| 5 || BreakPoint&lt;br /&gt;
|-&lt;br /&gt;
| 6 || UserBreak&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebuggerBreak&lt;br /&gt;
|-&lt;br /&gt;
| 8 || BadSvcId&lt;br /&gt;
|-&lt;br /&gt;
| 9 || [2.0.0+] SError&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Undefined instructions, software breakpoints, some other traps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; Data aborts, FP traps, and everything else that doesn&#039;t belong to any of the above.&lt;br /&gt;
&lt;br /&gt;
Trap specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Opcode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BreakPoint specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || IsWatchpoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
UserBreak specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Info0&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || u64 || Info1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || Info2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BadSvcId specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || SvcId&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Exception handling =&lt;br /&gt;
First of all, a function that might be called by synchronous exception handler and that is called by the SError handler fetches the exception info, adjusts PC, panics on exceptions taken from EL1, then dispatches the exception.&lt;br /&gt;
&lt;br /&gt;
The dispatcher has two mutually exclusive exception reporting methods:&lt;br /&gt;
* by storing information at the start of the process&#039;s TLS memregion (TPIDRRO_EL0) and jumping back to the crt0&lt;br /&gt;
* by using KDebug&lt;br /&gt;
&lt;br /&gt;
KDebug dispatching is used when at least one of the following conditions are met:&lt;br /&gt;
* SMC ConfigItem KernelMemConfig bit 1 is NOT set (it isn&#039;t on retail), unless: this is a software or hardware breakpoint, or a watchpoint, or [4.0.0+?] the process is attached and this is a Google PNaCl trap instruction (see LLVM source)&lt;br /&gt;
* FAR doesn&#039;t point to a valid address in mapped-readable CodeStatic memory (i.e. this is the case for NRO and JIT memory) or this is one of the following exceptions (it particular, that doesn&#039;t include FP exceptions occurring in CodeStatic memory):&lt;br /&gt;
** Uncategorized&lt;br /&gt;
** IllegalState&lt;br /&gt;
** SupervisorCallA32&lt;br /&gt;
** SupervisorCallA64&lt;br /&gt;
** PCAlignment&lt;br /&gt;
** SPAlignment&lt;br /&gt;
** SError&lt;br /&gt;
** BreakpointLowerEl&lt;br /&gt;
** SoftwareStepLowerEl (note: no way set single-step flag; not parsed)&lt;br /&gt;
** WatchpointLowerEl&lt;br /&gt;
** SoftwareBreakpointA32 (note: not parsed)&lt;br /&gt;
** SoftwareBreakpointA64 (note: not parsed)&lt;br /&gt;
    &lt;br /&gt;
In all other cases the userland-handled exception path is taken.&lt;br /&gt;
&lt;br /&gt;
KDebug path:&lt;br /&gt;
&lt;br /&gt;
If the process is attached, the exception is reported to the KDebug. If the thread was continued using flag IgnoreExceptions, it returns from the exception as if nothing happened.&lt;br /&gt;
&lt;br /&gt;
If the latter is not the case, or if the process isn&#039;t attached, proceed to [2.0.0+] crash reporting (or in [1.0.0] just terminate the process): &lt;br /&gt;
if EnableDebug is set, and depending on the process state (more than one crash per process isn&#039;t permitted) it may signal itself with ProcessState_Crashed so that PM asks NS to start creport so that creport attaches to it and reports the crashes. Otherwise, just terminate.&lt;br /&gt;
&lt;br /&gt;
Userland reporting path and [[#ReturnFromException]]:&lt;br /&gt;
&lt;br /&gt;
TLS region start (A64):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x148 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x78 || ExceptionFrameA64&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA64:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x48 (8*9) || GPRs 0..8.&lt;br /&gt;
|-&lt;br /&gt;
| 0x48 || 0x8 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || 0x8 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || 0x8 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || 0x4 || pstate &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || 0x8 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
TLS region start (A32):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x178 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x44 || ExceptionFrameA32&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA32:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x20 (8*4) || GPRs 0..7.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 0x4 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 0x4 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 0x4 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 0x4 || tpidr_el0 = 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || 0x4 || cpsr &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x34 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x38 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || 0x4 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In that case, after storing the regs in the TLS, the exception handler returns to the application&#039;s crt0 (entrypoint), with X0=&amp;lt;error description code&amp;gt; (see below) and X1=SP=frame=&amp;lt;stack top&amp;gt; (see above)&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Desc. code || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x100 || Instruction abort&lt;br /&gt;
|-&lt;br /&gt;
| 0x102 || Misaligned PC&lt;br /&gt;
|-&lt;br /&gt;
| 0x103 || Misaligned SP&lt;br /&gt;
|-&lt;br /&gt;
| 0x106 || [2.0.0+] SError&lt;br /&gt;
|-&lt;br /&gt;
| 0x301 || Bad SVC&lt;br /&gt;
|-&lt;br /&gt;
| 0x104 || Uncategorized, CP15RTTrap, CP15RRTTrap, CP14RTTrap, CP14RRTTrap, IllegalState, SystemRegisterTrap&lt;br /&gt;
|-&lt;br /&gt;
| 0x101 || None of the above, EC &amp;lt;= 0x34 and not a breakpoint&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(During normal app boot the process is invoked with X0=0 and X1=main_thread_handle. The crt0 of retail apps determines whether to boot normally or handle an exception if X0 is set to 0 or not)&lt;br /&gt;
&lt;br /&gt;
The application is supposed to promptly update the contents of elr_el1 to a user handler (and any other regs it sees fit) and call [[#ReturnFromException]] (error code) to call that handler. The latter is then expected to promptly abort the program.&lt;br /&gt;
&lt;br /&gt;
[[#ReturnFromException]] updates the contents of the kernel stack frame with what the user provided in the TLS structure, sets TPIDR_EL0 to 1, then:&lt;br /&gt;
* if the provided error code is 0, gracefully pivots and returns from exception&lt;br /&gt;
* if it is not, replays the exception and pass it to the KDebug (see above). One can pass 0x10001 to prevent process termination. If the process is attached, this also prevents crash-collection/termination (different from the exception handler behavior)&lt;br /&gt;
&lt;br /&gt;
If an exception occurs from the above user handler, the entire exception handling process will repeat with the new exception.&lt;br /&gt;
&lt;br /&gt;
Note that if a thread that wasn&#039;t faulting calls [[#ReturnFromException]], it signals an &amp;quot;invalid syscall&amp;quot; exception&lt;br /&gt;
&lt;br /&gt;
Note that [[SMC|IsDebugMode]] is not used during exception-handling, except for enabling printing a message to UART-A. This UART code causes a system-hang on retail (likely due to a loop that doesn&#039;t exit). This printing doesn&#039;t seem to run when the process is attached for debugging?&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=SVC&amp;diff=10703</id>
		<title>SVC</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=SVC&amp;diff=10703"/>
		<updated>2021-02-20T05:36:22Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: WaitForAddress and SignalToAddress have a Result returned in W0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
= System calls =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! ID || Return Type || Name || Arguments&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || Result || [[#SetHeapSize|SetHeapSize]] || uintptr_t *out_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || Result || [[#SetMemoryPermission|SetMemoryPermission]] || uintptr_t address, size_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || Result || [[#SetMemoryAttribute|SetMemoryAttribute]] || uintptr_t address, size_t size, uint32_t mask, uint32_t attr&lt;br /&gt;
|-&lt;br /&gt;
| 0x04 || Result || [[#MapMemory|MapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x05 || Result || [[#UnmapMemory|UnmapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x06 || Result || [[#QueryMemory|QueryMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x07 || void || [[#ExitProcess|ExitProcess]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x08 || Result || [[#CreateThread|CreateThread]] || Handle *out_handle, ThreadFunc func, uintptr_t arg, uintptr_t stack_bottom, int32_t priority, int32_t core_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x09 || Result || [[#StartThread|StartThread]] || Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A || void || [[#ExitThread|ExitThread]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x0B || void || [[#SleepThread|SleepThread]] || int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || Result || [[#GetThreadPriority|GetThreadPriority]] || int32_t *out_priority, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D || Result || [[#SetThreadPriority|SetThreadPriority]] || Handle thread_handle, int32_t priority&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E || Result || [[#GetThreadCoreMask|GetThreadCoreMask]] || int32_t *out_core_id, uint64_t *out_affinity_mask, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F || Result || [[#SetThreadCoreMask|SetThreadCoreMask]] || Handle thread_handle, int32_t core_id, uint64_t affinity_mask&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || int32_t || [[#GetCurrentProcessorNumber|GetCurrentProcessorNumber]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x11 || Result || [[#SignalEvent|SignalEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x12 || Result || [[#ClearEvent|ClearEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x13 || Result || [[#MapSharedMemory|MapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || Result || [[#UnmapSharedMemory|UnmapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x15 || Result || [[#CreateTransferMemory|CreateTransferMemory]] || Handle *out_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x16 || Result || [[#CloseHandle|CloseHandle]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x17 || Result || [[#ResetSignal|ResetSignal]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || Result || [[#WaitSynchronization|WaitSynchronization]] || int32_t *out_index, const Handle *handles, int32_t numHandles, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x19 || Result || [[#CancelSynchronization|CancelSynchronization]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A || Result || [[#ArbitrateLock|ArbitrateLock]] || Handle thread_handle, uintptr_t address, uint32_t tag&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B || Result || [[#ArbitrateUnlock|ArbitrateUnlock]] || uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || Result || [[#WaitProcessWideKeyAtomic|WaitProcessWideKeyAtomic]] || uintptr_t address, uintptr_t cv_key, uint32_t tag, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D || void || [[#SignalProcessWideKey|SignalProcessWideKey]] || uintptr_t cv_key, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E || int64_t || [[#GetSystemTick|GetSystemTick]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x1F || Result || [[#ConnectToNamedPort|ConnectToNamedPort]] || Handle *out_handle, const char *name&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Result || [[#SendSyncRequestLight|SendSyncRequestLight]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x21 || Result || [[#SendSyncRequest|SendSyncRequest]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x22 || Result || [[#SendSyncRequestWithUserBuffer|SendSyncRequestWithUserBuffer]] || uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x23 || Result || [[#SendAsyncRequestWithUserBuffer|SendAsyncRequestWithUserBuffer]] || Handle *out_event_handle, uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || Result || [[#GetProcessId|GetProcessId]] || uint64_t *out_process_id, Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x25 || Result || [[#GetThreadId|GetThreadId]] || uint64_t *out_thread_id, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x26 || void || [[#Break|Break]] || BreakReason break_reason, uintptr_t arg, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x27 || Result || [[#OutputDebugString|OutputDebugString]] || const char *debug_str, size_t len&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || void || [[#ReturnFromException|ReturnFromException]] || Result result&lt;br /&gt;
|-&lt;br /&gt;
| 0x29 || Result || [[#GetInfo|GetInfo]] || uint64_t *out, InfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x2A || void || [[#FlushEntireDataCache|FlushEntireDataCache]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x2B || Result || [[#FlushDataCache|FlushDataCache]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2C  || Result || [[#MapPhysicalMemory|MapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2D  || Result || [[#UnmapPhysicalMemory|UnmapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0-5.1.0] 0x2E  || Result || GetFutureThreadInfo || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags, int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| [6.0.0+] 0x2E  || Result || [[#GetDebugFutureThreadInfo|GetDebugFutureThreadInfo]] || arch::LastThreadContext *out_context, uint64_t *thread_id, Handle debug_handle, int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x2F || Result || [[#GetLastThreadInfo|GetLastThreadInfo]] || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || Result || [[#GetResourceLimitLimitValue|GetResourceLimitLimitValue]] || int64_t *out_limit_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x31 || Result || [[#GetResourceLimitCurrentValue|GetResourceLimitCurrentValue]] || int64_t *out_current_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x32 || Result || [[#SetThreadActivity|SetThreadActivity]] || Handle thread_handle, ThreadActivity thread_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x33  || Result || [[#GetThreadContext3|GetThreadContext3]] || ThreadContext *out_context, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x34 || Result || [[#WaitForAddress|WaitForAddress]] || uintptr_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x35 || Result || [[#SignalToAddress|SignalToAddress]] || uintptr_t address, SignalType signal_type, int32_t value, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| [8.0.0+] 0x36 || void || [[#SynchronizePreemptionState|SynchronizePreemptionState]] || &lt;br /&gt;
|-&lt;br /&gt;
| [11.0.0+] 0x37 || Result || [[#GetResourceLimitPeakValue|GetResourceLimitPeakValue]] || int64_t *out_peak_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [1.0.0-3.0.2] 0x3C || void || [[#DumpInfo|DumpInfo]] || DumpInfoType dump_info_type, uint64_t arg&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3C || void || [[#KernelDebug|KernelDebug]] || KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3D || void || [[#ChangeKernelTraceState|ChangeKernelTraceState]] || KernelTraceState kern_trace_state&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| 0x40 || Result || [[#CreateSession|CreateSession]] || Handle *out_server_session_handle, Handle *out_client_session_handle, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x41 || Result || [[#AcceptSession|AcceptSession]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x42 || Result || [[#ReplyAndReceiveLight|ReplyAndReceiveLight]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x43 || Result || [[#ReplyAndReceive|ReplyAndReceive]] || int32_t *out_index, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x44 || Result || [[#ReplyAndReceiveWithUserBuffer|ReplyAndReceiveWithUserBuffer]] || int32_t *out_index, uintptr_t message_buffer, size_t message_buffer_size, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x45 || Result || [[#CreateEvent|CreateEvent]] || Handle *out_write_handle, Handle *out_read_handle&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x48 || Result || [[#MapPhysicalMemoryUnsafe|MapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x49 || Result || [[#UnmapPhysicalMemoryUnsafe|UnmapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x4A || Result || [[#SetUnsafeLimit|SetUnsafeLimit]] || size_t limit&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4B || Result || [[#CreateCodeMemory|CreateCodeMemory]] || Handle *out_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4C || Result || [[#ControlCodeMemory|ControlCodeMemory]] || Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x4D || void || [[#SleepSystem|SleepSystem]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x4E || Result || [[#ReadWriteRegister|ReadWriteRegister]] || uint32_t *out_value, PhysicalAddress address, uint32_t mask, uint32_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x4F || Result || [[#SetProcessActivity|SetProcessActivity]] || Handle process_handle, ProcessActivity process_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || Result || [[#CreateSharedMemory|CreateSharedMemory]] || Handle *out_handle, size_t size, MemoryPermission owner_perm, MemoryPermission remote_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x51 || Result || [[#MapTransferMemory|MapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size, MemoryPermission owner_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x52 || Result || [[#UnmapTransferMemory|UnmapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x53 || Result || [[#CreateInterruptEvent|CreateInterruptEvent]] || Handle *out_read_handle, int32_t interrupt_id, InterruptType interrupt_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x54 || Result || [[#QueryPhysicalAddress|QueryPhysicalAddress]] || arch::PhysicalMemoryInfo *out_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x55 || Result || [[#QueryIoMapping|QueryIoMapping]] || uintptr_t *out_address, [10.0.0+] size_t *out_size, PhysicalAddress physical_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x56 || Result || [[#CreateDeviceAddressSpace|CreateDeviceAddressSpace]] || Handle *out_handle, uint64_t das_address, uint64_t das_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x57 || Result || [[#AttachDeviceAddressSpace|AttachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || Result || [[#DetachDeviceAddressSpace|DetachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x59 || Result || [[#MapDeviceAddressSpaceByForce|MapDeviceAddressSpaceByForce]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5A || Result || [[#MapDeviceAddressSpaceAligned|MapDeviceAddressSpaceAligned]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5B || Result || [[#MapDeviceAddressSpace|MapDeviceAddressSpace]] || size_t *out_mapped_size, Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5C || Result || [[#UnmapDeviceAddressSpace|UnmapDeviceAddressSpace]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address&lt;br /&gt;
|-&lt;br /&gt;
| 0x5D || Result || [[#InvalidateProcessDataCache|InvalidateProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5E || Result || [[#StoreProcessDataCache|StoreProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5F || Result || [[#FlushProcessDataCache|FlushProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || Result || [[#DebugActiveProcess|DebugActiveProcess]] || Handle *out_handle, uint64_t process_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x61 || Result || [[#BreakDebugProcess|BreakDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x62 || Result || [[#TerminateDebugProcess|TerminateDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x63 || Result || [[#GetDebugEvent|GetDebugEvent]] || arch::DebugEventInfo *out_info, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || Result || [[#ContinueDebugEvent|ContinueDebugEvent]] || Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids&lt;br /&gt;
|-&lt;br /&gt;
| 0x65 || Result || [[#GetProcessList|GetProcessList]] || int32_t *out_num_processes, uint64_t *out_process_ids, int32_t max_out_count&lt;br /&gt;
|-&lt;br /&gt;
| 0x66 || Result || [[#GetThreadList|GetThreadList]] || int32_t *out_num_threads, uint64_t *out_thread_ids, int32_t max_out_count, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x67 || Result || [[#GetDebugThreadContext|GetDebugThreadContext]] || ThreadContext *out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || Result || [[#SetDebugThreadContext|SetDebugThreadContext]] || Handle debug_handle, uint64_t thread_id, const ThreadContext *context, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x69 || Result || [[#QueryDebugProcessMemory|QueryDebugProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x6A || Result || [[#ReadDebugProcessMemory|ReadDebugProcessMemory]] || uintptr_t buffer, Handle debug_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6B || Result || [[#WriteDebugProcessMemory|WriteDebugProcessMemory]] || Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || Result || [[#SetHardwareBreakPoint|SetHardwareBreakPoint]] || HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x6D || Result || [[#GetDebugThreadParam|GetDebugThreadParam]] || uint64_t *out_64, uint32_t *out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x6F || Result || [[#GetSystemInfo|GetSystemInfo]] || uint64_t *out, SystemInfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || Result || [[#CreatePort|CreatePort]] || Handle *out_server_handle, Handle *out_client_handle, int32_t max_sessions, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x71 || Result || [[#ManageNamedPort|ManageNamedPort]] || Handle *out_server_handle, const char *name, int32_t max_sessions&lt;br /&gt;
|-&lt;br /&gt;
| 0x72 || Result || [[#ConnectToPort|ConnectToPort]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x73 || Result || [[#SetProcessMemoryPermission|SetProcessMemoryPermission]] || Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x74 || Result || [[#MapProcessMemory|MapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x75 || Result || [[#UnmapProcessMemory|UnmapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x76 || Result || [[#QueryProcessMemory|QueryProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uint64_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x77 || Result || [[#MapProcessCodeMemory|MapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x78 || Result || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x79 || Result || [[#CreateProcess|CreateProcess]] || Handle *out_handle, const arch::CreateProcessParameter *parameters, const uint32_t *caps, int32_t num_caps&lt;br /&gt;
|-&lt;br /&gt;
| 0x7A || Result || [[#StartProcess|StartProcess]] || Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x7B || Result || [[#TerminateProcess|TerminateProcess]] || Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7C || Result || [[#GetProcessInfo|GetProcessInfo]] || int64_t *out_info, Handle process_handle, ProcessInfoType info_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x7D || Result || [[#CreateResourceLimit|CreateResourceLimit]] || Handle *out_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7E || Result || [[#SetResourceLimitLimitValue|SetResourceLimitLimitValue]] || Handle resource_limit_handle, LimitableResource which, int64_t limit_value&lt;br /&gt;
|-&lt;br /&gt;
| 0x7F || void || [[#CallSecureMonitor|CallSecureMonitor]] || SecureMonitorArguments *args&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SetHeapSize ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint32_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || void* || HeapAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the process heap to a given Size. It can both extend and shrink the heap.&lt;br /&gt;
&lt;br /&gt;
Size must be a multiple of 0x200000 (2MB).&lt;br /&gt;
&lt;br /&gt;
On success, the heap base-address (which is fixed by kernel, aslr&#039;d, and always in the Heap memory region) is written to HeapAddress.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition. The memory allocated counts towards the caller&#039;s process Memory ResourceLimit.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Size must be less than or equal to 4GB.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Invalid size passed. It&#039;s either bigger than 4GB, or misaligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD001:&#039;&#039;&#039; Size is bigger than the Heap Region size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; KMemoryBlockAllocator slab allocator exhausted.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The memory region is in an invalid state. Likely because a mapping was made in the heap region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x10801:&#039;&#039;&#039; Memory resource limit reached.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes permission of page-aligned memory region.&lt;br /&gt;
&lt;br /&gt;
Bit2 of permission (exec) is not allowed. Setting write-only is not allowed either (bit1).&lt;br /&gt;
&lt;br /&gt;
This can be used to move back and forth between ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The memory region was reprotected.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Unaligned address specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Unaligned or zero size specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The provided memory region does not fall within the userland address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD801:&#039;&#039;&#039; Invalid permission specified. Valid permissions are ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The provided memory region was in an invalid state. The region must have the [[#MemoryState|FlagCanReprotect]] state, and must not have the [[#MemoryAttribute|Locked]] or [[#MemoryAttribute|Uncached]] attributes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; Kernel resource exhausted.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryAttribute ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Mask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes attribute of page-aligned memory region. The only allowed combination of Value and Mask is 0x8, which means only bit3 in [[#MemoryAttribute]] can be set or cleared.&lt;br /&gt;
&lt;br /&gt;
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU.&lt;br /&gt;
&lt;br /&gt;
What happens &amp;quot;under the hood&amp;quot; is the &amp;quot;Memory Attribute Indirection Register&amp;quot; index is changed from 2 to 3 in the MMU descriptor.&lt;br /&gt;
&lt;br /&gt;
== MapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps a memory range into a different range.&lt;br /&gt;
&lt;br /&gt;
Mainly used for adding guard pages around stack.&lt;br /&gt;
&lt;br /&gt;
Source range gets reprotected to --- (it can no longer be accessed), and bit0 is set in the source [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
[1.0.0] This could be used to map into either the Alias Region or the Stack region.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] This can only be used to map into the Stack region.&lt;br /&gt;
&lt;br /&gt;
Code can get the range of the Alias region from [[#GetInfo]] id0=2,3, and on 2.0.0+ the range of the Stack region via [[#GetInfo]] id0=14, 15 (on 1.0.0, the Stack region had hardcoded limits).&lt;br /&gt;
&lt;br /&gt;
When mapped into the Alias region, the mapped memory will have state 0x482907.&lt;br /&gt;
&lt;br /&gt;
When mapped into the Stack region, the mapped memory will have state 0x5C3C0B.&lt;br /&gt;
&lt;br /&gt;
== UnmapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps a region that was previously mapped with [[#MapMemory]].&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to unmap ranges partially, you don&#039;t need to unmap the entire range &amp;quot;in one go&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The srcaddr/dstaddr must match what was given when the pages were originally mapped.&lt;br /&gt;
&lt;br /&gt;
== QueryMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address.&lt;br /&gt;
&lt;br /&gt;
Outputs a [[#MemoryInfo]] struct.&lt;br /&gt;
&lt;br /&gt;
== ExitProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current process.&lt;br /&gt;
&lt;br /&gt;
== CreateThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void(*)(void*) || Entry&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || void* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || void* || StackTop&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || int32_t || ProcessorId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a thread in the current process.&lt;br /&gt;
&lt;br /&gt;
ProcessorId must be 0,1,2,3 or -2, where -2 uses the default CpuId for process.&lt;br /&gt;
&lt;br /&gt;
== StartThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starts the thread for the provided handle.&lt;br /&gt;
&lt;br /&gt;
== ExitThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current thread.&lt;br /&gt;
&lt;br /&gt;
== SleepThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0, R1 || uint64_t || Nanoseconds&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sleeps for a specified amount of time, or yields the thread.&lt;br /&gt;
&lt;br /&gt;
Setting nanoseconds to 0, -1, or -2 indicates a yielding type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Yielding without core migration&lt;br /&gt;
|-&lt;br /&gt;
| -1 || Yielding with core migration&lt;br /&gt;
|-&lt;br /&gt;
| -2 || Yielding to any other thread&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || int32_t || Priority&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
Priority is a number 0-0x3F. Lower value means higher priority.&lt;br /&gt;
&lt;br /&gt;
== GetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== GetCurrentProcessorNumber ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || uint32_t || CpuId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets which cpu is executing the current thread.&lt;br /&gt;
&lt;br /&gt;
CpuId is an integer in the range 0-3.&lt;br /&gt;
&lt;br /&gt;
== SignalEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puts the given event in the signaled state.&lt;br /&gt;
&lt;br /&gt;
Will wake up any thread currently waiting on this event. Can potentially trigger a reschedule.&lt;br /&gt;
&lt;br /&gt;
Any calls to [[#WaitSynchronization]] on this handle will return immediately, until the event&#039;s signaled state is reset.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Event is now in signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
== ClearEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; or Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes the given event out of the signaled state.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success, the event is now in the not-signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not in a signaled state.&lt;br /&gt;
&lt;br /&gt;
== MapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== UnmapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
Executable bit perm not allowed.&lt;br /&gt;
&lt;br /&gt;
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.&lt;br /&gt;
&lt;br /&gt;
== CloseHandle ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResetSignal ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;ReadableEvent&amp;gt; or Handle&amp;lt;Process&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Resets the signal on the given handle, ensuring future calls to [[#WaitSynchronization]] on this handle will sleep until the handle is signaled again. If the handle is a ReadableEvent, this is equivalent to calling ClearEvent() on the handle.&lt;br /&gt;
&lt;br /&gt;
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 ResetSignal on the process will no longer have an effect (the process is permanently signaled), and the syscall will return 0xFA01.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The signal was reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The handle is invalid or of the wrong type.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not signaled, or the process is in exited state, causing it to be permanently signaled.&lt;br /&gt;
&lt;br /&gt;
== WaitSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle* || HandlesPtr&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || HandlesNum&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint64_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Works with HandlesNum &amp;lt;= 0x40.&lt;br /&gt;
&lt;br /&gt;
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.&lt;br /&gt;
&lt;br /&gt;
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.&lt;br /&gt;
&lt;br /&gt;
=== Object types ===&lt;br /&gt;
&#039;&#039;&#039;KDebug:&#039;&#039;&#039; signals when there is a new [[#DebugEventInfo|DebugEvent]] (retrievable via [[#GetDebugEvent]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KClientPort:&#039;&#039;&#039; signals when the number of sessions is less than the maximum allowed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KProcess:&#039;&#039;&#039; signals when the process undergoes a state change (retrievable via [[#GetProcessInfo]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KReadableEvent:&#039;&#039;&#039; signals when the event&#039;s corresponding KWritableEvent has been signaled via [[#SignalEvent]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerPort:&#039;&#039;&#039; signals when there is an incoming connection waiting to be [[#AcceptSession|accepted]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerSession:&#039;&#039;&#039; signals when there is an incoming message waiting to be [[#ReplyAndReceive|received]] or the pipe is closed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KThread:&#039;&#039;&#039; signals when the thread has exited.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x7601:&#039;&#039;&#039; Thread termination requested. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xec01:&#039;&#039;&#039; Interrupted. Returned when another thread uses [[#CancelSynchronization]] to cancel this thread. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; Too many handles. Returned when the number of handles passed is &amp;gt; 0x40.&lt;br /&gt;
&lt;br /&gt;
== CancelSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the referenced thread is currently in a synchronization call ([[#WaitSynchronization]], [[#ReplyAndReceive]] or [[#ReplyAndReceiveLight]]), that call will be interrupted and return 0xec01.&lt;br /&gt;
If that thread is not currently executing such a synchronization call, the next call to a synchronization call will return 0xec01.&lt;br /&gt;
&lt;br /&gt;
This doesn&#039;t take force-pause (activity/debug pause) into account.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The thread was either interrupted or has had its flag set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. The handle given was either invalid or not a thread handle.&lt;br /&gt;
&lt;br /&gt;
== ArbitrateLock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;                                  &lt;br /&gt;
&lt;br /&gt;
== ArbitrateUnlock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitProcessWideKeyAtomic ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || KeyAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || TagAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalProcessWideKey ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || int32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemTick ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0, R1 || uint64_t || Ticks&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the value of cntpct_el0.&lt;br /&gt;
&lt;br /&gt;
The frequency is 19200000 Hz (constant from official sw).&lt;br /&gt;
&lt;br /&gt;
Official sw reads cntpct_el0 directly from usermode without using this SVC. [[ExeFS|sdk-nso]] has this SVC, but it&#039;s not known to be called anywhere.&lt;br /&gt;
&lt;br /&gt;
== ConnectToNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || PortName&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequest ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xcc01:&#039;&#039;&#039; Address is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xca01:&#039;&#039;&#039; Size is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xce01:&#039;&#039;&#039; KSessionRequest allocation failed (unlikely) or pointer buffer size exceeded.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Handles does not exist, or handle is not an instance of KClientSession.&lt;br /&gt;
&lt;br /&gt;
== SendAsyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
== GetProcessId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ProcessId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ThreadId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Break ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#BreakReason]] || BreakReason&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Info&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the process is attached, report the Break event. Then, if [[#ContinueDebugEvent]] didn&#039;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).&lt;br /&gt;
&lt;br /&gt;
Otherwise, if bit31 in reason isn&#039;t set, perform crash reporting (see Exception Handling section below), if it doesn&#039;t terminate the process adjust ELR_EL1 as well.&lt;br /&gt;
&lt;br /&gt;
Otherwise just return 0.&lt;br /&gt;
&lt;br /&gt;
== OutputDebugString ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || char* || String&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReturnFromException ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#InfoType]] || InfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || uint64_t || InfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Info&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushEntireDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Acts like [[#SetHeapSize]] except you can allocate heap at any address you&#039;d like.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Invalid size passed. It&#039;s either zero or not 4k-aligned&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Invalid address. (not 4k-aligned)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xDC01:&#039;&#039;&#039; Invalid memory range. It&#039;s either causes overflow, or does not fall into &amp;quot;reserved&amp;quot; address range (aka Alias). See AliasRegionAddress at [[#InfoType]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; Invalid state. (not enough SystemResource (see [[NPDM#SystemResourceSize]]))&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugFutureThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetLastThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || LimitValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitCurrentValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || CurrentValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetThreadActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ThreadActivity]] || ThreadActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadContext3 ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitForAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#ArbitrationType]] || ArbitrationType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalToAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#SignalType]] || SignalType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || uint32_t || NumToSignal&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SynchronizePreemptionState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitPeakValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || PeakValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DumpInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DumpInfoType]] || DumpInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || DumpInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] This function was removed and replaced by [[#KernelDebug]].&lt;br /&gt;
&lt;br /&gt;
== KernelDebug ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelDebugType]] || KernelDebugType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== ChangeKernelTraceState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelTraceState]] || KernelTraceState&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== CreateSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ClientSession&amp;gt; || ClientSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== AcceptSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || PortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0xf201:&#039;&#039;&#039; No session waiting to be accepted&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Port&amp;gt; or Handle&amp;lt;ServerSession&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceive ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is not zero, a reply from the TLS will be sent to that session.&lt;br /&gt;
Then it will wait until either of the passed sessions has an incoming message, is closed, a passed port has an incoming connection, or the timeout expires.&lt;br /&gt;
If there is an incoming message, it is copied to the TLS.&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is zero, the TLS should contain a blank message. If this message has a C descriptor, the buffer it points to will be used as the pointer buffer. See [[IPC_Marshalling#IPC_buffers]]. Note that a pointer buffer cannot be specified if ReplyTargetSessionHandle is not zero.&lt;br /&gt;
&lt;br /&gt;
After being validated, passed handles will be enumerated in order; even if a session has been closed, if one that appears earlier in the list has an incoming message, it will take priority and a result code of 0x0 will be returned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Either a session has an incoming message or a port has an incoming connection. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. No handles were signalled before the timeout expired. HandleIndex is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf601:&#039;&#039;&#039; Port remote dead. One of the sessions has been closed. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X6 || R5, R6 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;WritableEvent&amp;gt; || WritableEventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapPhysicalMemory]] except it always uses pool partition 0.&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetUnsafeLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || uint64_t || Limit&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes an address range with backing memory to create the code memory object.&lt;br /&gt;
&lt;br /&gt;
The memory is initially memset to 0xFF after being locked.&lt;br /&gt;
&lt;br /&gt;
== ControlCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#CodeMemoryOperation]] || CodeMemoryOperation&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4, R5 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R6 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the backing memory for a CodeMemory object into the current process.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapOwner]], memory permission must be RW-.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapSlave]], memory permission must be R-- or R-X.&lt;br /&gt;
&lt;br /&gt;
Operations [[#CodeMemoryOperation|UnmapOwner/UnmapSlave]] unmap memory that was previously mapped this way.&lt;br /&gt;
&lt;br /&gt;
This allows one &amp;quot;secure JIT&amp;quot; process to map the code memory as RW-, and the other &amp;quot;slave&amp;quot; process to map it R-X.&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] Error 0xE401 is now returned when the process owner of the Code memory object is the same as the current process.&lt;br /&gt;
&lt;br /&gt;
== SleepSystem ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadWriteRegister ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || RegisterAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R0 || uint32_t || RwMask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R1 || uint32_t || InValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || OutValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read/write IO registers with a hardcoded whitelist. Input address is physical-address and must be aligned to 4.&lt;br /&gt;
&lt;br /&gt;
rw_mask is 0 for reading and 0xffffffff for writing. You can also write individual bits by using a mask value.&lt;br /&gt;
&lt;br /&gt;
You can only write to registers inside physical pages 0x70019000 (MC), 0x7001C000 (MC0), 0x7001D000 (MC1), and they all share the same whitelist.&lt;br /&gt;
&lt;br /&gt;
The whitelist is same for writing as for reading.&lt;br /&gt;
&lt;br /&gt;
The whitelist is:&lt;br /&gt;
&lt;br /&gt;
0x054, 0x090, 0x094, 0x098, 0x09c, 0x0a0, 0x0a4, 0x0a8, 0x0ac, 0x0b0, 0x0b4, 0x0b8, 0x0bc, 0x0c0, 0x0c4, 0x0c8, 0x0d0, 0x0d4, 0x0d8, 0x0dc, 0x0e0, 0x100, 0x108, 0x10c, 0x118, 0x11c, 0x124, 0x128, 0x12c, 0x130, 0x134, 0x138, 0x13c, 0x158, 0x15c, 0x164, 0x168, 0x16c, 0x170, 0x174, 0x178, 0x17c, 0x200, 0x204, 0x2e4, 0x2e8, 0x2ec, 0x2f4, 0x2f8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37c, 0x380, 0x390, 0x394, 0x398, 0x3ac, 0x3b8, 0x3bc, 0x3c0, 0x3c4, 0x3d8, 0x3e8, 0x41c, 0x420, 0x424, 0x428, 0x42c, 0x430, 0x44c, 0x47c, 0x480, 0x484, 0x50c, 0x554, 0x558, 0x55c, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69c, 0x6a0, 0x6a4, 0x6c0, 0x6c4, 0x6f0, 0x6f4, 0x960, 0x970, 0x974, 0xa20, 0xa24, 0xb88, 0xb8c, 0xbc4, 0xbc8, 0xbcc, 0xbd0, 0xbd4, 0xbd8, 0xbdc, 0xbe0, 0xbe4, 0xbe8, 0xbec, 0xc00, 0xc5c, 0xcac&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Whitelist was extended with 0x4c4, 0x4c8, 0x4cc, 0x584, 0x588, 0x58c.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] The IO registers in range 0x7000E400 (PMC) size 0xC00 skip the whitelist, and do a TrustZone call using [[SMC#ReadWriteRegister|ReadWriteRegister]].&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] Access to the Memory Controller (0x70019000) also uses smcReadWriteRegister.&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by that SMC, relative to the start of the PMC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x00c, 0x010, 0x014, 0x01c, 0x020, 0x02c, 0x030, 0x034, 0x038, 0x03c, 0x040, 0x044, 0x048, 0x0dc, 0x0e0, 0x0e4, 0x160, 0x164, 0x168, 0x170, 0x1a8, 0x1b8, 0x1bc, 0x1c0, 0x1c4, 0x1c8, 0x2b4, 0x2d4, 0x440, 0x4d8&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by the SMC [[SMC#ReadWriteRegister|ReadWriteRegister]] (checked in addition to the whitelist in the ReadWriteRegister SVC), relative to the start of the MC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x004, 0x008, 0x00C, 0x010, 0x01C, 0x020, 0x030, 0x034, 0x050, 0x054, 0x090, 0x094, 0x098, 0x09C, 0x0A0, 0x0A4, 0x0A8, 0x0AC, 0x0B0, 0x0B4, 0x0B8, 0x0BC, 0x0C0, 0x0C4, 0x0C8, 0x0D0, 0x0D4, 0x0D8, 0x0DC, 0x0E0, 0x100, 0x108, 0x10C, 0x118, 0x11C, 0x124, 0x128, 0x12C, 0x130, 0x134, 0x138, 0x13C, 0x158, 0x15C, 0x164, 0x168, 0x16C, 0x170, 0x174, 0x178, 0x17C, 0x200, 0x204, 0x238, 0x240, 0x244, 0x250, 0x254, 0x258, 0x264, 0x268, 0x26C, 0x270, 0x274, 0x280, 0x284, 0x288, 0x28C, 0x294, 0x2E4, 0x2E8, 0x2EC, 0x2F4, 0x2F8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37C, 0x380, 0x390, 0x394, 0x398, 0x3AC, 0x3B8, 0x3BC, 0x3C0, 0x3C4, 0x3D8, 0x3E8, 0x41C, 0x420, 0x424, 0x428, 0x42C, 0x430, 0x44C, 0x47C, 0x480, 0x484, 0x4C4, 0x4C8, 0x4CC, 0x50C, 0x554, 0x558, 0x55C, 0x584, 0x588, 0x58C, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69C, 0x6A0, 0x6A4, 0x6C0, 0x6C4, 0x6F0, 0x6F4, 0x960, 0x970, 0x974, 0x9B8, 0xA20, 0xA24, 0xA88, 0xA94, 0xA98, 0xA9C, 0xAA0, 0xAA4, 0xAA8, 0xAAC, 0xAB0, 0xAB4, 0xAB8, 0xABC, 0xAC0, 0xAC4, 0xAC8, 0xACC, 0xAD0, 0xAD4, 0xAD8, 0xADC, 0xAE0, 0xB88, 0xB8C, 0xBC4, 0xBC8, 0xBCC, 0xBD0, 0xBD4, 0xBD8, 0xBDC, 0xBE0, 0xBE4, 0xBE8, 0xBEC, 0xC00, 0xC5C, 0xCAC&lt;br /&gt;
&lt;br /&gt;
== SetProcessActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ProcessActivity]] || ProcessActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || LocalMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || RemoteMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other perm can be used to enforce permission 1, 3, or 0x10000000 if don&#039;t care.&lt;br /&gt;
&lt;br /&gt;
Allocates memory from the current process&#039; pool partition.&lt;br /&gt;
&lt;br /&gt;
== MapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error.&lt;br /&gt;
&lt;br /&gt;
== UnmapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size must match size given in map syscall, otherwise there&#039;s an invalid-size error.&lt;br /&gt;
&lt;br /&gt;
== CreateInterruptEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#Interrupt]] || Interrupt&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#InterruptType]] || InterruptType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates an event handle for the given IRQ number. Waiting on this handle will wait until the IRQ is triggered. The InterruptType argument configures the triggering. If it is 0, the IRQ is active HIGH level sensitive, if it is 1 it is rising-edge sensitive.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Flags was &amp;gt; 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF201:&#039;&#039;&#039; IRQ above 0x3FF or outside the [[NPDM#Kernel_Access_Control|IRQ access mask]] was given.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; A SlabHeap was exhausted (too many interrupts created).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF401:&#039;&#039;&#039; IRQ already has an event registered.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD201:&#039;&#039;&#039; The handle table is full. Try closing some handles.&lt;br /&gt;
&lt;br /&gt;
== QueryPhysicalAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || VirtualAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]]|| Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || PhysicalMemoryInfoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || PhysicalMemoryInfoBaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || PhysicalMemoryInfoSize&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address.&lt;br /&gt;
&lt;br /&gt;
The returned PhysicalMemoryInfoBaseAddress is the virtual address of that page-aligned mapping, while PhysicalMemoryInfoAddress is the physical address of that page. PhysicalMemoryInfoSize is the amount of continuous physical memory in that mapping.&lt;br /&gt;
&lt;br /&gt;
== QueryIoMapping ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || IoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || void* || VirtualAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a virtual address mapped to a given IO range.&lt;br /&gt;
&lt;br /&gt;
== CreateDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || DeviceAddressSpaceStartAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0, R1 || uint64_t || DeviceAddressSpaceEndAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a virtual address space for binding device address spaces and returns a handle.&lt;br /&gt;
&lt;br /&gt;
StartAddr is normally set to 0 and EndAddr is normally set to 0xFFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== AttachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attaches a device address space to a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== DetachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Detaches a device address space from a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceByForce ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]).&lt;br /&gt;
&lt;br /&gt;
The userspace destination address must have the [[SVC#MemoryState|FlagCanDeviceMap]] bit set. Bit [[SVC#MemoryAttribute|DeviceShared]] will be set after mapping.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceAligned ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState|FlagCanAlignedDeviceMap]] bit set instead.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X5 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W6 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || uint64_t || Size&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== UnmapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps an attached device address space from an userspace address.&lt;br /&gt;
&lt;br /&gt;
== InvalidateProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== StoreProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DebugActiveProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BreakDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DebugEventInfo]]* || DebugEventInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || uint32_t || [[#ContinueDebugFlags]] ([1.0.0-2.3.0] [[#ContinueDebugFlagsOld]])&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 ([1.0.0-2.3.0] R2, R3) || uint64_t* ([1.0.0-2.3.0] uint64_t)|| ThreadIdList ([1.0.0-2.3.0] ThreadId)&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || uint64_t || [3.0.0+] NumThreadIds&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maximum NumThreadIds is 64. 0 means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The process has been resumed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid debug handle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf401:&#039;&#039;&#039; Process has debug events queued or is already running.&lt;br /&gt;
&lt;br /&gt;
== GetProcessList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ProcessIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ProcessIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumProcesses&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fills the provided array with the pids of currently living processes. A process &amp;quot;lives&amp;quot; so long as it is currently running or a handle to it still exists.&lt;br /&gt;
&lt;br /&gt;
It returns the total number of processes currently alive. If this number is bigger than the size of ProcessIdBuffer, the user won&#039;t have all the pids.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xd401:&#039;&#039;&#039; The provided buffer is outside the process address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; copyToUser failed. The provided buffer is not user-accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; The provided buffer size is too big. Max value is 0xFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== GetThreadList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ThreadIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ThreadIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumThreads&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== QueryDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WriteDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetHardwareBreakPoint ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || [[#HardwareBreakPointRegisterName]] || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || Flags&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets one of the AArch64 hardware breakpoints. The nintendo switch has 6 hardware breakpoints, and 4 hardware watchpoints. The syscall has two behaviors depending on the value of HardwareBreakPointRegisterName:&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName &amp;lt; 0x10, then it sets one of the AArch64 hardware breakpoints. Flags will go to DBGBCRn_EL1, and value to DBGBVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0x7F01E1. Furthermore, the kernel will or it with 0x4004, in order to set various security flags to guarantee the watchpoints only triggers for code in EL0. If the user asks for a Breakpoint Type of ContextIDR match, the kernel shall use the given DebugHandle to set DBGBVRn_EL1 to the ContextID of the debugged process.&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName is between 0x10 and 0x20 (exclusive), then it sets one of the AArch64 hardware watchpoints. Flags will go to DBGWCRn_EL1, and the value to DBGWVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0xFF0F1FF9. Furthermore, the kernel will or it with 0x104004. This will set various security flags, and set the watchpoint type to be a Linked Watchpoint. This means that you need to link it to a Linked ContextIDR breakpoint. Check the ARM documentation for more information.&lt;br /&gt;
&lt;br /&gt;
Note that HardwareBreakPointRegisterName 0 to 4 match only to Virtual Address, while HardwareBreakPointRegisterName 5 and 6 match against either Virtual Address, ContextID, or VMID. As such, if you are configuring a breakpoint to link for a watchpoint, make sure you use hardware_breakpoint_id 5 or 6.&lt;br /&gt;
&lt;br /&gt;
For more documentation for hardware breakpoints, check out the AArch64 documentation for the [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488h/way1382455558968.html DBGBCRn_EL1 register] and the [http://infocenter.arm.com/help/topic/com.arm.doc.ddi0488h/way1382455560629.html DBGWCRn_EL1 register]&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadParam ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R3 || [[#DebugThreadParam]] || DebugThreadParam&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Out0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R3 || uint32_t || Out1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#SystemInfoType]] || SystemInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || SystemInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || SystemInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreatePort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R2 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ManageNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ConnectToPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetProcessMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Addr&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R5 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets the memory permissions for the specified memory with the supplied process handle.&lt;br /&gt;
&lt;br /&gt;
This throws an error(0xD801) when the input perm is &amp;gt;0x5, hence -WX and RWX are not allowed.&lt;br /&gt;
&lt;br /&gt;
== MapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the src address from the supplied process handle into the current process.&lt;br /&gt;
&lt;br /&gt;
This allows mapping code and rodata with RW- permission.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessMemory]].&lt;br /&gt;
&lt;br /&gt;
== QueryProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R1, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equivalent to [[#QueryMemory]] except takes a process handle.&lt;br /&gt;
&lt;br /&gt;
== MapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a process handle, and maps normal heap in that process as executable code in that process. Used when loading NROs. This does not support using the current-process handle alias.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessCodeMemory]].&lt;br /&gt;
&lt;br /&gt;
== CreateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#CreateProcessParameter]]* || CreateProcessParameter&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint32_t* || Capabilities&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || int32_t || CapabilitiesNum&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a [[#CreateProcessParameter]] as input.&lt;br /&gt;
Capabilities points to an array of [[NPDM#Kernel_Access_Control|kernel capabilities]].&lt;br /&gt;
CapabilitiesNum is a number of capabilities in the Capabilities array (number of element, not number of bytes).&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Attempted to map more code pages than available in address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Provided CodeAddr is invalid (make sure it&#039;s in range?)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The resource handle passed is invalid.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE601:&#039;&#039;&#039; Attempt to copy procinfo from user-supplied pointer failed. Attempt to copy capabilities_num from user-supplied pointer failed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE801:&#039;&#039;&#039; Attempted to create a 32-bit process with a 36-bit address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Unused bits are set in mmuflags. Unknown address space type used.&lt;br /&gt;
&lt;br /&gt;
== StartProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || MainThreadPriority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || DefaultCpuId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || MainThreadStackSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetProcessInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R2 || [[#ProcessInfoType]] || ProcessInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || [[#ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns an enum with value 0-7.&lt;br /&gt;
&lt;br /&gt;
== CreateResourceLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || int64_t || LimitValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CallSecureMonitor ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || uint64_t || [[SMC#Secure_Monitor_calls|FunctionId]]&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1-X7 || R1-R7 || uint64_t || SMC arguments&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[SMC#Result|Result]] || SMC result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1-X7 || R1-R7 || uint64_t || SMC output&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes in a SMC function ID in X0, and arguments for that SMC function in X1-X7.&lt;br /&gt;
&lt;br /&gt;
Passing an invalid SMC function ID or calling from a core other than core 3 will result in a secure monitor panic.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
== Debugging ==&lt;br /&gt;
[2.0.0+] Exactly 6 debug SVCs require that [[SPL_services#GetConfig|IsDebugMode]] is non-zero. Error 0x4201 is returned otherwise.&lt;br /&gt;
* BreakDebugProcess&lt;br /&gt;
* ContinueDebugEvent&lt;br /&gt;
* WriteDebugProcessMemory&lt;br /&gt;
* SetDebugThreadContext&lt;br /&gt;
* TerminateDebugProcess&lt;br /&gt;
* SetHardwareBreakPoint&lt;br /&gt;
&lt;br /&gt;
DebugActiveProcess stops execution of the target process, the normal method for resuming it requires ContinueDebugEvent(see above). Closing the debug handle also results in execution being resumed.&lt;br /&gt;
&lt;br /&gt;
= Enum/Structures =&lt;br /&gt;
== InfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || InfoType || InfoSubType || Description&lt;br /&gt;
|-&lt;br /&gt;
| Process || 0 || 0 || CoreMask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 1 || 0 || PriorityMask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 2 || 0 || AliasRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 3 || 0 || AliasRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 4 || 0 || HeapRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 5 || 0 || HeapRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 6 || 0 || TotalMemorySize. Total memory available(free+used).&lt;br /&gt;
|-&lt;br /&gt;
| Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap.&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 8 || 0 || DebuggerAttached&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 9 || 0 || ResourceLimit&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 10 || -1, {current coreid} || IdleTickCount&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs.&lt;br /&gt;
|-&lt;br /&gt;
| Process || 12 || 0 || [2.0.0+] AslrRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 13 || 0 || [2.0.0+] AslrRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 14 || 0 || [2.0.0+] StackRegionAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 15 || 0 || [2.0.0+] StackRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal&lt;br /&gt;
|-&lt;br /&gt;
| Process || 17 || 0 || [3.0.0+] SystemResourceSizeUsed&lt;br /&gt;
|-&lt;br /&gt;
| Process || 18 || 0 || [3.0.0+] ProgramId&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound&lt;br /&gt;
|-&lt;br /&gt;
| Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress&lt;br /&gt;
|-&lt;br /&gt;
| Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 22 || 0 || [6.0.0+] UsedNonSystemMemorySize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 23 || 0 || [9.0.0+] IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| Process || 24 || 0 || [11.0.0+] FreeThreadCount&lt;br /&gt;
|-&lt;br /&gt;
| Thread  || 0xF0000002 || 0-3, -1 || ThreadTickCount. When 0-3 are passed, gets specific core CPU ticks spent on thread. When -1 is passed, gets total CPU ticks spent on thread.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SystemInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || SystemInfoType || SystemInfoSubType || Description&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 0 || TotalPhysicalMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 1 || TotalPhysicalMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 2 || TotalPhysicalMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 0 || UsedPhysicalMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 1 || UsedPhysicalMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 2 || UsedPhysicalMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 0 || InitialProcessIdRange_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 1 || InitialProcessIdRange_UpperBound&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ThreadContextFlags ==&lt;br /&gt;
Bitfield of one of more of these:&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 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.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || Control registers || Reads/writes the FP, LR, PC, SP, PSTATE, and TPIDR registers.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Floating-point registers || Reads/writes the floating-point vector registers.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || Floating-point control registers || Reads/writes the FPCR and FPSR registers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DeviceName ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AFI&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AVPC&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DC&lt;br /&gt;
|-&lt;br /&gt;
| 3 || DCB&lt;br /&gt;
|-&lt;br /&gt;
| 4 || HC&lt;br /&gt;
|-&lt;br /&gt;
| 5 || HDA&lt;br /&gt;
|-&lt;br /&gt;
| 6 || ISP2&lt;br /&gt;
|-&lt;br /&gt;
| 7 || MSENCNVENC&lt;br /&gt;
|-&lt;br /&gt;
| 8 || NV&lt;br /&gt;
|-&lt;br /&gt;
| 9 || NV2&lt;br /&gt;
|-&lt;br /&gt;
| 10 || PPCS&lt;br /&gt;
|-&lt;br /&gt;
| 11 || SATA&lt;br /&gt;
|-&lt;br /&gt;
| 12 || VI&lt;br /&gt;
|-&lt;br /&gt;
| 13 || VIC&lt;br /&gt;
|-&lt;br /&gt;
| 14 || XUSB_HOST&lt;br /&gt;
|-&lt;br /&gt;
| 15 || XUSB_DEV&lt;br /&gt;
|-&lt;br /&gt;
| 16 || TSEC&lt;br /&gt;
|-&lt;br /&gt;
| 17 || PPCS1&lt;br /&gt;
|-&lt;br /&gt;
| 18 || DC1&lt;br /&gt;
|-&lt;br /&gt;
| 19 || SDMMC1A&lt;br /&gt;
|-&lt;br /&gt;
| 20 || SDMMC2A&lt;br /&gt;
|-&lt;br /&gt;
| 21 || SDMMC3A&lt;br /&gt;
|-&lt;br /&gt;
| 22 || SDMMC4A&lt;br /&gt;
|-&lt;br /&gt;
| 23 || ISP2B&lt;br /&gt;
|-&lt;br /&gt;
| 24 || GPU&lt;br /&gt;
|-&lt;br /&gt;
| 25 || GPUB&lt;br /&gt;
|-&lt;br /&gt;
| 26 || PPCS2&lt;br /&gt;
|-&lt;br /&gt;
| 27 || NVDEC&lt;br /&gt;
|-&lt;br /&gt;
| 28 || APE&lt;br /&gt;
|-&lt;br /&gt;
| 29 || SE&lt;br /&gt;
|-&lt;br /&gt;
| 30 || NVJPG&lt;br /&gt;
|-&lt;br /&gt;
| 31 || HC1&lt;br /&gt;
|-&lt;br /&gt;
| 32 || SE1&lt;br /&gt;
|-&lt;br /&gt;
| 33 || AXIAP&lt;br /&gt;
|-&lt;br /&gt;
| 34 || ETR&lt;br /&gt;
|-&lt;br /&gt;
| 35 || TSECB&lt;br /&gt;
|-&lt;br /&gt;
| 36 || TSEC1&lt;br /&gt;
|-&lt;br /&gt;
| 37 || TSECB1&lt;br /&gt;
|-&lt;br /&gt;
| 38 || NVDEC1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CodeMemoryOperation ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || MapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 1 || MapSlave&lt;br /&gt;
|-&lt;br /&gt;
| 2 || UnmapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 3 || UnmapSlave&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LimitableResource ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || PhysicalMemoryMax || Bytes of memory a process may allocate.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || ThreadCountMax || Amount of threads a process can create.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || EventCountMax || Amount of events a process can create through [[#CreateEvent]] or [[#SendAsyncRequestWithUserBuffer]].&lt;br /&gt;
|-&lt;br /&gt;
| 3 || TransferMemoryCountMax || Amount of TransferMemory a process can create through [[#CreateTransferMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SessionCountMax || Amount of session a process can create through [[#CreateSession]], [[#ConnectToPort]] or [[#ConnectToNamedPort]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ThreadActivity =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessActivity ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#ProcessState|ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Created ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CreatedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Started ||&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Crashed || Processes will not enter this state unless they were created with [[#CreateProcessParameter|EnableDebug]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || StartedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Exiting ||&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Exited ||&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebugSuspended ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DebugThreadParam ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || DynamicPriority&lt;br /&gt;
|-&lt;br /&gt;
| 1 || SchedulingStatus&lt;br /&gt;
|-&lt;br /&gt;
| 2 || PreferredCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 3 || CurrentCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 4 || AffinityMask&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Dynamic priority: output in out2&lt;br /&gt;
&lt;br /&gt;
Scheduling status: out1 contains bit0: is debug-suspended, bit1: is user-suspended ([[#SetThreadActivity]] 1 or [[#SetProcessActivity]] 1).&lt;br /&gt;
Out2 contains {suspended, idle, running, terminating} =&amp;gt; {5, 0, 1, 4}&lt;br /&gt;
&lt;br /&gt;
PreferredCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
CurrentCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
AffinityMask: output in out1&lt;br /&gt;
&lt;br /&gt;
== CreateProcessParameter ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 12 || || ProcessName (doesn&#039;t have to be null-terminated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || 4 || || ProcessCategory (0: regular title, 1: kernel built-in)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 8 || || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 8 || || CodeAddr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || || CodeNumPages&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || || Flags&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit0 || Is64BitInstruction&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit3-1 || [[#AddressSpaceType]]&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit4 || [2.0.0+] EnableDebug&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit5 || EnableAslr&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit6 || IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit7 || [4.0.0] UseSecureMemory&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit10-7 || [5.0.0+] MemoryRegion (0 = Application, 1 = Applet, 2 = SecureSystem, 3 = NonSecureSystem)&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit11 || [7.0.0+] OptimizeMemoryAllocation (only allowed in combination with IsApplication)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 4 || || ResourceLimitHandle (can be zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 4 || || [3.0.0+] SystemResourceNumPages&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
On [1.0.0] there&#039;s only one MemoryRegion.&lt;br /&gt;
&lt;br /&gt;
On [2.0.0-4.0.0] MemoryRegion is 1 for built-ins and 0 for rest.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] MemoryRegion is specified in CreateProcessArgs. There are now 4 pool partitions.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory.&lt;br /&gt;
&lt;br /&gt;
The PersonalMmHeap are allocated as follows:&lt;br /&gt;
* For the application, normal insecure pool is used. Carveout 5 is used to provide protection.&lt;br /&gt;
* For the applet, a pre-allocated secure pool segment of size 0x400000 is used.&lt;br /&gt;
* For sysmodules, secure pool is allocated.&lt;br /&gt;
&lt;br /&gt;
=== AddressSpaceType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Type || Name || Width || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AddressSpace32Bit || 32 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AddressSpace64BitOld || 36 ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || AddressSpace32BitNoReserved || 32 || Appears to be missing map region [?]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [2.0.0+] AddressSpace64Bit || 39 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryInfo ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8 || BaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 8 || Size&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 4 || [[#MemoryType]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || 4 || [[#MemoryAttribute]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 4 || [[#MemoryPermission]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || 4 || IpcRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || DeviceRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || Padding: always zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryPermission ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Read || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Write || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 28 || DontCare ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryAttribute ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Locked || Used by MapMemory, as an async IPC user buffer.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || IpcLocked || True when IpcRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DeviceShared || True when DeviceRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Uncached || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Description || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 7-0 || [[#MemoryType]] || &lt;br /&gt;
|-&lt;br /&gt;
| 8 || [[#SetMemoryPermission|FlagCanReprotect]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 9 || FlagCanDebug || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || FlagCanUseIpc || Allows sending this region as an IPC A/B/W buffer with flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 11 || FlagCanUseNonDeviceIpc || Allows sending this region as an IPC A/B/W buffer with flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || FlagCanUseNonSecureIpc || Allows sending this region as an IPC A/B/W buffer with flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || FlagMapped ||&lt;br /&gt;
|-&lt;br /&gt;
| 14 || [[#SetProcessMemoryPermission|FlagCode]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 15 || [[#MapMemory|FlagCanAlias]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 16 || [[#MapProcessCodeMemory|FlagCanCodeAlias]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 17 || [[#CreateTransferMemory|FlagCanTransfer]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 18 || [[#QueryPhysicalAddress|FlagCanQueryPhysical]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 19 || [[#MapDeviceAddressSpace|FlagCanDeviceMap]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 20 || [[#MapDeviceAddressSpaceAligned|FlagCanAlignedDeviceMap]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 21 || [[#SendSyncRequestWithUserBuffer|FlagCanIpcUserBuffer]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 22 || FlagReferenceCounted || The physical memory blocks backing this region are refcounted.&lt;br /&gt;
|-&lt;br /&gt;
| 23 || [[#MapProcessMemory|FlagCanMapProcess]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 24 || [[#SetMemoryAttribute|FlagCanChangeAttribute]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 25 || [4.0.0+] [[#CreateCodeMemory|FlagCanCodeMemory]] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== MemoryType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000000 || Free ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002001 || Io || Mapped by kernel capability parsing in [[#CreateProcess]]. &lt;br /&gt;
|-&lt;br /&gt;
| 0x00042002 || Static || Mapped by kernel capability parsing in [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DC7E03 || Code || Mapped during [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FEBD04&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FEBD04&lt;br /&gt;
|| CodeData || Transition from 0xDC7E03 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
0x017EBD05&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x037EBD05&lt;br /&gt;
|| Normal || Mapped using [[#SetHeapSize]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402006 || Shared || Mapped using [[#MapSharedMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00482907 || [1.0.0] Alias || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DD7E08 || AliasCode || Mapped using [[#MapProcessCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FFBD09&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FFBD09&lt;br /&gt;
|| AliasCodeData || Transition from 0xDD7E08 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0A || [[IPC_Marshalling|Ipc]] || IPC buffers with descriptor flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0B || Stack || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040200C || [[Thread Local Storage|ThreadLocal]] || Mapped during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C380E || SharedTransfered || Mapped using [[#MapTransferMemory]] when the owning process has perm!=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000010 || Inaccessible ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002013 || Kernel || Mapped in kernel during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402214 || [4.0.0+] GeneratedCode || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402015 || [4.0.0+] CodeOut || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ArbitrationType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || WaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || DecrementAndWaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || WaitIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SignalType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || Signal&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || SignalAndIncrementIfEqual&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || SignalAndModifyBasedOnWaitingThreadCountIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlagsOld ==&lt;br /&gt;
[1.0.0-2.3.0]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: ResumeAllThreads or debug-suspended-thread-id needed)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || SwallowException&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || ResumeAllThreads&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlags ==&lt;br /&gt;
[3.0.0+]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: doesn&#039;t need to be set in the same call than Resume)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || DontCatchExceptions&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Resume&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || IgnoreOtherThreadsExceptions&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
IgnoreExceptionsOfOthers is like IgnoreException but acts on all threads that aren&#039;t in the input list. The affected threads are resumed.&lt;br /&gt;
&lt;br /&gt;
Only one of of Resume and IgnoreOtherThreadsExceptions can be set at a time.&lt;br /&gt;
&lt;br /&gt;
If the input number of threads is 0, this means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== DebugEventInfo ==&lt;br /&gt;
The below table is for the Aarch64 version of the system call. For A32, all u64 fields but title/process/thread id are actually u32, making the structure 0x28-byte-big (0x40 for a64).&lt;br /&gt;
&lt;br /&gt;
Size: 0x40&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || u32 || EventType&lt;br /&gt;
|-&lt;br /&gt;
| 4 || u32 || Flags (bit0: NeedsContinue)&lt;br /&gt;
|-&lt;br /&gt;
| 8 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || || PerTypeSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachProcess specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || char[12] || ProcessName&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || u32 || MmuFlags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || [5.0.0+] UserExceptionContextAddr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachThread specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || TlsPtr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u64 || Entrypoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exit specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32|| Type (0=PausedThread, 1=RunningThread, 2=ExitedProcess, 3=TerminatedProcess)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exception specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32 || ExceptionType&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || FaultRegister&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || || PerExceptionSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugEventType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AttachProcess&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AttachThread&lt;br /&gt;
|-&lt;br /&gt;
| 2 || ExitProcess&lt;br /&gt;
|-&lt;br /&gt;
| 3 || ExitThread&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Exception&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugExceptionType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Trap (*)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || InstructionAbort&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DataAbortMisc (**)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || PcSpAlignmentFault&lt;br /&gt;
|-&lt;br /&gt;
| 4 || DebuggerAttached&lt;br /&gt;
|-&lt;br /&gt;
| 5 || BreakPoint&lt;br /&gt;
|-&lt;br /&gt;
| 6 || UserBreak&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebuggerBreak&lt;br /&gt;
|-&lt;br /&gt;
| 8 || BadSvcId&lt;br /&gt;
|-&lt;br /&gt;
| 9 || [2.0.0+] SError&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Undefined instructions, software breakpoints, some other traps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; Data aborts, FP traps, and everything else that doesn&#039;t belong to any of the above.&lt;br /&gt;
&lt;br /&gt;
Trap specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Opcode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BreakPoint specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || IsWatchpoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
UserBreak specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Info0&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || u64 || Info1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || Info2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BadSvcId specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || SvcId&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Exception handling =&lt;br /&gt;
First of all, a function that might be called by synchronous exception handler and that is called by the SError handler fetches the exception info, adjusts PC, panics on exceptions taken from EL1, then dispatches the exception.&lt;br /&gt;
&lt;br /&gt;
The dispatcher has two mutually exclusive exception reporting methods:&lt;br /&gt;
* by storing information at the start of the process&#039;s TLS memregion (TPIDRRO_EL0) and jumping back to the crt0&lt;br /&gt;
* by using KDebug&lt;br /&gt;
&lt;br /&gt;
KDebug dispatching is used when at least one of the following conditions are met:&lt;br /&gt;
* SMC ConfigItem KernelMemConfig bit 1 is NOT set (it isn&#039;t on retail), unless: this is a software or hardware breakpoint, or a watchpoint, or [4.0.0+?] the process is attached and this is a Google PNaCl trap instruction (see LLVM source)&lt;br /&gt;
* FAR doesn&#039;t point to a valid address in mapped-readable CodeStatic memory (i.e. this is the case for NRO and JIT memory) or this is one of the following exceptions (it particular, that doesn&#039;t include FP exceptions occurring in CodeStatic memory):&lt;br /&gt;
** Uncategorized&lt;br /&gt;
** IllegalState&lt;br /&gt;
** SupervisorCallA32&lt;br /&gt;
** SupervisorCallA64&lt;br /&gt;
** PCAlignment&lt;br /&gt;
** SPAlignment&lt;br /&gt;
** SError&lt;br /&gt;
** BreakpointLowerEl&lt;br /&gt;
** SoftwareStepLowerEl (note: no way set single-step flag; not parsed)&lt;br /&gt;
** WatchpointLowerEl&lt;br /&gt;
** SoftwareBreakpointA32 (note: not parsed)&lt;br /&gt;
** SoftwareBreakpointA64 (note: not parsed)&lt;br /&gt;
    &lt;br /&gt;
In all other cases the userland-handled exception path is taken.&lt;br /&gt;
&lt;br /&gt;
KDebug path:&lt;br /&gt;
&lt;br /&gt;
If the process is attached, the exception is reported to the KDebug. If the thread was continued using flag IgnoreExceptions, it returns from the exception as if nothing happened.&lt;br /&gt;
&lt;br /&gt;
If the latter is not the case, or if the process isn&#039;t attached, proceed to [2.0.0+] crash reporting (or in [1.0.0] just terminate the process): &lt;br /&gt;
if EnableDebug is set, and depending on the process state (more than one crash per process isn&#039;t permitted) it may signal itself with ProcessState_Crashed so that PM asks NS to start creport so that creport attaches to it and reports the crashes. Otherwise, just terminate.&lt;br /&gt;
&lt;br /&gt;
Userland reporting path and [[#ReturnFromException]]:&lt;br /&gt;
&lt;br /&gt;
TLS region start (A64):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x148 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x78 || ExceptionFrameA64&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA64:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x48 (8*9) || GPRs 0..8.&lt;br /&gt;
|-&lt;br /&gt;
| 0x48 || 0x8 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || 0x8 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || 0x8 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || 0x4 || pstate &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || 0x8 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
TLS region start (A32):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x178 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x44 || ExceptionFrameA32&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA32:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x20 (8*4) || GPRs 0..7.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 0x4 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 0x4 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 0x4 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 0x4 || tpidr_el0 = 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || 0x4 || cpsr &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x34 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x38 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || 0x4 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In that case, after storing the regs in the TLS, the exception handler returns to the application&#039;s crt0 (entrypoint), with X0=&amp;lt;error description code&amp;gt; (see below) and X1=SP=frame=&amp;lt;stack top&amp;gt; (see above)&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Desc. code || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x100 || Instruction abort&lt;br /&gt;
|-&lt;br /&gt;
| 0x102 || Misaligned PC&lt;br /&gt;
|-&lt;br /&gt;
| 0x103 || Misaligned SP&lt;br /&gt;
|-&lt;br /&gt;
| 0x106 || [2.0.0+] SError&lt;br /&gt;
|-&lt;br /&gt;
| 0x301 || Bad SVC&lt;br /&gt;
|-&lt;br /&gt;
| 0x104 || Uncategorized, CP15RTTrap, CP15RRTTrap, CP14RTTrap, CP14RRTTrap, IllegalState, SystemRegisterTrap&lt;br /&gt;
|-&lt;br /&gt;
| 0x101 || None of the above, EC &amp;lt;= 0x34 and not a breakpoint&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(During normal app boot the process is invoked with X0=0 and X1=main_thread_handle. The crt0 of retail apps determines whether to boot normally or handle an exception if X0 is set to 0 or not)&lt;br /&gt;
&lt;br /&gt;
The application is supposed to promptly update the contents of elr_el1 to a user handler (and any other regs it sees fit) and call [[#ReturnFromException]] (error code) to call that handler. The latter is then expected to promptly abort the program.&lt;br /&gt;
&lt;br /&gt;
[[#ReturnFromException]] updates the contents of the kernel stack frame with what the user provided in the TLS structure, sets TPIDR_EL0 to 1, then:&lt;br /&gt;
* if the provided error code is 0, gracefully pivots and returns from exception&lt;br /&gt;
* if it is not, replays the exception and pass it to the KDebug (see above). One can pass 0x10001 to prevent process termination. If the process is attached, this also prevents crash-collection/termination (different from the exception handler behavior)&lt;br /&gt;
&lt;br /&gt;
If an exception occurs from the above user handler, the entire exception handling process will repeat with the new exception.&lt;br /&gt;
&lt;br /&gt;
Note that if a thread that wasn&#039;t faulting calls [[#ReturnFromException]], it signals an &amp;quot;invalid syscall&amp;quot; exception&lt;br /&gt;
&lt;br /&gt;
Note that [[SMC|IsDebugMode]] is not used during exception-handling, except for enabling printing a message to UART-A. This UART code causes a system-hang on retail (likely due to a loop that doesn&#039;t exit). This printing doesn&#039;t seem to run when the process is attached for debugging?&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NPDM&amp;diff=10189</id>
		<title>NPDM</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NPDM&amp;diff=10189"/>
		<updated>2020-11-20T07:57:34Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: Correct `ThreadInfo` priority field order&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the Switch equivalent of 3DS [https://www.3dbrew.org/wiki/NCCH/Extended_Header exheader]. This is the file with extension &amp;quot;.npdm&amp;quot; in {Switch ExeFS}. The size of this file varies.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x80&lt;br /&gt;
| [[#META|META]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| &amp;lt;Varies&amp;gt;&lt;br /&gt;
| [[#ACID|ACID]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;See META&amp;gt;&lt;br /&gt;
| &amp;lt;See META&amp;gt;&lt;br /&gt;
| [[#ACI0|ACI0]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= META =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;META&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| [9.0.0+] AcidSignatureKeyGeneration (0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x1&lt;br /&gt;
| [[#Flags|Flags]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xD&lt;br /&gt;
| 0x1&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0xE&lt;br /&gt;
| 0x1&lt;br /&gt;
| [[#MainThreadPriority|MainThreadPriority]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xF&lt;br /&gt;
| 0x1&lt;br /&gt;
| MainThreadCoreNumber&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| [3.0.0+] [[#SystemResourceSize|SystemResourceSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#Version|Version]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#MainThreadStackSize|MainThreadStackSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Name (usually/always &amp;quot;Application&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x10&lt;br /&gt;
| ProductCode (usually/always all zeroes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x30&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACI0|AciOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACI0|AciSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x78&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACID|AcidOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x7C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACID|AcidSize]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Flags ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Is64BitInstruction&lt;br /&gt;
|-&lt;br /&gt;
| 1-3&lt;br /&gt;
| ProcessAddressSpace (0x00 = AddressSpace32Bit, 0x01 = AddressSpace64BitOld, 0x02 = AddressSpace32BitNoReserved, 0x03 = AddressSpace64Bit)&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| OptimizeMemoryAllocation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MainThreadPriority ==&lt;br /&gt;
Ranges from 0 to 0x3F.&lt;br /&gt;
&lt;br /&gt;
== SystemResourceSize ==&lt;br /&gt;
This is the size of PersonalMmHeap. Maximum size as of 5.0.0 is 0x1FE00000.&lt;br /&gt;
&lt;br /&gt;
== Version ==&lt;br /&gt;
0 for all titles.&lt;br /&gt;
&lt;br /&gt;
[8.1.0+] Now set to 1 for certain titles.&lt;br /&gt;
&lt;br /&gt;
[9.0.0+] Now set to a proper version field for all titles.&lt;br /&gt;
&lt;br /&gt;
== MainThreadStackSize ==&lt;br /&gt;
Must be aligned to 0x1000.&lt;br /&gt;
&lt;br /&gt;
In non-nspwn scenarios, values of 0 can also rarely break in Horizon. This might be something auto-adapting or a security feature of some sort?&lt;br /&gt;
&lt;br /&gt;
= ACID =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the data starting at 0x100 with the size field from 0x204&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 public key for the second [[NCA_Format|NCA]] signature&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;ACID&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x204&lt;br /&gt;
| 0x4&lt;br /&gt;
| Size&lt;br /&gt;
|-&lt;br /&gt;
| 0x208&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x20C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#Flags_2|Flags]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x210&lt;br /&gt;
| 0x8&lt;br /&gt;
| ProgramIdMin&lt;br /&gt;
|-&lt;br /&gt;
| 0x218&lt;br /&gt;
| 0x8&lt;br /&gt;
| ProgramIdMax&lt;br /&gt;
|-&lt;br /&gt;
| 0x220&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FsAccessControl|FsAccessControlOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x224&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FsAccessControl|FsAccessControlSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x228&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#SrvAccessControl|SrvAccessControlOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x22C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#SrvAccessControl|SrvAccessControlSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x230&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#KernelCapability|KernelCapabilityOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x234&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#KernelCapability|KernelCapabilitySize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x238&lt;br /&gt;
| 0x8&lt;br /&gt;
| Reserved&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Flags ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| ProductionFlag&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| UnqualifiedApproval&lt;br /&gt;
|-&lt;br /&gt;
| 2-3&lt;br /&gt;
| [5.0.0+ ] MemoryRegion (0 = Application, 1 = Applet, 2 = SecureSystem, 3 = NonSecureSystem)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
MemoryRegion is set to Application for &amp;quot;starter&amp;quot; and NonSecureSystem for &amp;quot;nvservices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= ACI0 =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;ACI0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ProgramId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x8&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FsAccessControl|FsAccessControlOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FsAccessControl|FsAccessControlSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#SrvAccessControl|SrvAccessControlOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#SrvAccessControl|SrvAccessControlSize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#KernelCapability|KernelCapabilityOffset]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#KernelCapability|KernelCapabilitySize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| Reserved&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= FsAccessControl =&lt;br /&gt;
For [[#ACID|ACID]] this is a simple descriptor as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Version (always 1, must be non-zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x1&lt;br /&gt;
| [5.0.0+] ContentOwnerIdCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x1&lt;br /&gt;
| [5.0.0+] SaveDataOwnerIdCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| Padding&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8&lt;br /&gt;
| [[#FsAccessFlag|FsAccessFlag]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| ContentOwnerIdMin&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x8&lt;br /&gt;
| ContentOwnerIdMax&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x8&lt;br /&gt;
| SaveDataOwnerIdMin&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| SaveDataOwnerIdMax&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x8 * ContentOwnerIdCount&lt;br /&gt;
| [5.0.0+] ContentOwnerIds&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| 0x8 * SaveDataOwnerIdCount&lt;br /&gt;
| [5.0.0+] SaveDataOwnerIds&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For [[#ACI0|ACI0]] this embeds data as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Version (always 1, must be non-zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x3&lt;br /&gt;
| Padding&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8&lt;br /&gt;
| [[#FsAccessFlag|FsAccessFlag]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ContentOwnerInfoOffset&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ContentOwnerInfoSize&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| SaveDataOwnerInfoOffset&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| SaveDataOwnerInfoSize&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| (Optional) ContentOwnerIdCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x8 * ContentOwnerIdCount&lt;br /&gt;
| ContentOwnerIds&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| 0x4&lt;br /&gt;
| SaveDataOwnerIdCount&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| 0x1 * SaveDataOwnerIdCount&lt;br /&gt;
| Accessibilities (1=Read, 2=Write, 3=ReadWrite)&lt;br /&gt;
|-&lt;br /&gt;
| Variable (padded to nearest 4 bytes)&lt;br /&gt;
| 0x8 * SaveDataOwnerIdCount&lt;br /&gt;
| SaveDataOwnerIds&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== FsAccessFlag ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| ApplicationInfo&lt;br /&gt;
| MountContent* is accessible when set.&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| BootModeControl&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Calibration&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| SystemSaveData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GameCard&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| SaveDataBackUp&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| SaveDataManagement&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| BisAllRaw&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| GameCardRaw&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| GameCardPrivate&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| SetTime&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| ContentManager&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| ImageManager&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| CreateSaveData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| SystemSaveDataManagement&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| BisFileSystem&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| SystemUpdate&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| SaveDataMeta&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 18&lt;br /&gt;
| DeviceSaveData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
| SettingsControl&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| SystemData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 21&lt;br /&gt;
| SdCard&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 22&lt;br /&gt;
| Host&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 23&lt;br /&gt;
| FillBis&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| CorruptSaveData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 25&lt;br /&gt;
| SaveDataForDebug&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 26&lt;br /&gt;
| FormatSdCard&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 27&lt;br /&gt;
| GetRightsId&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 28&lt;br /&gt;
| RegisterExternalKey&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 29&lt;br /&gt;
| RegisterUpdatePartition&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 30&lt;br /&gt;
| SaveDataTransfer&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| DeviceDetection&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| AccessFailureResolution&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 33&lt;br /&gt;
| SaveDataTransferVersion2&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 34&lt;br /&gt;
| RegisterProgramIndexMapInfo&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 35&lt;br /&gt;
| CreateOwnSaveData&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| MoveCacheStorage&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 37-61&lt;br /&gt;
| Reserved&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 62&lt;br /&gt;
| Debug&lt;br /&gt;
| See [[SPL_services#GetConfig|here]].&lt;br /&gt;
|-&lt;br /&gt;
| 63&lt;br /&gt;
| FullPermission&lt;br /&gt;
| Enables access to everything: all [[Filesystem_services#Permissions|permission types]] which check a bitmask have this bit set.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Controls the [[Filesystem_services#Permissions|filesystem permissions]].&lt;br /&gt;
&lt;br /&gt;
Web-applets permissions:&lt;br /&gt;
* &amp;quot;LibAppletWeb&amp;quot; and &amp;quot;LibAppletOff&amp;quot; have same access control: bit0 and bit3 set, and bit62 set.&lt;br /&gt;
* Rest of the web-applets: Same as above except bit0 isn&#039;t set.&lt;br /&gt;
&lt;br /&gt;
= Service Access Control =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-2&lt;br /&gt;
| Size (length of the service-name without null-terminator minus 1)&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| IsServer (service is allowed to be registered)&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| Name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is a list of [[Services_API|service]]-name strings which the title has access to.&lt;br /&gt;
&lt;br /&gt;
The service name string starts after the first byte and supports the wildcard &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; character.&lt;br /&gt;
&lt;br /&gt;
= KernelCapability =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pattern of lower bits&lt;br /&gt;
! Lowest clear bitmask/bit&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxxxxx0111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit3&lt;br /&gt;
| [[#ThreadInfo]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxxxx01111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit4&lt;br /&gt;
| [[#EnableSystemCalls]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxx0111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit6&lt;br /&gt;
| [[#MemoryMap]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxx01111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit7&lt;br /&gt;
| [[#IoMemoryMap]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxx01111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit10&lt;br /&gt;
| [8.0.0+] [[#MemoryRegionMap]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxx011111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit11&lt;br /&gt;
| [[#EnableInterrupts]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxx01111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit13&lt;br /&gt;
| [[#MiscParams]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bx011111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit14&lt;br /&gt;
| [[#KernelVersion]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0b0111111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit15&lt;br /&gt;
| [[#HandleTableSize]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0b1111111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Bit16&lt;br /&gt;
| [[#MiscFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| All ones&lt;br /&gt;
| &lt;br /&gt;
| Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These descriptors are identified by pattern 01..11 in low bits.&lt;br /&gt;
&lt;br /&gt;
== ThreadInfo ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 4-9&lt;br /&gt;
| HighestPriority&lt;br /&gt;
|-&lt;br /&gt;
| 10-15&lt;br /&gt;
| LowestPriority&lt;br /&gt;
|-&lt;br /&gt;
| 16-23&lt;br /&gt;
| MinCoreNumber&lt;br /&gt;
|-&lt;br /&gt;
| 24-31&lt;br /&gt;
| MaxCoreNumber&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== EnableSystemCalls ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 5-28&lt;br /&gt;
| SystemCallId&lt;br /&gt;
|-&lt;br /&gt;
| 29-31&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryMap ==&lt;br /&gt;
MemoryMap entries are stored in pairs. The first pair will contain BeginAddress and PermissionType, while the second pair will contain Size and MappingType.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 7-30&lt;br /&gt;
| BeginAddress&lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| PermissionType (0=RW, 1=RO)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 7-26&lt;br /&gt;
| Size&lt;br /&gt;
|-&lt;br /&gt;
| 27-30&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| MappingType (0=Io, 1=Static)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Restrictions ===&lt;br /&gt;
The physaddr range 0x80060000-0x2000000000 is not allowed to be mapped as IO.&lt;br /&gt;
The physaddr range 0x80000000-0x2000000000 is not allowed to be mapped as Normal.&lt;br /&gt;
&lt;br /&gt;
[2.0.0-4.1.0] The range for IO was changed into 0x80060000-0x81D3FFFF.&lt;br /&gt;
&lt;br /&gt;
[2.0.0-4.1.0] A blacklist was added for IO and Normal mappings:&lt;br /&gt;
* 0x50040000-0x50060000 (ARM, Interrupt Controller)&lt;br /&gt;
* 0x6000F000 (Exception Vectors)&lt;br /&gt;
* 0x6001DC00-0x6001E000 (IPATCH)&lt;br /&gt;
* 0x7000E000 (RTC/PMC)&lt;br /&gt;
* 0x70019000 (MC)&lt;br /&gt;
* 0x7001C000 (MC0)&lt;br /&gt;
* 0x7001D000 (MC1)&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] For IO, this blacklist was abandoned and instead two range checks were added. For Normal mappings it is still applied&lt;br /&gt;
&lt;br /&gt;
== IoMemoryMap ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 8-31&lt;br /&gt;
| BeginAddress&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryRegionMap ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 11-16&lt;br /&gt;
| RegionType0 (0 = NoMapping, 1 = KernelTraceBuffer, 2 = OnMemoryBootImage, 3 = DTB)&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| RegionIsReadOnly0&lt;br /&gt;
|-&lt;br /&gt;
| 18-23&lt;br /&gt;
| RegionType1 (0 = NoMapping, 1 = KernelTraceBuffer, 2 = OnMemoryBootImage, 3 = DTB)&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| RegionIsReadOnly1&lt;br /&gt;
|-&lt;br /&gt;
| 25-30&lt;br /&gt;
| RegionType2 (0 = NoMapping, 1 = KernelTraceBuffer, 2 = OnMemoryBootImage, 3 = DTB)&lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| RegionIsReadOnly2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
MemoryRegionMap is supported by the kernel but not by [[Loader_services|Loader]]. Thus, only initial processes may possess this capability.&lt;br /&gt;
&lt;br /&gt;
== EnableInterrupts ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 12-21&lt;br /&gt;
| InterruptNumber0&lt;br /&gt;
|-&lt;br /&gt;
| 22-31&lt;br /&gt;
| InterruptNumber1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
0x3FF means empty.&lt;br /&gt;
&lt;br /&gt;
== MiscParams ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 14-16&lt;br /&gt;
| ProgramType (0 = System, 1 = Application, 2 = Applet)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ProgramType is parsed by [[Process Manager services]]. Defaults to 0 if descriptor doesn&#039;t exist. Can only run 1 application at a time.&lt;br /&gt;
&lt;br /&gt;
== KernelVersion ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 15-18&lt;br /&gt;
| MinorVersion&lt;br /&gt;
|-&lt;br /&gt;
| 19-31&lt;br /&gt;
| MajorVersion&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This encodes the intended kernel version for the program.&lt;br /&gt;
&lt;br /&gt;
The kernel requires that the intended version is &amp;gt;= the minimum supported version (3.0 for all released kernels), and &amp;lt;= the current version.&lt;br /&gt;
&lt;br /&gt;
Kernel version is derived from/equivalent to SDK version:&lt;br /&gt;
* Kernel Major = SDK Major + 4&lt;br /&gt;
* Kernel Minor = SDK Minor&lt;br /&gt;
&lt;br /&gt;
=== Versions ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Firmware || Kernel Version || Corresponding SDK Version&lt;br /&gt;
|-&lt;br /&gt;
| 1.0.0 || 5.0 || 1.0.0.0&lt;br /&gt;
|-&lt;br /&gt;
| 2.0.0 || 6.1 || 2.1.0.0&lt;br /&gt;
|-&lt;br /&gt;
| 3.0.0 || 7.4 || 3.4.0.0&lt;br /&gt;
|-&lt;br /&gt;
| 3.0.2 || 7.4 || 3.4.0.0&lt;br /&gt;
|-&lt;br /&gt;
| 5.0.0 || 9.3 || 5.3.0.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== HandleTableSize ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 16-25&lt;br /&gt;
| HandleTableSize&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MiscFlags ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| EnableDebug&lt;br /&gt;
|-&lt;br /&gt;
| 18&lt;br /&gt;
| ForceDebug&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=SVC&amp;diff=8679</id>
		<title>SVC</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=SVC&amp;diff=8679"/>
		<updated>2020-01-19T06:02:22Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: &amp;quot;Id&amp;quot; -&amp;gt; &amp;quot;ID&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
= System calls =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! ID || Return Type || Name || Arguments&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || Result || [[#SetHeapSize|SetHeapSize]] || uintptr_t *out_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || Result || [[#SetMemoryPermission|SetMemoryPermission]] || uintptr_t address, size_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || Result || [[#SetMemoryAttribute|SetMemoryAttribute]] || uintptr_t address, size_t size, uint32_t mask, uint32_t attr&lt;br /&gt;
|-&lt;br /&gt;
| 0x04 || Result || [[#MapMemory|MapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x05 || Result || [[#UnmapMemory|UnmapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x06 || Result || [[#QueryMemory|QueryMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x07 || void || [[#ExitProcess|ExitProcess]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x08 || Result || [[#CreateThread|CreateThread]] || Handle *out_handle, ThreadFunc func, uintptr_t arg, uintptr_t stack_bottom, int32_t priority, int32_t core_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x09 || Result || [[#StartThread|StartThread]] || Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A || void || [[#ExitThread|ExitThread]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x0B || void || [[#SleepThread|SleepThread]] || int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || Result || [[#GetThreadPriority|GetThreadPriority]] || int32_t *out_priority, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D || Result || [[#SetThreadPriority|SetThreadPriority]] || Handle thread_handle, int32_t priority&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E || Result || [[#GetThreadCoreMask|GetThreadCoreMask]] || int32_t *out_core_id, uint64_t *out_affinity_mask, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F || Result || [[#SetThreadCoreMask|SetThreadCoreMask]] || Handle thread_handle, int32_t core_id, uint64_t affinity_mask&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || int32_t || [[#GetCurrentProcessorNumber|GetCurrentProcessorNumber]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x11 || Result || [[#SignalEvent|SignalEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x12 || Result || [[#ClearEvent|ClearEvent]] || Handle event_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x13 || Result || [[#MapSharedMemory|MapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || Result || [[#UnmapSharedMemory|UnmapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x15 || Result || [[#CreateTransferMemory|CreateTransferMemory]] || Handle *out_handle, uintptr_t address, size_t size, MemoryPermission map_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x16 || Result || [[#CloseHandle|CloseHandle]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x17 || Result || [[#ResetSignal|ResetSignal]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || Result || [[#WaitSynchronization|WaitSynchronization]] || int32_t *out_index, const Handle *handles, int32_t numHandles, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x19 || Result || [[#CancelSynchronization|CancelSynchronization]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A || Result || [[#ArbitrateLock|ArbitrateLock]] || Handle thread_handle, uintptr_t address, uint32_t tag&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B || Result || [[#ArbitrateUnlock|ArbitrateUnlock]] || uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || Result || [[#WaitProcessWideKeyAtomic|WaitProcessWideKeyAtomic]] || uintptr_t address, uintptr_t cv_key, uint32_t tag, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D || void || [[#SignalProcessWideKey|SignalProcessWideKey]] || uintptr_t cv_key, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E || int64_t || [[#GetSystemTick|GetSystemTick]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x1F || Result || [[#ConnectToNamedPort|ConnectToNamedPort]] || Handle *out_handle, const char *name&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || Result || [[#SendSyncRequestLight|SendSyncRequestLight]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x21 || Result || [[#SendSyncRequest|SendSyncRequest]] || Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x22 || Result || [[#SendSyncRequestWithUserBuffer|SendSyncRequestWithUserBuffer]] || uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x23 || Result || [[#SendAsyncRequestWithUserBuffer|SendAsyncRequestWithUserBuffer]] || Handle *out_event_handle, uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || Result || [[#GetProcessId|GetProcessId]] || uint64_t *out_process_id, Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x25 || Result || [[#GetThreadId|GetThreadId]] || uint64_t *out_thread_id, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x26 || void || [[#Break|Break]] || BreakReason break_reason, uintptr_t arg, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x27 || Result || [[#OutputDebugString|OutputDebugString]] || const char *debug_str, size_t len&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || void || [[#ReturnFromException|ReturnFromException]] || Result result&lt;br /&gt;
|-&lt;br /&gt;
| 0x29 || Result || [[#GetInfo|GetInfo]] || uint64_t *out, InfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x2A || void || [[#FlushEntireDataCache|FlushEntireDataCache]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x2B || Result || [[#FlushDataCache|FlushDataCache]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2C  || Result || [[#MapPhysicalMemory|MapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [3.0.0+] 0x2D  || Result || [[#UnmapPhysicalMemory|UnmapPhysicalMemory]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x2E  || Result || [[#GetDebugFutureThreadInfo|GetDebugFutureThreadInfo]] || arch::LastThreadContext *out_context, uint64_t *thread_id, Handle debug_handle, int64_t ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x2F || Result || [[#GetLastThreadInfo|GetLastThreadInfo]] || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || Result || [[#GetResourceLimitLimitValue|GetResourceLimitLimitValue]] || int64_t *out_limit_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x31 || Result || [[#GetResourceLimitCurrentValue|GetResourceLimitCurrentValue]] || int64_t *out_current_value, Handle resource_limit_handle, LimitableResource which&lt;br /&gt;
|-&lt;br /&gt;
| 0x32 || Result || [[#SetThreadActivity|SetThreadActivity]] || Handle thread_handle, ThreadActivity thread_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x33  || Result || [[#GetThreadContext3|GetThreadContext3]] || ThreadContext *out_context, Handle thread_handle&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x34 || Result || [[#WaitForAddress|WaitForAddress]] || uintptr_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x35 || Result || [[#SignalToAddress|SignalToAddress]] || uintptr_t address, SignalType signal_type, int32_t value, int32_t count&lt;br /&gt;
|-&lt;br /&gt;
| [8.0.0+] 0x36 || void || [[#SynchronizePreemptionState|SynchronizePreemptionState]] || &lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [1.0.0-3.0.2] 0x3C || void || [[#DumpInfo|DumpInfo]] || DumpInfoType dump_info_type, uint64_t arg&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3C || void || [[#KernelDebug|KernelDebug]] || KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x3D || void || [[#ChangeKernelTraceState|ChangeKernelTraceState]] || KernelTraceState kern_trace_state&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| 0x40 || Result || [[#CreateSession|CreateSession]] || Handle *out_server_session_handle, Handle *out_client_session_handle, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x41 || Result || [[#AcceptSession|AcceptSession]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x42 || Result || [[#ReplyAndReceiveLight|ReplyAndReceiveLight]] || Handle handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x43 || Result || [[#ReplyAndReceive|ReplyAndReceive]] || int32_t *out_index, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x44 || Result || [[#ReplyAndReceiveWithUserBuffer|ReplyAndReceiveWithUserBuffer]] || int32_t *out_index, uintptr_t message_buffer, size_t message_buffer_size, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns&lt;br /&gt;
|-&lt;br /&gt;
| 0x45 || Result || [[#CreateEvent|CreateEvent]] || Handle *out_write_handle, Handle *out_read_handle&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x48 || Result || [[#MapPhysicalMemoryUnsafe|MapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x49 || Result || [[#UnmapPhysicalMemoryUnsafe|UnmapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [5.0.0+] 0x4A || Result || [[#SetUnsafeLimit|SetUnsafeLimit]] || size_t limit&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4B || Result || [[#CreateCodeMemory|CreateCodeMemory]] || Handle *out_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| [4.0.0+] 0x4C || Result || [[#ControlCodeMemory|ControlCodeMemory]] || Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x4D || void || [[#SleepSystem|SleepSystem]] || &lt;br /&gt;
|-&lt;br /&gt;
| 0x4E || Result || [[#ReadWriteRegister|ReadWriteRegister]] || uint32_t *out_value, PhysicalAddress address, uint32_t mask, uint32_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x4F || Result || [[#SetProcessActivity|SetProcessActivity]] || Handle process_handle, ProcessActivity process_activity&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || Result || [[#CreateSharedMemory|CreateSharedMemory]] || Handle *out_handle, size_t size, MemoryPermission owner_perm, MemoryPermission remote_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x51 || Result || [[#MapTransferMemory|MapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size, MemoryPermission owner_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x52 || Result || [[#UnmapTransferMemory|UnmapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x53 || Result || [[#CreateInterruptEvent|CreateInterruptEvent]] || Handle *out_read_handle, int32_t interrupt_id, InterruptType interrupt_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x54 || Result || [[#QueryPhysicalAddress|QueryPhysicalAddress]] || arch::PhysicalMemoryInfo *out_info, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x55 || Result || [[#QueryIoMapping|QueryIoMapping]] || uintptr_t *out_address, PhysicalAddress physical_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x56 || Result || [[#CreateDeviceAddressSpace|CreateDeviceAddressSpace]] || Handle *out_handle, uint64_t das_address, uint64_t das_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x57 || Result || [[#AttachDeviceAddressSpace|AttachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || Result || [[#DetachDeviceAddressSpace|DetachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x59 || Result || [[#MapDeviceAddressSpaceByForce|MapDeviceAddressSpaceByForce]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5A || Result || [[#MapDeviceAddressSpaceAligned|MapDeviceAddressSpaceAligned]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5B || Result || [[#MapDeviceAddressSpace|MapDeviceAddressSpace]] || size_t *out_mapped_size, Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, MemoryPermission device_perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x5C || Result || [[#UnmapDeviceAddressSpace|UnmapDeviceAddressSpace]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address&lt;br /&gt;
|-&lt;br /&gt;
| 0x5D || Result || [[#InvalidateProcessDataCache|InvalidateProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5E || Result || [[#StoreProcessDataCache|StoreProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x5F || Result || [[#FlushProcessDataCache|FlushProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || Result || [[#DebugActiveProcess|DebugActiveProcess]] || Handle *out_handle, uint64_t process_id&lt;br /&gt;
|-&lt;br /&gt;
| 0x61 || Result || [[#BreakDebugProcess|BreakDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x62 || Result || [[#TerminateDebugProcess|TerminateDebugProcess]] || Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x63 || Result || [[#GetDebugEvent|GetDebugEvent]] || arch::DebugEventInfo *out_info, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || Result || [[#ContinueDebugEvent|ContinueDebugEvent]] || Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids&lt;br /&gt;
|-&lt;br /&gt;
| 0x65 || Result || [[#GetProcessList|GetProcessList]] || int32_t *out_num_processes, uint64_t *out_process_ids, int32_t max_out_count&lt;br /&gt;
|-&lt;br /&gt;
| 0x66 || Result || [[#GetThreadList|GetThreadList]] || int32_t *out_num_threads, uint64_t *out_thread_ids, int32_t max_out_count, Handle debug_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x67 || Result || [[#GetDebugThreadContext|GetDebugThreadContext]] || ThreadContext *out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || Result || [[#SetDebugThreadContext|SetDebugThreadContext]] || Handle debug_handle, uint64_t thread_id, const ThreadContext *context, uint32_t context_flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x69 || Result || [[#QueryDebugProcessMemory|QueryDebugProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uintptr_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x6A || Result || [[#ReadDebugProcessMemory|ReadDebugProcessMemory]] || uintptr_t buffer, Handle debug_handle, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6B || Result || [[#WriteDebugProcessMemory|WriteDebugProcessMemory]] || Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || Result || [[#SetHardwareBreakPoint|SetHardwareBreakPoint]] || HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value&lt;br /&gt;
|-&lt;br /&gt;
| 0x6D || Result || [[#GetDebugThreadParam|GetDebugThreadParam]] || uint64_t *out_64, uint32_t *out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| [5.0.0+] 0x6F || Result || [[#GetSystemInfo|GetSystemInfo]] || uint64_t *out, SystemInfoType info_type, Handle handle, uint64_t info_subtype&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || Result || [[#CreatePort|CreatePort]] || Handle *out_server_handle, Handle *out_client_handle, int32_t max_sessions, bool is_light, uintptr_t name&lt;br /&gt;
|-&lt;br /&gt;
| 0x71 || Result || [[#ManageNamedPort|ManageNamedPort]] || Handle *out_server_handle, const char *name, int32_t max_sessions&lt;br /&gt;
|-&lt;br /&gt;
| 0x72 || Result || [[#ConnectToPort|ConnectToPort]] || Handle *out_handle, Handle port&lt;br /&gt;
|-&lt;br /&gt;
| 0x73 || Result || [[#SetProcessMemoryPermission|SetProcessMemoryPermission]] || Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm&lt;br /&gt;
|-&lt;br /&gt;
| 0x74 || Result || [[#MapProcessMemory|MapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x75 || Result || [[#UnmapProcessMemory|UnmapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x76 || Result || [[#QueryProcessMemory|QueryProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uint64_t address&lt;br /&gt;
|-&lt;br /&gt;
| 0x77 || Result || [[#MapProcessCodeMemory|MapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x78 || Result || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size&lt;br /&gt;
|-&lt;br /&gt;
| 0x79 || Result || [[#CreateProcess|CreateProcess]] || Handle *out_handle, const arch::CreateProcessParameter *parameters, const uint32_t *caps, int32_t num_caps&lt;br /&gt;
|-&lt;br /&gt;
| 0x7A || Result || [[#StartProcess|StartProcess]] || Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size&lt;br /&gt;
|-&lt;br /&gt;
| 0x7B || Result || [[#TerminateProcess|TerminateProcess]] || Handle process_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7C || Result || [[#GetProcessInfo|GetProcessInfo]] || int64_t *out_info, Handle process_handle, ProcessInfoType info_type&lt;br /&gt;
|-&lt;br /&gt;
| 0x7D || Result || [[#CreateResourceLimit|CreateResourceLimit]] || Handle *out_handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x7E || Result || [[#SetResourceLimitLimitValue|SetResourceLimitLimitValue]] || Handle resource_limit_handle, LimitableResource which, int64_t limit_value&lt;br /&gt;
|-&lt;br /&gt;
| 0x7F || void || [[#CallSecureMonitor|CallSecureMonitor]] || SecureMonitorArguments *args&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SetHeapSize ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint32_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || void* || HeapAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the process heap to a given Size. It can both extend and shrink the heap.&lt;br /&gt;
&lt;br /&gt;
Size must be a multiple of 0x200000 (2MB).&lt;br /&gt;
&lt;br /&gt;
On success, the heap base-address (which is fixed by kernel, aslr&#039;d, and always in the Heap memory region) is written to HeapAddress.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition. The memory allocated counts towards the caller&#039;s process Memory ResourceLimit.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Size must be less than or equal to 4GB.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Invalid size passed. It&#039;s either bigger than 4GB, or misaligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD001:&#039;&#039;&#039; Size is bigger than the Heap Region size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; KMemoryBlockAllocator slab allocator exhausted.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The memory region is in an invalid state. Likely because a mapping was made in the heap region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x10801:&#039;&#039;&#039; Memory resource limit reached.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes permission of page-aligned memory region.&lt;br /&gt;
&lt;br /&gt;
Bit2 of permission (exec) is not allowed. Setting write-only is not allowed either (bit1).&lt;br /&gt;
&lt;br /&gt;
This can be used to move back and forth between ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The memory region was reprotected.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Unaligned address specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Unaligned or zero size specified.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; The provided memory region does not fall within the userland address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD801:&#039;&#039;&#039; Invalid permission specified. Valid permissions are ---, r-- and rw-.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD401:&#039;&#039;&#039; 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]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; Kernel resource exhausted.&lt;br /&gt;
&lt;br /&gt;
== SetMemoryAttribute ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Mask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changes attribute of page-aligned memory region. The only allowed combination of Value and Mask is 0x8, which means only bit3 in [[#MemoryAttribute]] can be set or cleared.&lt;br /&gt;
&lt;br /&gt;
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU.&lt;br /&gt;
&lt;br /&gt;
What happens &amp;quot;under the hood&amp;quot; is the &amp;quot;Memory Attribute Indirection Register&amp;quot; index is changed from 2 to 3 in the MMU descriptor.&lt;br /&gt;
&lt;br /&gt;
== MapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps a memory range into a different range.&lt;br /&gt;
&lt;br /&gt;
Mainly used for adding guard pages around stack.&lt;br /&gt;
&lt;br /&gt;
Source range gets reprotected to --- (it can no longer be accessed), and bit0 is set in the source [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
[1.0.0] This could be used to map into either the Alias Region or the Stack region.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] This can only be used to map into the Stack region.&lt;br /&gt;
&lt;br /&gt;
Code can get the range of the Alias region from [[#GetInfo]] id0=2,3, and on 2.0.0+ the range of the Stack region via [[#GetInfo]] id0=14, 15 (on 1.0.0, the Stack region had hardcoded limits).&lt;br /&gt;
&lt;br /&gt;
When mapped into the Alias region, the mapped memory will have state 0x482907.&lt;br /&gt;
&lt;br /&gt;
When mapped into the Stack region, the mapped memory will have state 0x5C3C0B.&lt;br /&gt;
&lt;br /&gt;
== UnmapMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps a region that was previously mapped with [[#MapMemory]].&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to unmap ranges partially, you don&#039;t need to unmap the entire range &amp;quot;in one go&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The srcaddr/dstaddr must match what was given when the pages were originally mapped.&lt;br /&gt;
&lt;br /&gt;
== QueryMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address.&lt;br /&gt;
&lt;br /&gt;
Outputs a [[#MemoryInfo]] struct.&lt;br /&gt;
&lt;br /&gt;
== ExitProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current process.&lt;br /&gt;
&lt;br /&gt;
== CreateThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void(*)(void*) || Entry&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || void* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || void* || StackTop&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || int32_t || ProcessorId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a thread in the current process.&lt;br /&gt;
&lt;br /&gt;
ProcessorId must be 0,1,2,3 or -2, where -2 uses the default CpuId for process.&lt;br /&gt;
&lt;br /&gt;
== StartThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starts the thread for the provided handle.&lt;br /&gt;
&lt;br /&gt;
== ExitThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exits the current thread.&lt;br /&gt;
&lt;br /&gt;
== SleepThread ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0, R1 || uint64_t || Nanoseconds&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sleeps for a specified amount of time, or yields the thread.&lt;br /&gt;
&lt;br /&gt;
Setting nanoseconds to 0, -1, or -2 indicates a yielding type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Yielding without core migration&lt;br /&gt;
|-&lt;br /&gt;
| -1 || Yielding with core migration&lt;br /&gt;
|-&lt;br /&gt;
| -2 || Yielding to any other thread&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || int32_t || Priority&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadPriority ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0|| Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1|| int32_t || Priority&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the priority of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
Priority is a number 0-0x3F. Lower value means higher priority.&lt;br /&gt;
&lt;br /&gt;
== GetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== SetThreadCoreMask ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || CoreMask0&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || CoreMask1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the affinity mask of provided thread handle.&lt;br /&gt;
&lt;br /&gt;
== GetCurrentProcessorNumber ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || uint32_t || CpuId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gets which cpu is executing the current thread.&lt;br /&gt;
&lt;br /&gt;
CpuId is an integer in the range 0-3.&lt;br /&gt;
&lt;br /&gt;
== SignalEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puts the given event in the signaled state.&lt;br /&gt;
&lt;br /&gt;
Will wake up any thread currently waiting on this event. Can potentially trigger a reschedule.&lt;br /&gt;
&lt;br /&gt;
Any calls to [[#WaitSynchronization]] on this handle will return immediately, until the event&#039;s signaled state is reset.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Event is now in signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
== ClearEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;WritableEvent&amp;gt; or Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes the given event out of the signaled state.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success, the event is now in the not-signaled state.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not in a signaled state.&lt;br /&gt;
&lt;br /&gt;
== MapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== UnmapSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].&lt;br /&gt;
&lt;br /&gt;
Executable bit perm not allowed.&lt;br /&gt;
&lt;br /&gt;
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.&lt;br /&gt;
&lt;br /&gt;
== CloseHandle ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResetSignal ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;ReadableEvent&amp;gt; or Handle&amp;lt;Process&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Resets the signal on the given handle, ensuring future calls to [[#WaitSynchronization]] on this handle will sleep until the handle is signaled again. If the handle is a ReadableEvent, this is equivalent to calling ClearEvent() on the handle.&lt;br /&gt;
&lt;br /&gt;
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 ResetSignal on the process will no longer have an effect (the process is permanently signaled), and the syscall will return 0xFA01.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The signal was reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The handle is invalid or of the wrong type.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xFA01:&#039;&#039;&#039; The handle was not signaled, or the process is in exited state, causing it to be permanently signaled.&lt;br /&gt;
&lt;br /&gt;
== WaitSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle* || HandlesPtr&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || HandlesNum&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint64_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Works with HandlesNum &amp;lt;= 0x40.&lt;br /&gt;
&lt;br /&gt;
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.&lt;br /&gt;
&lt;br /&gt;
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.&lt;br /&gt;
&lt;br /&gt;
=== Object types ===&lt;br /&gt;
&#039;&#039;&#039;KDebug:&#039;&#039;&#039; signals when there is a new [[#DebugEventInfo|DebugEvent]] (retrievable via [[#GetDebugEvent]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KClientPort:&#039;&#039;&#039; signals when the number of sessions is less than the maximum allowed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KProcess:&#039;&#039;&#039; signals when the process undergoes a state change (retrievable via [[#GetProcessInfo]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KReadableEvent:&#039;&#039;&#039; signals when the event&#039;s corresponding KWritableEvent has been signaled via [[#SignalEvent]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerPort:&#039;&#039;&#039; signals when there is an incoming connection waiting to be [[#AcceptSession|accepted]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KServerSession:&#039;&#039;&#039; signals when there is an incoming message waiting to be [[#ReplyAndReceive|received]] or the pipe is closed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;KThread:&#039;&#039;&#039; signals when the thread has exited.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0x7601:&#039;&#039;&#039; Thread termination requested. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xec01:&#039;&#039;&#039; Interrupted. Returned when another thread uses [[#CancelSynchronization]] to cancel this thread. Handle index is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; Too many handles. Returned when the number of handles passed is &amp;gt; 0x40.&lt;br /&gt;
&lt;br /&gt;
== CancelSynchronization ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the referenced thread is currently in a synchronization call ([[#WaitSynchronization]], [[#ReplyAndReceive]] or [[#ReplyAndReceiveLight]]), that call will be interrupted and return 0xec01.&lt;br /&gt;
If that thread is not currently executing such a synchronization call, the next call to a synchronization call will return 0xec01.&lt;br /&gt;
&lt;br /&gt;
This doesn&#039;t take force-pause (activity/debug pause) into account.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The thread was either interrupted or has had its flag set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid handle. The handle given was either invalid or not a thread handle.&lt;br /&gt;
&lt;br /&gt;
== ArbitrateLock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;                                  &lt;br /&gt;
&lt;br /&gt;
== ArbitrateUnlock ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitProcessWideKeyAtomic ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || KeyAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || TagAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Tag&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || int64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalProcessWideKey ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || int32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemTick ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0, R1 || uint64_t || Ticks&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the value of cntpct_el0.&lt;br /&gt;
&lt;br /&gt;
The frequency is 19200000 Hz (constant from official sw).&lt;br /&gt;
&lt;br /&gt;
Official sw reads cntpct_el0 directly from usermode without using this SVC. [[ExeFS|sdk-nso]] has this SVC, but it&#039;s not known to be called anywhere.&lt;br /&gt;
&lt;br /&gt;
== ConnectToNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || PortName&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequest ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SendSyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xcc01:&#039;&#039;&#039; Address is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xca01:&#039;&#039;&#039; Size is not 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xce01:&#039;&#039;&#039; KSessionRequest allocation failed (unlikely) or pointer buffer size exceeded.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Handles does not exist, or handle is not an instance of KClientSession.&lt;br /&gt;
&lt;br /&gt;
== SendAsyncRequestWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || EventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size and Address must be 0x1000-aligned.&lt;br /&gt;
&lt;br /&gt;
== GetProcessId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ProcessId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadId ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || ThreadId&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Break ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#BreakReason]] || BreakReason&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Info&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the process is attached, report the Break event. Then, if [[#ContinueDebugEvent]] didn&#039;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).&lt;br /&gt;
&lt;br /&gt;
Otherwise, if bit31 in reason isn&#039;t set, perform crash reporting (see Exception Handling section below), if it doesn&#039;t terminate the process adjust ELR_EL1 as well.&lt;br /&gt;
&lt;br /&gt;
Otherwise just return 0.&lt;br /&gt;
&lt;br /&gt;
== OutputDebugString ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || char* || String&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReturnFromException ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#InfoType]] || InfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || uint64_t || InfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Info&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushEntireDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Acts like [[#SetHeapSize]] except you can allocate heap at any address you&#039;d like.&lt;br /&gt;
&lt;br /&gt;
Uses current process pool partition.&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugFutureThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetLastThreadInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || LastThreadContextParam0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || LastThreadContextParam1&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || LastThreadContextParam2&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X4 || uint64_t || LastThreadContextParam3&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X5 || uint64_t ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W6 || uint32_t ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || LimitValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetResourceLimitCurrentValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || int64_t || CurrentValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetThreadActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ThreadActivity]] || ThreadActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetThreadContext3 ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Thread&amp;gt; || ThreadHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WaitForAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#ArbitrationType]] || ArbitrationType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SignalToAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#SignalType]] || SignalType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || uint32_t || NumToSignal&lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || || ||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SynchronizePreemptionState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None ||  || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DumpInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DumpInfoType]] || DumpInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || DumpInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] This function was removed and replaced by [[#KernelDebug]].&lt;br /&gt;
&lt;br /&gt;
== KernelDebug ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelDebugType]] || KernelDebugType&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== ChangeKernelTraceState ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#KernelTraceState]] || KernelTraceState&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stubbed in retail kernel.&lt;br /&gt;
&lt;br /&gt;
== CreateSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ClientSession&amp;gt; || ClientSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== AcceptSession ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || PortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ServerSession&amp;gt; || ServerSessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0xf201:&#039;&#039;&#039; No session waiting to be accepted&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveLight ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Port&amp;gt; or Handle&amp;lt;ServerSession&amp;gt; || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceive ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0, R4 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is not zero, a reply from the TLS will be sent to that session.&lt;br /&gt;
Then it will wait until either of the passed sessions has an incoming message, is closed, a passed port has an incoming connection, or the timeout expires.&lt;br /&gt;
If there is an incoming message, it is copied to the TLS.&lt;br /&gt;
&lt;br /&gt;
If ReplyTargetSessionHandle is zero, the TLS should contain a blank message. If this message has a C descriptor, the buffer it points to will be used as the pointer buffer. See [[IPC_Marshalling#IPC_buffers]]. Note that a pointer buffer cannot be specified if ReplyTargetSessionHandle is not zero.&lt;br /&gt;
&lt;br /&gt;
After being validated, passed handles will be enumerated in order; even if a session has been closed, if one that appears earlier in the list has an incoming message, it will take priority and a result code of 0x0 will be returned.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. Either a session has an incoming message or a port has an incoming connection. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xea01:&#039;&#039;&#039; Timeout. No handles were signalled before the timeout expired. HandleIndex is not updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf601:&#039;&#039;&#039; Port remote dead. One of the sessions has been closed. HandleIndex is set appropriately.&lt;br /&gt;
&lt;br /&gt;
== ReplyAndReceiveWithUserBuffer ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || Handle&amp;lt;Port&amp;gt;* or Handle&amp;lt;ServerSession&amp;gt;* || Handles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R0 || uint32_t || NumHandles&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R4 || Handle&amp;lt;ServerSession&amp;gt; || ReplyTargetSessionHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X6 || R5, R6 || uint64_t || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || HandleIndex&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;WritableEvent&amp;gt; || WritableEventHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapPhysicalMemory]] except it always uses pool partition 0.&lt;br /&gt;
&lt;br /&gt;
== UnmapPhysicalMemoryUnsafe ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetUnsafeLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || uint64_t || Limit&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes an address range with backing memory to create the code memory object.&lt;br /&gt;
&lt;br /&gt;
The memory is initially memset to 0xFF after being locked.&lt;br /&gt;
&lt;br /&gt;
== ControlCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;CodeMemory&amp;gt; || CodeMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#CodeMemoryOperation]] || CodeMemoryOperation&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4, R5 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R6 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the backing memory for a CodeMemory object into the current process.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapOwner]], memory permission must be RW-.&lt;br /&gt;
&lt;br /&gt;
For [[#CodeMemoryOperation|MapSlave]], memory permission must be R-- or R-X.&lt;br /&gt;
&lt;br /&gt;
Operations [[#CodeMemoryOperation|UnmapOwner/UnmapSlave]] unmap memory that was previously mapped this way.&lt;br /&gt;
&lt;br /&gt;
This allows one &amp;quot;secure JIT&amp;quot; process to map the code memory as RW-, and the other &amp;quot;slave&amp;quot; process to map it R-X.&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] Error 0xE401 is now returned when the process owner of the Code memory object is the same as the current process.&lt;br /&gt;
&lt;br /&gt;
== SleepSystem ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || || &lt;br /&gt;
|-&lt;br /&gt;
| (Out) None || || &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadWriteRegister ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || RegisterAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R0 || uint32_t || RwMask&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R1 || uint32_t || InValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || OutValue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read/write IO registers with a hardcoded whitelist. Input address is physical-address and must be aligned to 4.&lt;br /&gt;
&lt;br /&gt;
rw_mask is 0 for reading and 0xffffffff for writing. You can also write individual bits by using a mask value.&lt;br /&gt;
&lt;br /&gt;
You can only write to registers inside physical pages 0x70019000 (MC), 0x7001C000 (MC0), 0x7001D000 (MC1), and they all share the same whitelist.&lt;br /&gt;
&lt;br /&gt;
The whitelist is same for writing as for reading.&lt;br /&gt;
&lt;br /&gt;
The whitelist is:&lt;br /&gt;
&lt;br /&gt;
0x054, 0x090, 0x094, 0x098, 0x09c, 0x0a0, 0x0a4, 0x0a8, 0x0ac, 0x0b0, 0x0b4, 0x0b8, 0x0bc, 0x0c0, 0x0c4, 0x0c8, 0x0d0, 0x0d4, 0x0d8, 0x0dc, 0x0e0, 0x100, 0x108, 0x10c, 0x118, 0x11c, 0x124, 0x128, 0x12c, 0x130, 0x134, 0x138, 0x13c, 0x158, 0x15c, 0x164, 0x168, 0x16c, 0x170, 0x174, 0x178, 0x17c, 0x200, 0x204, 0x2e4, 0x2e8, 0x2ec, 0x2f4, 0x2f8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37c, 0x380, 0x390, 0x394, 0x398, 0x3ac, 0x3b8, 0x3bc, 0x3c0, 0x3c4, 0x3d8, 0x3e8, 0x41c, 0x420, 0x424, 0x428, 0x42c, 0x430, 0x44c, 0x47c, 0x480, 0x484, 0x50c, 0x554, 0x558, 0x55c, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69c, 0x6a0, 0x6a4, 0x6c0, 0x6c4, 0x6f0, 0x6f4, 0x960, 0x970, 0x974, 0xa20, 0xa24, 0xb88, 0xb8c, 0xbc4, 0xbc8, 0xbcc, 0xbd0, 0xbd4, 0xbd8, 0xbdc, 0xbe0, 0xbe4, 0xbe8, 0xbec, 0xc00, 0xc5c, 0xcac&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] Whitelist was extended with 0x4c4, 0x4c8, 0x4cc, 0x584, 0x588, 0x58c.&lt;br /&gt;
&lt;br /&gt;
[2.0.0+] The IO registers in range 0x7000E400 (PMC) size 0xC00 skip the whitelist, and do a TrustZone call using [[SMC#ReadWriteRegister|ReadWriteRegister]].&lt;br /&gt;
&lt;br /&gt;
[4.0.0+] Access to the Memory Controller (0x70019000) also uses smcReadWriteRegister.&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by that SMC, relative to the start of the PMC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x00c, 0x010, 0x014, 0x01c, 0x020, 0x02c, 0x030, 0x034, 0x038, 0x03c, 0x040, 0x044, 0x048, 0x0dc, 0x0e0, 0x0e4, 0x160, 0x164, 0x168, 0x170, 0x1a8, 0x1b8, 0x1bc, 0x1c0, 0x1c4, 0x1c8, 0x2b4, 0x2d4, 0x440, 0x4d8&lt;br /&gt;
&lt;br /&gt;
Here is the whitelist imposed by the SMC [[SMC#ReadWriteRegister|ReadWriteRegister]] (checked in addition to the whitelist in the ReadWriteRegister SVC), relative to the start of the MC registers:&lt;br /&gt;
&lt;br /&gt;
0x000, 0x004, 0x008, 0x00C, 0x010, 0x01C, 0x020, 0x030, 0x034, 0x050, 0x054, 0x090, 0x094, 0x098, 0x09C, 0x0A0, 0x0A4, 0x0A8, 0x0AC, 0x0B0, 0x0B4, 0x0B8, 0x0BC, 0x0C0, 0x0C4, 0x0C8, 0x0D0, 0x0D4, 0x0D8, 0x0DC, 0x0E0, 0x100, 0x108, 0x10C, 0x118, 0x11C, 0x124, 0x128, 0x12C, 0x130, 0x134, 0x138, 0x13C, 0x158, 0x15C, 0x164, 0x168, 0x16C, 0x170, 0x174, 0x178, 0x17C, 0x200, 0x204, 0x238, 0x240, 0x244, 0x250, 0x254, 0x258, 0x264, 0x268, 0x26C, 0x270, 0x274, 0x280, 0x284, 0x288, 0x28C, 0x294, 0x2E4, 0x2E8, 0x2EC, 0x2F4, 0x2F8, 0x310, 0x314, 0x320, 0x328, 0x344, 0x348, 0x370, 0x374, 0x37C, 0x380, 0x390, 0x394, 0x398, 0x3AC, 0x3B8, 0x3BC, 0x3C0, 0x3C4, 0x3D8, 0x3E8, 0x41C, 0x420, 0x424, 0x428, 0x42C, 0x430, 0x44C, 0x47C, 0x480, 0x484, 0x4C4, 0x4C8, 0x4CC, 0x50C, 0x554, 0x558, 0x55C, 0x584, 0x588, 0x58C, 0x670, 0x674, 0x690, 0x694, 0x698, 0x69C, 0x6A0, 0x6A4, 0x6C0, 0x6C4, 0x6F0, 0x6F4, 0x960, 0x970, 0x974, 0x9B8, 0xA20, 0xA24, 0xA88, 0xA94, 0xA98, 0xA9C, 0xAA0, 0xAA4, 0xAA8, 0xAAC, 0xAB0, 0xAB4, 0xAB8, 0xABC, 0xAC0, 0xAC4, 0xAC8, 0xACC, 0xAD0, 0xAD4, 0xAD8, 0xADC, 0xAE0, 0xB88, 0xB8C, 0xBC4, 0xBC8, 0xBCC, 0xBD0, 0xBD4, 0xBD8, 0xBDC, 0xBE0, 0xBE4, 0xBE8, 0xBEC, 0xC00, 0xC5C, 0xCAC&lt;br /&gt;
&lt;br /&gt;
== SetProcessActivity ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || [[#ProcessActivity]] || ProcessActivity&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreateSharedMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#MemoryPermission]] || LocalMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || RemoteMemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;SharedMemory&amp;gt; || SharedMemoryHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other perm can be used to enforce permission 1, 3, or 0x10000000 if don&#039;t care.&lt;br /&gt;
&lt;br /&gt;
Allocates memory from the current process&#039; pool partition.&lt;br /&gt;
&lt;br /&gt;
== MapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The newly mapped pages will have [[#MemoryState]] type 0xE.&lt;br /&gt;
&lt;br /&gt;
You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error.&lt;br /&gt;
&lt;br /&gt;
== UnmapTransferMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || Handle&amp;lt;TransferMemory&amp;gt; || TransferMemoryHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Size must match size given in map syscall, otherwise there&#039;s an invalid-size error.&lt;br /&gt;
&lt;br /&gt;
== CreateInterruptEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#Interrupt]] || Interrupt&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || [[#InterruptType]] || InterruptType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ReadableEvent&amp;gt; || ReadableEventHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates an event handle for the given IRQ number. Waiting on this handle will wait until the IRQ is triggered. The InterruptType argument configures the triggering. If it is 0, the IRQ is active HIGH level sensitive, if it is 1 it is rising-edge sensitive.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Flags was &amp;gt; 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF201:&#039;&#039;&#039; IRQ above 0x3FF or outside the [[NPDM#Kernel_Access_Control|IRQ access mask]] was given.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCE01:&#039;&#039;&#039; A SlabHeap was exhausted (too many interrupts created).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF401:&#039;&#039;&#039; IRQ already has an event registered.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xD201:&#039;&#039;&#039; The handle table is full. Try closing some handles.&lt;br /&gt;
&lt;br /&gt;
== QueryPhysicalAddress ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || VirtualAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]]|| Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || PhysicalMemoryInfoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X2 || uint64_t || PhysicalMemoryInfoBaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X3 || uint64_t || PhysicalMemoryInfoSize&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Queries the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address.&lt;br /&gt;
&lt;br /&gt;
The returned PhysicalMemoryInfoBaseAddress is the virtual address of that page-aligned mapping, while PhysicalMemoryInfoAddress is the physical address of that page. PhysicalMemoryInfoSize is the amount of continuous physical memory in that mapping.&lt;br /&gt;
&lt;br /&gt;
== QueryIoMapping ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || IoAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || void* || VirtualAddress&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a virtual address mapped to a given IO range.&lt;br /&gt;
&lt;br /&gt;
== CreateDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || DeviceAddressSpaceStartAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R0, R1 || uint64_t || DeviceAddressSpaceEndAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a virtual address space for binding device address spaces and returns a handle.&lt;br /&gt;
&lt;br /&gt;
StartAddr is normally set to 0 and EndAddr is normally set to 0xFFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== AttachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attaches a device address space to a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== DetachDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || [[#DeviceName]] || DeviceName&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Detaches a device address space from a [[#DeviceName|device]].&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceByForce ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]).&lt;br /&gt;
&lt;br /&gt;
The userspace destination address must have the [[SVC#MemoryState|MapDeviceAllowed]] bit set. Bit [[SVC#MemoryAttribute|IsDeviceMapped]] will be set after mapping.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpaceAligned ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W5 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps an attached device address space to an userspace address.&lt;br /&gt;
&lt;br /&gt;
Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState|MapDeviceAlignedAllowed]] bit set instead.&lt;br /&gt;
&lt;br /&gt;
== MapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X5 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W6 || R7 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1 || uint64_t || Size&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== UnmapDeviceAddressSpace ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;DeviceAddressSpace&amp;gt; || DeviceAddressSpaceHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps an attached device address space from an userspace address.&lt;br /&gt;
&lt;br /&gt;
== InvalidateProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== StoreProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FlushProcessDataCache ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DebugActiveProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BreakDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateDebugProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#DebugEventInfo]]* || DebugEventInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugEvent ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || uint32_t || [[#ContinueDebugFlags]] ([1.0.0-2.3.0] [[#ContinueDebugFlagsOld]])&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 ([1.0.0-2.3.0] R2, R3) || uint64_t* ([1.0.0-2.3.0] uint64_t)|| ThreadIdList ([1.0.0-2.3.0] ThreadId)&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3 || uint64_t || [3.0.0+] NumThreadIds&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maximum NumThreadIds is 64. 0 means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success. The process has been resumed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe401:&#039;&#039;&#039; Invalid debug handle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xf401:&#039;&#039;&#039; Process has debug events queued or is already running.&lt;br /&gt;
&lt;br /&gt;
== GetProcessList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ProcessIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ProcessIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumProcesses&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fills the provided array with the pids of currently living processes. A process &amp;quot;lives&amp;quot; so long as it is currently running or a handle to it still exists.&lt;br /&gt;
&lt;br /&gt;
It returns the total number of processes currently alive. If this number is bigger than the size of ProcessIdBuffer, the user won&#039;t have all the pids.&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xd401:&#039;&#039;&#039; The provided buffer is outside the process address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xe601:&#039;&#039;&#039; copyToUser failed. The provided buffer is not user-accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xee01:&#039;&#039;&#039; The provided buffer size is too big. Max value is 0xFFFFFFF.&lt;br /&gt;
&lt;br /&gt;
== GetThreadList ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || uint64_t* || ThreadIdBuffer&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || uint32_t || ThreadIdBufferSize&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || uint32_t || NumThreads&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetDebugThreadContext ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1 || [[#ThreadContext]]* || ThreadContext&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]]&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== QueryDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ReadDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== WriteDebugProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || void* || MemoryBufferAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetHardwareBreakPoint ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || [[#HardwareBreakPointRegisterName]] || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || uint64_t || Flags&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Value&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets one of the AArch64 hardware breakpoints. The nintendo switch has 6 hardware breakpoints, and 4 hardware watchpoints. The syscall has two behaviors depending on the value of HardwareBreakPointRegisterName:&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName &amp;lt; 0x10, then it sets one of the AArch64 hardware breakpoints. Flags will go to DBGBCRn_EL1, and value to DBGBVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0x7F01E1. Furthermore, the kernel will or it with 0x4004, in order to set various security flags to guarantee the watchpoints only triggers for code in EL0. If the user asks for a Breakpoint Type of ContextIDR match, the kernel shall use the given DebugHandle to set DBGBVRn_EL1 to the ContextID of the debugged process.&lt;br /&gt;
&lt;br /&gt;
If HardwareBreakPointRegisterName is between 0x10 and 0x20 (exclusive), then it sets one of the AArch64 hardware watchpoints. Flags will go to DBGWCRn_EL1, and the value to DBGWVRn_EL1. The only flags the user is allowed to set are those in the bitmask 0xFF0F1FF9. Furthermore, the kernel will or it with 0x104004. This will set various security flags, and set the watchpoint type to be a Linked Watchpoint. This means that you need to link it to a Linked ContextIDR breakpoint. Check the ARM documentation for more information.&lt;br /&gt;
&lt;br /&gt;
Note that HardwareBreakPointRegisterName 0 to 4 match only to Virtual Address, while HardwareBreakPointRegisterName 5 and 6 match against either Virtual Address, ContextID, or VMID. As such, if you are configuring a breakpoint to link for a watchpoint, make sure you use hardware_breakpoint_id 5 or 6.&lt;br /&gt;
&lt;br /&gt;
For more documentation for hardware breakpoints, check out the AArch64 documentation for the [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488h/way1382455558968.html DBGBCRn_EL1 register] and the [http://infocenter.arm.com/help/topic/com.arm.doc.ddi0488h/way1382455560629.html DBGWCRn_EL1 register]&lt;br /&gt;
&lt;br /&gt;
== GetDebugThreadParam ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2 || Handle&amp;lt;Debug&amp;gt; || DebugHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R0, R1 || uint64_t || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| (In) W4 || R3 || [[#DebugThreadParam]] || DebugThreadParam&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || Out0&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R3 || uint32_t || Out1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetSystemInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#SystemInfoType]] || SystemInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || Handle || Handle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || uint64_t || SystemInfoSubType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || uint64_t || SystemInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CreatePort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R3 || bool || IsLight&lt;br /&gt;
|-&lt;br /&gt;
| (In) X4 || R0 || uint64_t || Name&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W2 || R2 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ManageNamedPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || char* || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || int32_t || MaxSessions&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Port&amp;gt; || ServerPortHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ConnectToPort ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || Handle&amp;lt;Port&amp;gt; || ClientPortHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Session&amp;gt; || SessionHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetProcessMemoryPermission ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || Addr&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (In) W3 || R5 || [[#MemoryPermission]] || MemoryPermission&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets the memory permissions for the specified memory with the supplied process handle.&lt;br /&gt;
&lt;br /&gt;
This throws an error(0xD801) when the input perm is &amp;gt;0x5, hence -WX and RWX are not allowed.&lt;br /&gt;
&lt;br /&gt;
== MapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps the src address from the supplied process handle into the current process.&lt;br /&gt;
&lt;br /&gt;
This allows mapping code and rodata with RW- permission.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R4 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessMemory]].&lt;br /&gt;
&lt;br /&gt;
== QueryProcessMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || [[#MemoryInfo]]* || MemoryInfo&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R1, R3 || void* || Address&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || R1 || [[#PageInfo]] || PageInfo&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equivalent to [[#QueryMemory]] except takes a process handle.&lt;br /&gt;
&lt;br /&gt;
== MapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a process handle, and maps normal heap in that process as executable code in that process. Used when loading NROs. This does not support using the current-process handle alias.&lt;br /&gt;
&lt;br /&gt;
== UnmapProcessCodeMemory ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || R2, R3 || void* || DstAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R1, R4 || void* || SrcAddress&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R5, R6 || uint64_t || Size&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmaps what was mapped by [[#MapProcessCodeMemory]].&lt;br /&gt;
&lt;br /&gt;
== CreateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1 || [[#CreateProcessParameter]]* || CreateProcessParameter&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || uint32_t* || Capabilities&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || int32_t || CapabilitiesNum&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a [[#CreateProcessParameter]] as input.&lt;br /&gt;
Capabilities points to an array of [[NPDM#Kernel_Access_Control|kernel capabilities]].&lt;br /&gt;
CapabilitiesNum is a number of capabilities in the Capabilities array (number of element, not number of bytes).&lt;br /&gt;
&lt;br /&gt;
=== Result codes ===&lt;br /&gt;
&#039;&#039;&#039;0x0:&#039;&#039;&#039; Success.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCA01:&#039;&#039;&#039; Attempted to map more code pages than available in address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xCC01:&#039;&#039;&#039; Provided CodeAddr is invalid (make sure it&#039;s in range?)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE401:&#039;&#039;&#039; The resource handle passed is invalid.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE601:&#039;&#039;&#039; Attempt to copy procinfo from user-supplied pointer failed. Attempt to copy capabilities_num from user-supplied pointer failed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xE801:&#039;&#039;&#039; Attempted to create a 32-bit process with a 36-bit address space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;0xF001:&#039;&#039;&#039; Unused bits are set in mmuflags. Unknown address space type used.&lt;br /&gt;
&lt;br /&gt;
== StartProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || int32_t || MainThreadPriority&lt;br /&gt;
|-&lt;br /&gt;
| (In) W2 || R2 || int32_t || DefaultCpuId&lt;br /&gt;
|-&lt;br /&gt;
| (In) X3 || R3, R4 || uint64_t || MainThreadStackSize&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TerminateProcess ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GetProcessInfo ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R1 || Handle&amp;lt;Process&amp;gt; || ProcessHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R2 || [[#ProcessInfoType]] || ProcessInfoType&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1 || R1, R2 || uint64_t || [[#ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns an enum with value 0-7.&lt;br /&gt;
&lt;br /&gt;
== CreateResourceLimit ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) None || ||&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || [[#Result]] || Result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W1 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SetResourceLimitLimitValue ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) W0 || R0 || Handle&amp;lt;ResourceLimit&amp;gt; || ResourceLimitHandle&lt;br /&gt;
|-&lt;br /&gt;
| (In) W1 || R1 || [[#LimitableResource]] || LimitableResource&lt;br /&gt;
|-&lt;br /&gt;
| (In) X2 || R2, R3 || int64_t || LimitValue&lt;br /&gt;
|-&lt;br /&gt;
| (Out) W0 || R0 || [[#Result]] || Result&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CallSecureMonitor ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Argument64 || Argument32 || Type || Name&lt;br /&gt;
|-&lt;br /&gt;
| (In) X0 || R0 || uint64_t || [[SMC#Secure_Monitor_calls|FunctionId]]&lt;br /&gt;
|-&lt;br /&gt;
| (In) X1-X7 || R1-R7 || uint64_t || SMC arguments&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X0 || R0 || [[SMC#Result|Result]] || SMC result&lt;br /&gt;
|-&lt;br /&gt;
| (Out) X1-X7 || R1-R7 || uint64_t || SMC output&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes in a SMC function ID in X0, and arguments for that SMC function in X1-X7.&lt;br /&gt;
&lt;br /&gt;
Passing an invalid SMC function ID or calling from a core other than core 3 will result in a secure monitor panic.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
== Debugging ==&lt;br /&gt;
[2.0.0+] Exactly 6 debug SVCs require that [[SPL_services#GetConfig|IsDebugMode]] is non-zero. Error 0x4201 is returned otherwise.&lt;br /&gt;
* BreakDebugProcess&lt;br /&gt;
* ContinueDebugEvent&lt;br /&gt;
* WriteDebugProcessMemory&lt;br /&gt;
* SetDebugThreadContext&lt;br /&gt;
* TerminateDebugProcess&lt;br /&gt;
* SetHardwareBreakPoint&lt;br /&gt;
&lt;br /&gt;
DebugActiveProcess stops execution of the target process, the normal method for resuming it requires ContinueDebugEvent(see above). Closing the debug handle also results in execution being resumed.&lt;br /&gt;
&lt;br /&gt;
= Enum/Structures =&lt;br /&gt;
== InfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || InfoType || InfoSubType || Description&lt;br /&gt;
|-&lt;br /&gt;
| Process || 0 || 0 || AllowedCpuIdBitmask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 1 || 0 || AllowedThreadPrioBitmask&lt;br /&gt;
|-&lt;br /&gt;
| Process || 2 || 0 || AliasRegionBaseAddr&lt;br /&gt;
|-&lt;br /&gt;
| Process || 3 || 0 || AliasRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 4 || 0 || HeapRegionBaseAddr&lt;br /&gt;
|-&lt;br /&gt;
| Process || 5 || 0 || HeapRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 6 || 0 || TotalMemoryAvailable. Total memory available(free+used).&lt;br /&gt;
|-&lt;br /&gt;
| Process || 7 || 0 || TotalMemoryUsage. Total used size of codebin memory + main-thread stack + allocated heap.&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 8 || 0 || IsCurrentProcessBeingDebugged&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 9 || 0 || Returns ResourceLimit handle for current process. Used by [[Process_Manager_services|PM]].&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 10 || -1, {current coreid} || IdleTickCount&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 11 || 0-3 || RandomEntropy from current process. TRNG. Used to seed usermode PRNGs.&lt;br /&gt;
|-&lt;br /&gt;
| Process || 12 || 0 || [2.0.0+] AddressSpaceBaseAddr&lt;br /&gt;
|-&lt;br /&gt;
| Process || 13 || 0 || [2.0.0+] AddressSpaceSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 14 || 0 || [2.0.0+] StackRegionBaseAddr&lt;br /&gt;
|-&lt;br /&gt;
| Process || 15 || 0 || [2.0.0+] StackRegionSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 16 || 0 || [3.0.0+] PersonalMmHeapSize&lt;br /&gt;
|-&lt;br /&gt;
| Process || 17 || 0 || [3.0.0+] PersonalMmHeapUsage&lt;br /&gt;
|-&lt;br /&gt;
| Process || 18 || 0 || [3.0.0+] ProgramId&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 0 || [4.0.0-4.1.0] PrivilegedProcessId_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 19 || 1 || [4.0.0-4.1.0] PrivilegedProcessId_UpperBound&lt;br /&gt;
|-&lt;br /&gt;
| Process || 20 || 0 || [5.0.0+] UserExceptionContextAddr&lt;br /&gt;
|-&lt;br /&gt;
| Process || 21 || 0 || [6.0.0+] TotalMemoryAvailableWithoutMmHeap&lt;br /&gt;
|-&lt;br /&gt;
| Process || 22 || 0 || [6.0.0+] TotalMemoryUsedWithoutMmHeap&lt;br /&gt;
|-&lt;br /&gt;
| Process || 23 || 0 || [9.0.0+] IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| 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.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SystemInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Handle type || SystemInfoType || SystemInfoSubType|| Description&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 0 || TotalMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 1 || TotalMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 2 || TotalMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 0 || 3 || TotalMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 0 || CurrentMemorySize_Application&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 1 || CurrentMemorySize_Applet&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 2 || CurrentMemorySize_System&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 1 || 3 || CurrentMemorySize_SystemUnsafe&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 0 || PrivilegedProcessId_LowerBound&lt;br /&gt;
|-&lt;br /&gt;
| Zero    || 2 || 1 || PrivilegedProcessId_UpperBound&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ThreadContextFlags ==&lt;br /&gt;
Bitfield of one of more of these:&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 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.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || Control registers || Reads/writes the FP, LR, PC, SP, PSTATE, and TPIDR registers.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Floating-point registers || Reads/writes the floating-point vector registers.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || Floating-point control registers || Reads/writes the FPCR and FPSR registers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DeviceName ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AFI&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AVPC&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DC&lt;br /&gt;
|-&lt;br /&gt;
| 3 || DCB&lt;br /&gt;
|-&lt;br /&gt;
| 4 || HC&lt;br /&gt;
|-&lt;br /&gt;
| 5 || HDA&lt;br /&gt;
|-&lt;br /&gt;
| 6 || ISP2&lt;br /&gt;
|-&lt;br /&gt;
| 7 || MSENCNVENC&lt;br /&gt;
|-&lt;br /&gt;
| 8 || NV&lt;br /&gt;
|-&lt;br /&gt;
| 9 || NV2&lt;br /&gt;
|-&lt;br /&gt;
| 10 || PPCS&lt;br /&gt;
|-&lt;br /&gt;
| 11 || SATA&lt;br /&gt;
|-&lt;br /&gt;
| 12 || VI&lt;br /&gt;
|-&lt;br /&gt;
| 13 || VIC&lt;br /&gt;
|-&lt;br /&gt;
| 14 || XUSB_HOST&lt;br /&gt;
|-&lt;br /&gt;
| 15 || XUSB_DEV&lt;br /&gt;
|-&lt;br /&gt;
| 16 || TSEC&lt;br /&gt;
|-&lt;br /&gt;
| 17 || PPCS1&lt;br /&gt;
|-&lt;br /&gt;
| 18 || DC1&lt;br /&gt;
|-&lt;br /&gt;
| 19 || SDMMC1A&lt;br /&gt;
|-&lt;br /&gt;
| 20 || SDMMC2A&lt;br /&gt;
|-&lt;br /&gt;
| 21 || SDMMC3A&lt;br /&gt;
|-&lt;br /&gt;
| 22 || SDMMC4A&lt;br /&gt;
|-&lt;br /&gt;
| 23 || ISP2B&lt;br /&gt;
|-&lt;br /&gt;
| 24 || GPU&lt;br /&gt;
|-&lt;br /&gt;
| 25 || GPUB&lt;br /&gt;
|-&lt;br /&gt;
| 26 || PPCS2&lt;br /&gt;
|-&lt;br /&gt;
| 27 || NVDEC&lt;br /&gt;
|-&lt;br /&gt;
| 28 || APE&lt;br /&gt;
|-&lt;br /&gt;
| 29 || SE&lt;br /&gt;
|-&lt;br /&gt;
| 30 || NVJPG&lt;br /&gt;
|-&lt;br /&gt;
| 31 || HC1&lt;br /&gt;
|-&lt;br /&gt;
| 32 || SE1&lt;br /&gt;
|-&lt;br /&gt;
| 33 || AXIAP&lt;br /&gt;
|-&lt;br /&gt;
| 34 || ETR&lt;br /&gt;
|-&lt;br /&gt;
| 35 || TSECB&lt;br /&gt;
|-&lt;br /&gt;
| 36 || TSEC1&lt;br /&gt;
|-&lt;br /&gt;
| 37 || TSECB1&lt;br /&gt;
|-&lt;br /&gt;
| 38 || NVDEC1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CodeMemoryOperation ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || MapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 1 || MapSlave&lt;br /&gt;
|-&lt;br /&gt;
| 2 || UnmapOwner&lt;br /&gt;
|-&lt;br /&gt;
| 3 || UnmapSlave&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LimitableResource ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || PhysicalMemoryMax || Bytes of memory a process may allocate.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || ThreadCountMax || Amount of threads a process can create.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || EventCountMax || Amount of events a process can create through [[#CreateEvent]] or [[#SendAsyncRequestWithUserBuffer]].&lt;br /&gt;
|-&lt;br /&gt;
| 3 || TransferMemoryCountMax || Amount of TransferMemory a process can create through [[#CreateTransferMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SessionCountMax || Amount of session a process can create through [[#CreateSession]], [[#ConnectToPort]] or [[#ConnectToNamedPort]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ThreadActivity =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessActivity ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Runnable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessInfoType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#ProcessState|ProcessState]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ProcessState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name || Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Created ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CreatedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Started ||&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Crashed || Processes will not enter this state unless they were created with [[#CreateProcessParameter|EnableDebug]].&lt;br /&gt;
|-&lt;br /&gt;
| 4 || StartedAttached ||&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Exiting ||&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Exited ||&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebugSuspended ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DebugThreadParam ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || DynamicPriority&lt;br /&gt;
|-&lt;br /&gt;
| 1 || SchedulingStatus&lt;br /&gt;
|-&lt;br /&gt;
| 2 || PreferredCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 3 || CurrentCpuCore&lt;br /&gt;
|-&lt;br /&gt;
| 4 || AffinityMask&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Dynamic priority: output in out2&lt;br /&gt;
&lt;br /&gt;
Scheduling status: out1 contains bit0: is debug-suspended, bit1: is user-suspended ([[#SetThreadActivity]] 1 or [[#SetProcessActivity]] 1).&lt;br /&gt;
Out2 contains {suspended, idle, running, terminating} =&amp;gt; {5, 0, 1, 4}&lt;br /&gt;
&lt;br /&gt;
PreferredCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
CurrentCpuCore: output in out2&lt;br /&gt;
&lt;br /&gt;
AffinityMask: output in out1&lt;br /&gt;
&lt;br /&gt;
== CreateProcessParameter ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 12 || || ProcessName (doesn&#039;t have to be null-terminated)&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C || 4 || || ProcessCategory (0: regular title, 1: kernel built-in)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 8 || || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 8 || || CodeAddr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || || CodeNumPages&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || || Flags&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit0 || Is64BitInstruction&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit3-1 || [[#AddressSpaceType]]&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit4 || [2.0.0+] EnableDebug&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit5 || EnableAslr&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit6 || IsApplication&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit7 || [4.0.0] UseSecureMemory&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit10-7 || [5.0.0+] MemoryRegion (0 = Application, 1 = Applet, 2 = SecureSystem, 3 = NonSecureSystem)&lt;br /&gt;
|-&lt;br /&gt;
| || || Bit11 || [7.0.0+] OptimizeMemoryAllocation (only allowed in combination with IsApplication)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 4 || || ResourceLimitHandle (can be zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 4 || || [3.0.0+] SystemResourceNumPages&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
On [1.0.0] there&#039;s only one MemoryRegion.&lt;br /&gt;
&lt;br /&gt;
On [2.0.0-4.0.0] MemoryRegion is 1 for built-ins and 0 for rest.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] MemoryRegion is specified in CreateProcessArgs. There are now 4 pool partitions.&lt;br /&gt;
&lt;br /&gt;
On [5.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory.&lt;br /&gt;
&lt;br /&gt;
The PersonalMmHeap are allocated as follows:&lt;br /&gt;
* For the application, normal insecure pool is used. Carveout 5 is used to provide protection.&lt;br /&gt;
* For the applet, a pre-allocated secure pool segment of size 0x400000 is used.&lt;br /&gt;
* For sysmodules, secure pool is allocated.&lt;br /&gt;
&lt;br /&gt;
=== AddressSpaceType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Type || Name || Width || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AddressSpace32Bit || 32 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AddressSpace64BitOld || 36 ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || AddressSpace32BitNoReserved || 32 || Appears to be missing map region [?]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [2.0.0+] AddressSpace64Bit || 39 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryInfo ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8 || BaseAddress&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 8 || Size&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 4 || [[#MemoryType]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x14 || 4 || [[#MemoryAttribute]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || 4 || [[#MemoryPermission]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C || 4 || IpcRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 4 || DeviceRefCount&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 4 || Padding: always zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryPermission ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Read || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Write || Can be set by [[#SetMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryAttribute ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Locked || Used by MapMemory, as an async IPC user buffer.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || IpcLocked || True when IpcRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DeviceShared || True when DeviceRefCount &amp;gt; 0.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Uncached || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MemoryState ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bits || Description || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 7-0 || [[#MemoryType]] || &lt;br /&gt;
|-&lt;br /&gt;
| 8 || [[#SetMemoryPermission|PermissionChangeAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 9 || ForceReadWritableByDebugSyscalls || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || IpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 11 || NonDeviceIpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || NonSecureIpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 14 || [[#SetProcessMemoryPermission|ProcessPermissionChangeAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 15 || [[#MapMemory|MapAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 16 || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemoryAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 17 || [[#CreateTransferMemory|TransferMemoryAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 18 || [[#QueryPhysicalAddress|QueryPhysicalAddressAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 19 || MapDeviceAllowed ([[#MapDeviceAddressSpace]] and [[#MapDeviceAddressSpaceByForce]]) ||&lt;br /&gt;
|-&lt;br /&gt;
| 20 || [[#MapDeviceAddressSpaceAligned|MapDeviceAlignedAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 21 || [[#SendSyncRequestWithUserBuffer|IpcBufferAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 22 || IsPoolAllocated/IsReferenceCounted || The physical memory blocks backing this region are refcounted.&lt;br /&gt;
|-&lt;br /&gt;
| 23 || [[#MapProcessMemory|MapProcessAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 24 || [[#SetMemoryAttribute|AttributeChangeAllowed]] ||&lt;br /&gt;
|-&lt;br /&gt;
| 25 || [4.0.0+] [[#CreateCodeMemory|CodeMemoryAllowed]] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== MemoryType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000000 || Free ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002001 || Io || Mapped by kernel capability parsing in [[#CreateProcess]]. &lt;br /&gt;
|-&lt;br /&gt;
| 0x00042002 || Static || Mapped by kernel capability parsing in [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DC7E03 || Code || Mapped during [[#CreateProcess]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FEBD04&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FEBD04&lt;br /&gt;
|| CodeData || Transition from 0xDC7E03 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
0x017EBD05&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x037EBD05&lt;br /&gt;
|| Normal || Mapped using [[#SetHeapSize]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402006 || Shared || Mapped using [[#MapSharedMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00482907 || [1.0.0] Alias || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00DD7E08 || AliasCode || Mapped using [[#MapProcessCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x01FFBD09&lt;br /&gt;
&lt;br /&gt;
[4.0.0+]&lt;br /&gt;
&lt;br /&gt;
0x03FFBD09&lt;br /&gt;
|| AliasCodeData || Transition from 0xDD7E08 performed by [[#SetProcessMemoryPermission]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0A || [[IPC_Marshalling|Ipc]] || IPC buffers with descriptor flags=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3C0B || Stack || Mapped using [[#MapMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040200C || [[Thread Local Storage|ThreadLocal]] || Mapped during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C380E || ShTransfered || Mapped using [[#MapTransferMemory]] when the owning process has perm!=0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000010 || Reserved ||&lt;br /&gt;
|-&lt;br /&gt;
| 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00002013 || KernelStack || Mapped in kernel during [[#CreateThread]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402214 || [4.0.0+] CodeReadOnly || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00402015 || [4.0.0+] CodeWritable || Mapped in kernel during [[#ControlCodeMemory]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ArbitrationType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || WaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || DecrementAndWaitIfLessThan&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || WaitIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SignalType ==&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || Signal&lt;br /&gt;
|-&lt;br /&gt;
| 0x1 || SignalAndIncrementIfEqual&lt;br /&gt;
|-&lt;br /&gt;
| 0x2 || SignalAndModifyBasedOnWaitingThreadCountIfEqual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlagsOld ==&lt;br /&gt;
[1.0.0-2.3.0]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: ResumeAllThreads or debug-suspended-thread-id needed)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || SwallowException&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || ResumeAllThreads&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ContinueDebugFlags ==&lt;br /&gt;
[3.0.0+]&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Bitmask || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || IgnoreException (note: doesn&#039;t need to be set in the same call than Resume)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || DontCatchExceptions&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || Resume&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 8 || IgnoreOtherThreadsExceptions&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
IgnoreExceptionsOfOthers is like IgnoreException but acts on all threads that aren&#039;t in the input list. The affected threads are resumed.&lt;br /&gt;
&lt;br /&gt;
Only one of of Resume and IgnoreOtherThreadsExceptions can be set at a time.&lt;br /&gt;
&lt;br /&gt;
If the input number of threads is 0, this means &amp;quot;all threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== DebugEventInfo ==&lt;br /&gt;
The below table is for the Aarch64 version of the system call. For A32, all u64 fields but title/process/thread id are actually u32, making the structure 0x28-byte-big (0x40 for a64).&lt;br /&gt;
&lt;br /&gt;
Size: 0x40&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || u32 || EventType&lt;br /&gt;
|-&lt;br /&gt;
| 4 || u32 || Flags (bit0: NeedsContinue)&lt;br /&gt;
|-&lt;br /&gt;
| 8 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || || PerTypeSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachProcess specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || TitleId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || ProcessId&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || char[12] || ProcessName&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || u32 || MmuFlags&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || [5.0.0+] UserExceptionContextAddr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
AttachThread specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u64 || ThreadId&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || TlsPtr&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u64 || Entrypoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exit specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32|| Type (0=PausedThread, 1=RunningThread, 2=ExitedProcess, 3=TerminatedProcess)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Exception specific:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || u32 || ExceptionType&lt;br /&gt;
|-&lt;br /&gt;
| 0x18 || u64 || FaultRegister&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || || PerExceptionSpecifics&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugEventType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || AttachProcess&lt;br /&gt;
|-&lt;br /&gt;
| 1 || AttachThread&lt;br /&gt;
|-&lt;br /&gt;
| 2 || ExitProcess&lt;br /&gt;
|-&lt;br /&gt;
| 3 || ExitThread&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Exception&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DebugExceptionType ===&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Trap (*)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || InstructionAbort&lt;br /&gt;
|-&lt;br /&gt;
| 2 || DataAbortMisc (**)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || PcSpAlignmentFault&lt;br /&gt;
|-&lt;br /&gt;
| 4 || DebuggerAttached&lt;br /&gt;
|-&lt;br /&gt;
| 5 || BreakPoint&lt;br /&gt;
|-&lt;br /&gt;
| 6 || UserBreak&lt;br /&gt;
|-&lt;br /&gt;
| 7 || DebuggerBreak&lt;br /&gt;
|-&lt;br /&gt;
| 8 || BadSvcId&lt;br /&gt;
|-&lt;br /&gt;
| 9 || [2.0.0+] SError&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Undefined instructions, software breakpoints, some other traps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; Data aborts, FP traps, and everything else that doesn&#039;t belong to any of the above.&lt;br /&gt;
&lt;br /&gt;
Trap specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Opcode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BreakPoint specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || IsWatchpoint&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
UserBreak specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || Info0&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || u64 || Info1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || u64 || Info2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BadSvcId specifics:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || u32 || SvcId&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Exception handling =&lt;br /&gt;
First of all, a function that might be called by synchronous exception handler and that is called by the SError handler fetches the exception info, adjusts PC, panics on exceptions taken from EL1, then dispatches the exception.&lt;br /&gt;
&lt;br /&gt;
The dispatcher has two mutually exclusive exception reporting methods:&lt;br /&gt;
* by storing information at the start of the process&#039;s TLS memregion (TPIDRRO_EL0) and jumping back to the crt0&lt;br /&gt;
* by using KDebug&lt;br /&gt;
&lt;br /&gt;
KDebug dispatching is used when at least one of the following conditions are met:&lt;br /&gt;
* SMC ConfigItem KernelMemConfig bit 1 is NOT set (it isn&#039;t on retail), unless: this is a software or hardware breakpoint, or a watchpoint, or [4.0.0+?] the process is attached and this is a Google PNaCl trap instruction (see LLVM source)&lt;br /&gt;
* FAR doesn&#039;t point to a valid address in mapped-readable CodeStatic memory (i.e. this is the case for NRO and JIT memory) or this is one of the following exceptions (it particular, that doesn&#039;t include FP exceptions occurring in CodeStatic memory):&lt;br /&gt;
** Uncategorized&lt;br /&gt;
** IllegalState&lt;br /&gt;
** SupervisorCallA32&lt;br /&gt;
** SupervisorCallA64&lt;br /&gt;
** PCAlignment&lt;br /&gt;
** SPAlignment&lt;br /&gt;
** SError&lt;br /&gt;
** BreakpointLowerEl&lt;br /&gt;
** SoftwareStepLowerEl (note: no way set single-step flag; not parsed)&lt;br /&gt;
** WatchpointLowerEl&lt;br /&gt;
** SoftwareBreakpointA32 (note: not parsed)&lt;br /&gt;
** SoftwareBreakpointA64 (note: not parsed)&lt;br /&gt;
    &lt;br /&gt;
In all other cases the userland-handled exception path is taken.&lt;br /&gt;
&lt;br /&gt;
KDebug path:&lt;br /&gt;
&lt;br /&gt;
If the process is attached, the exception is reported to the KDebug. If the thread was continued using flag IgnoreExceptions, it returns from the exception as if nothing happened.&lt;br /&gt;
&lt;br /&gt;
If the latter is not the case, or if the process isn&#039;t attached, proceed to [2.0.0+] crash reporting (or in [1.0.0] just terminate the process): &lt;br /&gt;
if EnableDebug is set, and depending on the process state (more than one crash per process isn&#039;t permitted) it may signal itself with ProcessState_Crashed so that PM asks NS to start creport so that creport attaches to it and reports the crashes. Otherwise, just terminate.&lt;br /&gt;
&lt;br /&gt;
Userland reporting path and [[#ReturnFromException]]:&lt;br /&gt;
&lt;br /&gt;
TLS region start (A64):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x148 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x78 || ExceptionFrameA64&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA64:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x48 (8*9) || GPRs 0..8.&lt;br /&gt;
|-&lt;br /&gt;
| 0x48 || 0x8 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x50 || 0x8 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x58 || 0x8 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60 || 0x4 || pstate &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x64 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 || 0x8 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
TLS region start (A32):&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x178 || Exception stack&lt;br /&gt;
|-&lt;br /&gt;
| 0x148 || 0x44 || ExceptionFrameA32&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ExceptionFrameA32:&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Offset || Length || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x20 (8*4) || GPRs 0..7.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || 0x4 || sp&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || 0x4 || lr&lt;br /&gt;
|-&lt;br /&gt;
| 0x28 || 0x4 || pc (elr_el1)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C || 0x4 || tpidr_el0 = 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || 0x4 || cpsr &amp;amp; 0xFF0FFE20&lt;br /&gt;
|-&lt;br /&gt;
| 0x34 || 0x4 || afsr0&lt;br /&gt;
|-&lt;br /&gt;
| 0x38 || 0x4 || afsr1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C || 0x4 || esr&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || 0x4 || far&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In that case, after storing the regs in the TLS, the exception handler returns to the application&#039;s crt0 (entrypoint), with X0=&amp;lt;error description code&amp;gt; (see below) and X1=SP=frame=&amp;lt;stack top&amp;gt; (see above)&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Desc. code || Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x100 || Instruction abort&lt;br /&gt;
|-&lt;br /&gt;
| 0x102 || Misaligned PC&lt;br /&gt;
|-&lt;br /&gt;
| 0x103 || Misaligned SP&lt;br /&gt;
|-&lt;br /&gt;
| 0x106 || [2.0.0+] SError&lt;br /&gt;
|-&lt;br /&gt;
| 0x301 || Bad SVC&lt;br /&gt;
|-&lt;br /&gt;
| 0x104 || Uncategorized, CP15RTTrap, CP15RRTTrap, CP14RTTrap, CP14RRTTrap, IllegalState, SystemRegisterTrap&lt;br /&gt;
|-&lt;br /&gt;
| 0x101 || None of the above, EC &amp;lt;= 0x34 and not a breakpoint&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(During normal app boot the process is invoked with X0=0 and X1=main_thread_handle. The crt0 of retail apps determines whether to boot normally or handle an exception if X0 is set to 0 or not)&lt;br /&gt;
&lt;br /&gt;
The application is supposed to promptly update the contents of elr_el1 to a user handler (and any other regs it sees fit) and call [[#ReturnFromException]] (error code) to call that handler. The latter is then expected to promptly abort the program.&lt;br /&gt;
&lt;br /&gt;
[[#ReturnFromException]] updates the contents of the kernel stack frame with what the user provided in the TLS structure, sets TPIDR_EL0 to 1, then:&lt;br /&gt;
* if the provided error code is 0, gracefully pivots and returns from exception&lt;br /&gt;
* if it is not, replays the exception and pass it to the KDebug (see above). One can pass 0x10001 to prevent process termination. If the process is attached, this also prevents crash-collection/termination (different from the exception handler behavior)&lt;br /&gt;
&lt;br /&gt;
If an exception occurs from the above user handler, the entire exception handling process will repeat with the new exception.&lt;br /&gt;
&lt;br /&gt;
Note that if a thread that wasn&#039;t faulting calls [[#ReturnFromException]], it signals an &amp;quot;invalid syscall&amp;quot; exception&lt;br /&gt;
&lt;br /&gt;
Note that [[SMC|IsDebugMode]] is not used during exception-handling, except for enabling printing a message to UART-A. This UART code causes a system-hang on retail (likely due to a loop that doesn&#039;t exit). This printing doesn&#039;t seem to run when the process is attached for debugging?&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NV_services&amp;diff=8240</id>
		<title>NV services</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NV_services&amp;diff=8240"/>
		<updated>2019-11-07T01:43:53Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: Correct the NVMAP_IOC_FREE struct by changing it&amp;#039;s &amp;#039;refcount&amp;#039; field to &amp;#039;address&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Switch uses a customized NVIDIA driver.&lt;br /&gt;
&lt;br /&gt;
= nvdrv, nvdrv:a, nvdrv:s, nvdrv:t =&lt;br /&gt;
This is &amp;quot;nns::nvdrv::INvDrvServices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Main NVIDIA driver service.&lt;br /&gt;
&lt;br /&gt;
Each service is used by:&lt;br /&gt;
* &amp;quot;nvdrv&amp;quot;: regular applications&lt;br /&gt;
* &amp;quot;nvdrv:a&amp;quot;: applets&lt;br /&gt;
* &amp;quot;nvdrv:s&amp;quot;: sysmodules&lt;br /&gt;
* &amp;quot;nvdrv:t&amp;quot;: factory titles&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#Open]]&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#Ioctl]]&lt;br /&gt;
|-&lt;br /&gt;
| 2 || [[#Close]]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [[#Initialize]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 || [[#QueryEvent]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || [[#MapSharedMem]]&lt;br /&gt;
|-&lt;br /&gt;
| 6 || [[#GetStatus]]&lt;br /&gt;
|-&lt;br /&gt;
| 7 || [[#SetAruid]]&lt;br /&gt;
|-&lt;br /&gt;
| 8 || [[#SetAruidByPID]]&lt;br /&gt;
|-&lt;br /&gt;
| 9 || [[#DumpGraphicsMemoryInfo]]&lt;br /&gt;
|-&lt;br /&gt;
| 10 || [3.0.0+] [[#InitializeDevtools]]&lt;br /&gt;
|-&lt;br /&gt;
| 11 || [3.0.0+] [[#Ioctl2]]&lt;br /&gt;
|-&lt;br /&gt;
| 12 || [3.0.0+] [[#Ioctl3]]&lt;br /&gt;
|-&lt;br /&gt;
| 13 || [3.0.0+] [[#FinishInitialize]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open ==&lt;br /&gt;
Takes a type-0x5 input buffer for the device-path. Returns the output 32bit &#039;&#039;&#039;fd&#039;&#039;&#039; and the u32 &#039;&#039;&#039;error_code&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Ioctl ==&lt;br /&gt;
Takes a 32bit &#039;&#039;&#039;fd&#039;&#039;&#039;, an u32 &#039;&#039;&#039;ioctl_cmd&#039;&#039;&#039;, a type-0x21 input buffer, and a type-0x22 output buffer. Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The addr/size for send/recv buffers are only set when the associated direction bit is set in the ioctl cmd (addr/size = 0 otherwise).&lt;br /&gt;
&lt;br /&gt;
== Close ==&lt;br /&gt;
Takes a 32bit &#039;&#039;&#039;fd&#039;&#039;&#039;. Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== Initialize ==&lt;br /&gt;
Takes two copy-handles (&#039;&#039;&#039;current_process&#039;&#039;&#039; and &#039;&#039;&#039;transfer_memory&#039;&#039;&#039;) and an input u32 (&#039;&#039;&#039;transfer_memory_size&#039;&#039;&#039;). Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Webkit applet creates the transfer-memory with perm = 0 and size 0x300000.&lt;br /&gt;
&lt;br /&gt;
== QueryEvent ==&lt;br /&gt;
Takes two input u32s (&#039;&#039;&#039;fd&#039;&#039;&#039; and &#039;&#039;&#039;event_id&#039;&#039;&#039;), with the second word immediately after the first one. Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;) and a copy-handle (&#039;&#039;&#039;event_handle&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
QueryEvent is only supported on (and implemented differently on):&lt;br /&gt;
* /dev/nvhost-gpu&lt;br /&gt;
** 1: SmException_BptIntReport&lt;br /&gt;
** 2: SmException_BptPauseReport&lt;br /&gt;
** 3: ErrorNotifierEvent&lt;br /&gt;
* /dev/nvhost-ctrl: Used to get events for SyncPts.&lt;br /&gt;
** If bit31-28 is 1, then lower 16-bits contain event_slot, bit27-16 contain syncpt_number. &lt;br /&gt;
** If bit31-28 is 0, then lower 4-bits contain event_slot, bit31-4 contains syncpt_number.&lt;br /&gt;
* /dev/nvhost-ctrl-gpu&lt;br /&gt;
** 1: Returns error_event_handle.&lt;br /&gt;
** 2: Returns unknown event.&lt;br /&gt;
* /dev/nvhost-dbg-gpu&lt;br /&gt;
** Ignores event_id.&lt;br /&gt;
&lt;br /&gt;
== MapSharedMem ==&lt;br /&gt;
Takes a copy-handle (&#039;&#039;&#039;transfer_memory&#039;&#039;&#039;) and two input u32s (&#039;&#039;&#039;fd&#039;&#039;&#039; and &#039;&#039;&#039;nvmap_handle&#039;&#039;&#039;). Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== GetStatus ==&lt;br /&gt;
Takes no input. Returns 0x10-bytes and an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== SetAruid ==&lt;br /&gt;
Takes an input u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== SetAruidByPID ==&lt;br /&gt;
Takes a PID-descriptor and an u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== DumpGraphicsMemoryInfo ==&lt;br /&gt;
No input or output. Does nothing.&lt;br /&gt;
&lt;br /&gt;
== InitializeDevtools ==&lt;br /&gt;
Takes a copy-handle and an input u32. Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== Ioctl2 ==&lt;br /&gt;
Takes a type-0x21 buffer, a type-0x22 buffer, a type-0x21 buffer, and two input u32s. Returns an output u32 (&#039;&#039;&#039;error_code&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== Ioctl3 ==&lt;br /&gt;
Takes a type-0x21 buffer, a type-0x22 buffer, another type-0x22 buffer, and two input u32s. Returns an output u32 (error_code). &lt;br /&gt;
Cmdhdr_word1 is 0x100B instead of 0xC0B.&lt;br /&gt;
&lt;br /&gt;
== FinishInitialize ==&lt;br /&gt;
Takes an input u64. No output.&lt;br /&gt;
&lt;br /&gt;
This sets a boolean value based on the input u64 and the value of the &amp;quot;nv!nv_graphics_firmware_memory_margin&amp;quot; system configuration, but only for &amp;quot;nvdrv&amp;quot; (the other services default to false).&lt;br /&gt;
&lt;br /&gt;
Official user-processes starting with 3.0.0 now use this at the end of nvdrv service init with value 0x1.&lt;br /&gt;
&lt;br /&gt;
= Ioctls =&lt;br /&gt;
The ioctl number is generated with the following primitive (see Linux kernel):&lt;br /&gt;
&lt;br /&gt;
 #define _IOC(inout, group, num, len) \&lt;br /&gt;
    (inout | ((len &amp;amp; IOCPARM_MASK) &amp;lt;&amp;lt; 16) | ((group) &amp;lt;&amp;lt; 8) | (num))&lt;br /&gt;
&lt;br /&gt;
The following table contains known ioctls.&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhost-ctrl ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080014 || Inout || 8 || [[#NVHOST_IOCTL_CTRL_SYNCPT_READ]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040015 || In || 4 || [[#NVHOST_IOCTL_CTRL_SYNCPT_INCR]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00C0016 || Inout || 12 || [[#NVHOST_IOCTL_CTRL_SYNCPT_WAIT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40080017 || In || 8 || [[#NVHOST_IOCTL_CTRL_MODULE_MUTEX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0180018 || Inout || 24 || [[#NVHOST_IOCTL_CTRL_MODULE_REGRDWR]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0100019 || Inout || 16 || [[#NVHOST_IOCTL_CTRL_SYNCPT_WAITEX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC008001A || Inout || 8 || [[#NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC183001B || Inout || 387 || [[#NVHOST_IOCTL_CTRL_GET_CONFIG]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004001C || Inout || 4 || [[#NVHOST_IOCTL_CTRL_EVENT_SIGNAL]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010001D || Inout || 16 || [[#NVHOST_IOCTL_CTRL_EVENT_WAIT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010001E || Inout || 16 || [[#NVHOST_IOCTL_CTRL_EVENT_WAIT_ASYNC]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004001F || Inout || 4 || [[#NVHOST_IOCTL_CTRL_EVENT_REGISTER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0040020 || Inout || 4 || [[#NVHOST_IOCTL_CTRL_EVENT_UNREGISTER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40080021 || In || 8 || [[#NVHOST_IOCTL_CTRL_EVENT_KILL]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0040022 || Inout || 4 || [[#NVHOST_IOCTL_CTRL_GET_MAX_EVENT_FIFO_CHANNEL]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_SYNCPT_READ ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 id;&lt;br /&gt;
    __out u32 value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_SYNCPT_INCR ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_SYNCPT_WAIT ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 id;&lt;br /&gt;
    __in u32 thresh;&lt;br /&gt;
    __in s32 timeout;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_MODULE_MUTEX ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 id;&lt;br /&gt;
    __in u32 lock;        // (0==unlock; 1==lock)&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_MODULE_REGRDWR ===&lt;br /&gt;
Identical to Linux driver. Uses 32-bit version and doesn&#039;t work.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 id;&lt;br /&gt;
    __in u32 num_offsets;&lt;br /&gt;
    __in u32 block_size;&lt;br /&gt;
    __in u32 offsets;&lt;br /&gt;
    __in u32 values;&lt;br /&gt;
    __in u32 write;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_SYNCPT_WAITEX ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 id;&lt;br /&gt;
    __in  u32 thresh;&lt;br /&gt;
    __in  s32 timeout;&lt;br /&gt;
    __out u32 value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 id;&lt;br /&gt;
    __out u32 value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_GET_CONFIG ===&lt;br /&gt;
Returns configured settings. Not available in production mode.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in char domain_str[0x41];       // &amp;quot;nv&amp;quot;&lt;br /&gt;
    __in char param_str[0x41];&lt;br /&gt;
    __out char config_str[0x101];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_SIGNAL ===&lt;br /&gt;
Signals an user event. Exclusive to the Switch.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 user_event_id;      // ranges from 0x00 to 0x3F&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_WAIT ===&lt;br /&gt;
Waits on an event. If waiting fails, returns error code 0x05 (Timeout) and sets &#039;&#039;&#039;value&#039;&#039;&#039; to ((&#039;&#039;&#039;syncpt_id&#039;&#039;&#039; &amp;lt;&amp;lt; 0x10) | 0x10000000).&lt;br /&gt;
&lt;br /&gt;
Depending on &#039;&#039;&#039;threshold&#039;&#039;&#039;, an &#039;&#039;&#039;user_event_id&#039;&#039;&#039; may be returned for using with other event ioctls.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 syncpt_id;&lt;br /&gt;
    __in    u32 threshold;&lt;br /&gt;
    __in    s32 timeout;&lt;br /&gt;
    __inout u32 value;           // in=user_event_id (ignored); out=syncpt_value or user_event_id&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_WAIT_ASYNC ===&lt;br /&gt;
Waits on an event (async version). If waiting fails, returns error code 0x0B (BadValue).&lt;br /&gt;
&lt;br /&gt;
Depending on &#039;&#039;&#039;threshold&#039;&#039;&#039;, an &#039;&#039;&#039;user_event_id&#039;&#039;&#039; may be returned for using with other event ioctls.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 syncpt_id;&lt;br /&gt;
    __in    u32 threshold;&lt;br /&gt;
    __in    u32 timeout;&lt;br /&gt;
    __inout u32 value;           // in=user_event_id (ignored); out=syncpt_value or user_event_id&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_REGISTER ===&lt;br /&gt;
Registers an user event. Exclusive to the Switch. &lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 user_event_id;      // ranges from 0x00 to 0x3F&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_UNREGISTER ===&lt;br /&gt;
Unregisters an user event. Exclusive to the Switch. &lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 user_event_id;      // ranges from 0x00 to 0x3F&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_EVENT_KILL ===&lt;br /&gt;
Kills user events. Exclusive to the Switch. &lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 user_events;       // 64-bit bitfield where each bit represents one event&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CTRL_GET_MAX_EVENT_FIFO_CHANNEL ===&lt;br /&gt;
If event FIFO is enabled, returns the maximum channel number. Exclusive to the Switch.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 max_channel;      // 0x00 (FIFO disabled) or 0x60 (FIFO enabled)&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
== /dev/nvmap ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080101 || Inout || 8 || [[#NVMAP_IOC_CREATE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000102 || - || 0 || [[#NVMAP_IOC_CLAIM]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080103 || Inout || 8 || [[#NVMAP_IOC_FROM_ID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0200104 || Inout || 32 || [[#NVMAP_IOC_ALLOC]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0180105 || Inout || 24 || [[#NVMAP_IOC_FREE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0280106 || Inout || 40 || [[#NVMAP_IOC_MMAP]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0280107 || Inout || 40 || [[#NVMAP_IOC_WRITE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0280108 || Inout || 40 || [[#NVMAP_IOC_READ]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00C0109 || Inout || 12 || [[#NVMAP_IOC_PARAM]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010010A || Inout || 16 || [[#NVMAP_IOC_PIN_MULT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010010B || Inout || 16 || [[#NVMAP_IOC_UNPIN_MULT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC008010C || Inout || 8 || [[#NVMAP_IOC_CACHE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004010D || Inout || 4 || [[#NVMAP_IOC_GET_IVC_ID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC008010E || Inout || 8 || [[#NVMAP_IOC_GET_ID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004010F || Inout || 4 || [[#NVMAP_IOC_FROM_IVC_ID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040110 || In || 4 || [[#NVMAP_IOC_SET_ALLOCATION_TAG_LABEL]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000111 || - || 0 || [[#NVMAP_IOC_RESERVE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100112 || In || 16 || [[#NVMAP_IOC_EXPORT_FOR_ARUID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100113 || In || 16 || [[#NVMAP_IOC_IS_OWNED_BY_ARUID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100114 || In || 16 || [[#NVMAP_IOC_REMOVE_EXPORT_FOR_ARUID]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_CREATE ===&lt;br /&gt;
Creates an nvmap object. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 size;&lt;br /&gt;
    __out u32 handle;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_CLAIM ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_FROM_ID ===&lt;br /&gt;
Get handle to an existing nvmap object. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 id;&lt;br /&gt;
    __out u32 handle;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_ALLOC ===&lt;br /&gt;
Allocate memory for the nvmap object. Nintendo extended this one with 16 bytes, and changed it from in to inout.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 handle;&lt;br /&gt;
    __in u32 heapmask;&lt;br /&gt;
    __in u32 flags;    // (0=read-only, 1=read-write)&lt;br /&gt;
    __in u32 align;&lt;br /&gt;
    __in u8  kind;&lt;br /&gt;
    u8       pad[7];&lt;br /&gt;
    __inout u64 addr;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_FREE ===&lt;br /&gt;
This one is completely custom. Partly because the Linux driver passed the handle as the ioctl &amp;quot;arg-ptr&amp;quot;, and HIPC can&#039;t handle that voodoo.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
    u32       pad;&lt;br /&gt;
    __out u64 address;&lt;br /&gt;
    __out u32 size;&lt;br /&gt;
    __out u32 flags;    // 1=NOT_FREED_YET&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_MMAP ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_WRITE ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_READ ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_PARAM ===&lt;br /&gt;
Returns info about a nvmap object. Identical to Linux driver, but extended with further params.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
    __in  u32 param;  // 1=SIZE, 2=ALIGNMENT, 3=BASE (returns error), 4=HEAP (always 0x40000000), 5=KIND, 6=COMPR (unused)&lt;br /&gt;
    __out u32 result;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_PIN_MULT ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_UNPIN_MULT ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_CACHE ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_GET_IVC_ID ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_GET_ID ===&lt;br /&gt;
Returns an id for a nvmap object. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 id; //~0 indicates error&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_FROM_IVC_ID ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_SET_ALLOCATION_TAG_LABEL ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_RESERVE ===&lt;br /&gt;
Returns [[#Errors|NotSupported]].&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_EXPORT_FOR_ARUID ===&lt;br /&gt;
Binds a nvmap object to an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u64 aruid;&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
    u8        pad[4];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_IS_OWNED_BY_ARUID ===&lt;br /&gt;
Checks if a nvmap object is bound to an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u64 aruid;&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
    u8        pad[4];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVMAP_IOC_REMOVE_EXPORT_FOR_ARUID ===&lt;br /&gt;
Unbinds a nvmap object from an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u64 aruid;&lt;br /&gt;
    __in  u32 handle;&lt;br /&gt;
    u8        pad[4];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
== /dev/nvdisp-ctrl ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x80040212 || Out || 4 || NVDISP_CTRL_GET_NUM_OUTPUTS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0140213 || Inout || 20 || NVDISP_CTRL_GET_OUTPUT_PROPERTIES&lt;br /&gt;
|-&lt;br /&gt;
| 0xC1100214 || Inout || 272 || NVDISP_CTRL_GET_OUTPUT_EDID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080216&amp;lt;/br&amp;gt;([1.0.0-3.0.0] 0xC0040216) || Inout || 8&amp;lt;/br&amp;gt;([1.0.0-3.0.0] 4) || NVDISP_CTRL_GET_EXT_HPD_IN_OUT_EVENTS&amp;lt;/br&amp;gt;([1.0.0-3.0.0] NVDISP_CTRL_GET_EXT_HPD_IN_EVENT)&lt;br /&gt;
|-&lt;br /&gt;
| ([1.0.0-3.0.0] 0xC0040217) || ([1.0.0-3.0.0] Inout) || ([1.0.0-3.0.0] 4) || ([1.0.0-3.0.0] NVDISP_CTRL_GET_EXT_HPD_OUT_EVENT)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0100218 || Inout || 16 || NVDISP_CTRL_GET_VBLANK_HEAD0_EVENT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0100219 || Inout || 16 || NVDISP_CTRL_GET_VBLANK_HEAD1_EVENT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0040220 || Inout || 4 || NVDISP_CTRL_GET_HPD_IRQ&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== /dev/nvdisp-disp0, /dev/nvdisp-disp1 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040201 || In || 4 || NVDISP_GET_WINDOW&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040202 || In || 4 || NVDISP_PUT_WINDOW&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4C80203 || In || 1224 || NVDISP_FLIP&lt;br /&gt;
|-&lt;br /&gt;
| 0x80380204 || Out || 56 || NVDISP_GET_MODE&lt;br /&gt;
|-&lt;br /&gt;
| 0x40380205 || Out || 56 || NVDISP_SET_MODE&lt;br /&gt;
|-&lt;br /&gt;
| 0x430C0206 || In || 780 || NVDISP_SET_LUT&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010207 || In || 1 || NVDISP_ENABLE_DISABLE_CRC&lt;br /&gt;
|-&lt;br /&gt;
| 0x80040208 || Out || 4 || NVDISP_GET_CRC&lt;br /&gt;
|-&lt;br /&gt;
| 0x80040209 || Out || 4 || NVDISP_GET_HEAD_STATUS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC038020A || Inout || 56 || NVDISP_VALIDATE_MODE&lt;br /&gt;
|-&lt;br /&gt;
| 0x4018020B || In || 24 || NVDISP_SET_CSC&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004020C || Inout || 4 || NVDISP_GET_VBLANK_SYNCPT&lt;br /&gt;
|-&lt;br /&gt;
| 0x8040020D || Out || 64 || NVDISP_GET_UNDERFLOWS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC99A020E || Inout || 2458 || NVDISP_SET_CMU&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004020F || Inout || 4 || NVDISP_DPMS&lt;br /&gt;
|-&lt;br /&gt;
| 0x80600210 || Out || 96 || NVDISP_GET_AVI_INFOFRAME&lt;br /&gt;
|-&lt;br /&gt;
| 0x40600211 || In || 96 || NVDISP_SET_AVI_INFOFRAME&lt;br /&gt;
|-&lt;br /&gt;
| 0xEBFC0215 || Inout || 11260 || NVDISP_GET_MODE_DB&lt;br /&gt;
|-&lt;br /&gt;
| 0xC003021A || Inout || 3 || NVDISP_PANEL_GET_VENDOR_ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x803C021B || Out || 60 || NVDISP_GET_MODE2&lt;br /&gt;
|-&lt;br /&gt;
| 0x403C021C || In || 60 || NVDISP_SET_MODE2&lt;br /&gt;
|-&lt;br /&gt;
| 0xC03C021D || Inout || 60 || NVDISP_VALIDATE_MODE2&lt;br /&gt;
|-&lt;br /&gt;
| 0xEF20021E || Inout || 12064 || NVDISP_GET_MODE_DB2&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004021F || Inout || 4 || NVDISP_GET_WINMASK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== /dev/nvcec-ctrl ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010301 || In || 1 || NVCEC_CTRL_ENABLE&lt;br /&gt;
|-&lt;br /&gt;
| 0x804C0302 || Out || 76 || NVCEC_CTRL_GET_PADDR&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040303 || In || 4 || NVCEC_CTRL_SET_LADDR&lt;br /&gt;
|-&lt;br /&gt;
| 0xC04C0304 || Inout || 76 || NVCEC_CTRL_WRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0xC04C0305 || Inout || 76 || NVCEC_CTRL_READ&lt;br /&gt;
|-&lt;br /&gt;
| 0x804C0306 || Out || 76 || NVCEC_CTRL_GET_CONNECTION_STATUS&lt;br /&gt;
|-&lt;br /&gt;
| 0x804C0307 || Out || 76 || NVCEC_CTRL_GET_WRITE_STATUS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhdcp_up-ctrl ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4880401 || Inout || 1160 || NVHDCP_READ_M&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4880402 || Inout || 1160 || NVHDCP_READ_S&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010403 || In || 1 || NVHDCP_ON_OFF&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080404 || Inout || 8 || NVHDCP_READ_EVENT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0010405 || Inout || 1 || NVHDCP_EVENTS_ON_OFF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== /dev/nvdcutil-disp0, /dev/nvdcutil-disp1 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010501 || In || 1 || NVDCUTIL_SW_HOTPLUG_IN_OUT&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010502 || In || 1 || NVDCUTIL_VIRTUAL_EDID_ON_OFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x42040503 || In || 1056 || NVDCUTIL_VIRTUAL_EDID_SET_DATA&lt;br /&gt;
|-&lt;br /&gt;
| 0x803C0504 || Out || 60 || NVDCUTIL_GET_MODE&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010505 || In || 1 || NVDCUTIL_TELEMETRY_TEST_ON_OFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x400C0506 || In || 12 || NVDCUTIL_DSI_PACKET_SHORT_WRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0x40F80507 || In || 248 || NVDCUTIL_DSI_PACKET_LONG_WRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0F40508 || Inout || 244 || NVDCUTIL_DSI_PACKET_READ&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== /dev/nvsched-ctrl ==&lt;br /&gt;
This is a customized scheduler device.&lt;br /&gt;
&lt;br /&gt;
The way this device is exposed and configured is exclusive to the Switch, since other sources don&#039;t have an actual interface for the scheduler.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000601 || - || 0 || [[#NVSCHED_CTRL_ENABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000602 || - || 0 || [[#NVSCHED_CTRL_DISABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40180603 || In || 24 || [[#NVSCHED_CTRL_ADD_APPLICATION]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40180604 || In || 24 || [[#NVSCHED_CTRL_UPDATE_APPLICATION]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40080605 || In || 8 || [[#NVSCHED_CTRL_REMOVE_APPLICATION]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80080606 || Out || 8 || [[#NVSCHED_CTRL_GET_ID]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80080607 || Out || 8 || [[#NVSCHED_CTRL_ADD_RUNLIST]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40180608 || In || 24 || [[#NVSCHED_CTRL_UPDATE_RUNLIST]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100609 || In || 16 || [[#NVSCHED_CTRL_LINK_RUNLIST]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4010060A || In || 16 || [[#NVSCHED_CTRL_UNLINK_RUNLIST]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008060B || In || 8 || [[#NVSCHED_CTRL_REMOVE_RUNLIST]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x8001060C || Out || 1 || [[#NVSCHED_CTRL_HAS_OVERRUN_EVENT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x8020060D&amp;lt;/br&amp;gt;([1.0.0-3.0.0] 0x8010060D) || Out || 32&amp;lt;/br&amp;gt;([1.0.0-3.0.0] 16) || [[#NVSCHED_CTRL_GET_NEXT_OVERRUN_EVENT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x400C060E || In || 12 || [[#NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008060F || In || 8 || [[#NVSCHED_CTRL_DETACH_APPLICATION]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100610 || In || 16 || NVSCHED_CTRL_LINK_RUNLIST_EX&lt;br /&gt;
|-&lt;br /&gt;
| 0x40100611 || In || 16 || NVSCHED_CTRL_UNLINK_RUNLIST_EX&lt;br /&gt;
|-&lt;br /&gt;
| 0x40010612 || In || 1 || NVSCHED_CTRL_OVERRUN_EVENTS_ON_OFF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_ENABLE ===&lt;br /&gt;
Enables the scheduler.&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_DISABLE ===&lt;br /&gt;
Disables the scheduler.&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_ADD_APPLICATION ===&lt;br /&gt;
Adds a new application to the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
    __in u64 priority;&lt;br /&gt;
    __in u64 timeslice;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_UPDATE_APPLICATION ===&lt;br /&gt;
Updates the application parameters in the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
    __in u64 priority;&lt;br /&gt;
    __in u64 timeslice;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_REMOVE_APPLICATION ===&lt;br /&gt;
Removes the application from the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_GET_ID ===&lt;br /&gt;
Returns the ID of the last scheduled object.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_ADD_RUNLIST ===&lt;br /&gt;
Creates a new runlist and returns it&#039;s ID.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 runlist_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_UPDATE_RUNLIST ===&lt;br /&gt;
Updates the runlist parameters in the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 runlist_id;&lt;br /&gt;
    __in u64 priority;&lt;br /&gt;
    __in u64 timeslice;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_LINK_RUNLIST ===&lt;br /&gt;
Links a runlist to a given application in the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 runlist_id;&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_UNLINK_RUNLIST ===&lt;br /&gt;
Unlinks a runlist from a given application in the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 runlist_id;&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_REMOVE_RUNLIST ===&lt;br /&gt;
Removes the runlist from the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 runlist_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_HAS_OVERRUN_EVENT ===&lt;br /&gt;
Returns a boolean to tell if the scheduler has an overrun event or not.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u8 has_overrun;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_GET_NEXT_OVERRUN_EVENT ===&lt;br /&gt;
Returns the overrun event&#039;s data from the scheduler.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 runlist_id;&lt;br /&gt;
    __out u64 debt;&lt;br /&gt;
    __out u64 unk0;           // 3.0.0+ only&lt;br /&gt;
    __out u64 unk1;           // 3.0.0+ only&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE ===&lt;br /&gt;
Installs a fence swap event?&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 fence_id;&lt;br /&gt;
    __in u32 fence_value;&lt;br /&gt;
    __in u32 swap_interval;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVSCHED_CTRL_DETACH_APPLICATION ===&lt;br /&gt;
Places the given application in detached state.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 application_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
== /dev/nverpt-ctrl ==&lt;br /&gt;
Added in firmware version 3.0.0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC1280701 || Inout || 296 || [[#NVERPT_TELEMETRY_SUBMIT_DATA]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF580702 || Inout || 3928 || [[#NVERPT_TELEMETRY_SUBMIT_DISPLAY_DATA]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVERPT_TELEMETRY_SUBMIT_DATA ===&lt;br /&gt;
Sends test data for creating a new [[Error_Report_services|Error Report]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 TestU64;&lt;br /&gt;
    __in u32 TestU32;&lt;br /&gt;
    __in u8  padding0[4];&lt;br /&gt;
    __in s64 TestI64;&lt;br /&gt;
    __in s32 TestI32;&lt;br /&gt;
    __in u8  TestString[32];&lt;br /&gt;
    __in u8  TestU8Array[8];&lt;br /&gt;
    __in u32 TestU8Array_size;&lt;br /&gt;
    __in u32 TestU32Array[8];&lt;br /&gt;
    __in u32 TestU32Array_size;&lt;br /&gt;
    __in u64 TestU64Array[8];&lt;br /&gt;
    __in u32 TestU64Array_size;&lt;br /&gt;
    __in s32 TestI32Array[8];&lt;br /&gt;
    __in u32 TestI32Array_size;&lt;br /&gt;
    __in s64 TestI64Array[8];&lt;br /&gt;
    __in u32 TestI64Array_size;&lt;br /&gt;
    __in u16 TestU16;&lt;br /&gt;
    __in u8  TestU8;&lt;br /&gt;
    __in s16 TestI16;&lt;br /&gt;
    __in s8  TestI8;&lt;br /&gt;
    __in u8  padding1[5];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVERPT_TELEMETRY_SUBMIT_DISPLAY_DATA ===&lt;br /&gt;
Sends display data for creating a new [[Error_Report_services|Error Report]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 CodecType;&lt;br /&gt;
    __in u32 DecodeBuffers;&lt;br /&gt;
    __in u32 FrameWidth;&lt;br /&gt;
    __in u32 FrameHeight;&lt;br /&gt;
    __in u8  ColorPrimaries;&lt;br /&gt;
    __in u8  TransferCharacteristics;&lt;br /&gt;
    __in u8  MatrixCoefficients;&lt;br /&gt;
    __in u8  padding;&lt;br /&gt;
    __in u32 DisplayWidth;&lt;br /&gt;
    __in u32 DisplayHeight;&lt;br /&gt;
    __in u32 DARWidth;&lt;br /&gt;
    __in u32 DARHeight;&lt;br /&gt;
    __in u32 ColorFormat;&lt;br /&gt;
    __in u32 ColorSpace[8];&lt;br /&gt;
    __in u32 ColorSpace_size;&lt;br /&gt;
    __in u32 SurfaceLayout[8];&lt;br /&gt;
    __in u32 SurfaceLayout_size;&lt;br /&gt;
    __in u8  ErrorString[64];       // must be &amp;quot;Error detected = 0x1000000&amp;quot;&lt;br /&gt;
    __in u32 VideoDecState;&lt;br /&gt;
    __in u8  VideoLog[3712];&lt;br /&gt;
    __in u32 VideoLog_size;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhost-as-gpu ==&lt;br /&gt;
Each fd opened to this device creates an address space. An address space is then later bound with a channel.&lt;br /&gt;
&lt;br /&gt;
Once a nvgpu channel has been bound to an address space it cannot be unbound. There is no support for allowing an nvgpu channel to change from one address space to another (or from one to none).&lt;br /&gt;
                                                                                                                              &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x40044101 || In || 4 || [[#NVGPU_AS_IOCTL_BIND_CHANNEL]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184102 || Inout || 24 || [[#NVGPU_AS_IOCTL_ALLOC_SPACE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104103 || Inout || 16 || [[#NVGPU_AS_IOCTL_FREE_SPACE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184104 || Inout || 24 || [[#NVGPU_AS_IOCTL_MAP_BUFFER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0084105 || Inout || 8 || [[#NVGPU_AS_IOCTL_UNMAP_BUFFER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0284106 || Inout || 40 || [[#NVGPU_AS_IOCTL_MODIFY]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40104107 || In || 16 || [[#NVGPU_AS_IOCTL_INITIALIZE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0404108 || Inout || 64 || [[#NVGPU_AS_IOCTL_GET_VA_REGIONS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40284109 || In || 40 || [[#NVGPU_AS_IOCTL_INITIALIZE_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC038410A || Inout || 56 || [[#NVGPU_AS_IOCTL_MAP_BUFFER_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??4114 || Inout || Variable || [[#NVGPU_AS_IOCTL_REMAP]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_BIND_CHANNEL ===&lt;br /&gt;
Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 fd;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_ALLOC_SPACE ===&lt;br /&gt;
Reserves pages in the device address space.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 pages;&lt;br /&gt;
    __in u32 page_size;&lt;br /&gt;
    __in u32 flags;&lt;br /&gt;
    u32      pad;&lt;br /&gt;
    union {&lt;br /&gt;
      __out u64 offset;&lt;br /&gt;
      __in  u64 align;&lt;br /&gt;
    };&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_FREE_SPACE ===&lt;br /&gt;
Frees pages from the device address space.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 offset;&lt;br /&gt;
    __in u32 pages;&lt;br /&gt;
    __in u32 page_size;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_MAP_BUFFER ===&lt;br /&gt;
Maps a memory region in the device address space. Identical to Linux driver pretty much.&lt;br /&gt;
&lt;br /&gt;
On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 flags;        // bit0: fixed_offset, bit2: cacheable&lt;br /&gt;
    u32         pad;&lt;br /&gt;
    __in    u32 nvmap_handle;&lt;br /&gt;
    __inout u32 page_size;    // 0 means don&#039;t care&lt;br /&gt;
    union {&lt;br /&gt;
      __out u64 offset;&lt;br /&gt;
      __in  u64 align;&lt;br /&gt;
    };&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_MODIFY ===&lt;br /&gt;
Modifies a memory region in the device address space.&lt;br /&gt;
&lt;br /&gt;
Unaligned size will cause a [[#Panic]].&lt;br /&gt;
&lt;br /&gt;
On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in      u32 flags;          // bit0: fixed_offset, bit2: cacheable&lt;br /&gt;
    __in      u32 kind;           // -1 is default&lt;br /&gt;
    __in      u32 nvmap_handle;&lt;br /&gt;
    __inout   u32 page_size;      // 0 means don&#039;t care&lt;br /&gt;
    __in      u64 buffer_offset;&lt;br /&gt;
    __in      u64 mapping_size;&lt;br /&gt;
    __inout   u64 offset;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_UNMAP_BUFFER ===&lt;br /&gt;
Unmaps a memory region from the device address space.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __in u64 offset;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_INITIALIZE ===&lt;br /&gt;
Nintendo&#039;s custom implementation of NVGPU_GPU_IOCTL_ALLOC_AS (unavailable).&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 big_page_size;   // depends on GPU&#039;s available_big_page_sizes; 0=default&lt;br /&gt;
    __in s32 as_fd;           // ignored; passes 0&lt;br /&gt;
    __in u32 flags;           // ignored; passes 0&lt;br /&gt;
    __in u32 reserved;        // ignored; passes 0&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_GET_VA_REGIONS ===&lt;br /&gt;
Nintendo&#039;s custom implementation to get rid of pointer in struct.&lt;br /&gt;
&lt;br /&gt;
  struct va_region {&lt;br /&gt;
    u64 offset;&lt;br /&gt;
    u32 page_size;&lt;br /&gt;
    u32 pad;&lt;br /&gt;
    u64 pages;&lt;br /&gt;
  };&lt;br /&gt;
  &lt;br /&gt;
  struct {&lt;br /&gt;
    u64           not_used;   // (contained output user ptr on linux, ignored)&lt;br /&gt;
    __inout u32   bufsize;    // forced to 2*sizeof(struct va_region)&lt;br /&gt;
    u32           pad;&lt;br /&gt;
    __out struct  va_region regions[2];&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_INITIALIZE_EX ===&lt;br /&gt;
Nintendo&#039;s custom implementation of NVGPU_GPU_IOCTL_ALLOC_AS (unavailable) with extra params.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 big_page_size;   // depends on GPU&#039;s available_big_page_sizes; 0=default&lt;br /&gt;
    __in s32 as_fd;           // ignored; passes 0&lt;br /&gt;
    __in u32 flags;           // passes 0&lt;br /&gt;
    __in u32 reserved;        // ignored; passes 0&lt;br /&gt;
    __in u64 unk0;&lt;br /&gt;
    __in u64 unk1;&lt;br /&gt;
    __in u64 unk2;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_MAP_BUFFER_EX ===&lt;br /&gt;
Maps a memory region in the device address space with extra params.&lt;br /&gt;
&lt;br /&gt;
    struct {&lt;br /&gt;
    __in      u32 flags;          // bit0: fixed_offset, bit2: cacheable&lt;br /&gt;
    __in      u32 kind;           // -1 is default&lt;br /&gt;
    __in      u32 nvmap_handle;&lt;br /&gt;
    __inout   u32 page_size;      // 0 means don&#039;t care&lt;br /&gt;
    __in      u64 buffer_offset;&lt;br /&gt;
    __in      u64 mapping_size;&lt;br /&gt;
    __inout   u64 offset;&lt;br /&gt;
    __in      u64 unk0;&lt;br /&gt;
    __in      u32 unk1;&lt;br /&gt;
    u32            pad;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_AS_IOCTL_REMAP ===&lt;br /&gt;
Nintendo&#039;s custom implementation of address space remapping.&lt;br /&gt;
&lt;br /&gt;
  struct remap_entry {&lt;br /&gt;
    __in u16 flags;        // 0 or 4&lt;br /&gt;
    __in u16 kind;           &lt;br /&gt;
    __in u32 nvmap_handle;&lt;br /&gt;
    __in u32 reserved;&lt;br /&gt;
    __in u32 offset;       // (alloc_space_offset &amp;gt;&amp;gt; 0x10)&lt;br /&gt;
    __in u32 pages;        // alloc_space_pages&lt;br /&gt;
  };&lt;br /&gt;
 &lt;br /&gt;
 struct {&lt;br /&gt;
    __in struct remap_entry entries[];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhost-dbg-gpu ==&lt;br /&gt;
Returns [[#Errors|NotSupported]] on Open unless nn::settings::detail::GetDebugModeFlag is set.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084401 || In || 8 || NVGPU_DBG_GPU_IOCTL_BIND_CHANNEL&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??4402 || Inout || Variable || NVGPU_DBG_GPU_IOCTL_REG_OPS&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084403 || In || 8 || NVGPU_DBG_GPU_IOCTL_EVENTS_CTRL&lt;br /&gt;
|-&lt;br /&gt;
| 0x40044404 || In || 4 || NVGPU_DBG_GPU_IOCTL_POWERGATE&lt;br /&gt;
|-&lt;br /&gt;
| 0x40044405 || In || 4 || NVGPU_DBG_GPU_IOCTL_SMPC_CTXSW_MODE&lt;br /&gt;
|-&lt;br /&gt;
| 0x40044406 || In || 4 || NVGPU_DBG_GPU_IOCTL_SUSPEND_RESUME_ALL_SMS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184407 || Inout || 24 || NVGPU_DBG_GPU_IOCTL_PERFBUF_MAP&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084408 || In || 8 || NVGPU_DBG_GPU_IOCTL_PERFBUF_UNMAP&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084409 || In || 8 || NVGPU_DBG_GPU_IOCTL_PC_SAMPLING&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008440A || In || 8 || NVGPU_DBG_GPU_IOCTL_TIMEOUT&lt;br /&gt;
|-&lt;br /&gt;
| 0x8008440B || Out || 8 || NVGPU_DBG_GPU_IOCTL_GET_TIMEOUT&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004440C || Out || 4 || NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT_SIZE&lt;br /&gt;
|-&lt;br /&gt;
| 0x0000440D || None || 0 || [[#NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC018440F || Inout || 24 || NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_NUM_PDES&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104410 || Inout || 16 || [[#NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_PDES]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184411 || Inout || 24 || NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_NUM_PTES&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104412 || Inout || 16 || [[#NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_PTES]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0684413 || Inout || 104 || NVGPU_DBG_GPU_IOCTL_GET_COMPTAG_INFO&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184414 || Inout || 24 || [[#NVGPU_DBG_GPU_IOCTL_READ_COMPTAGS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184415 || Inout || 24 || [[#NVGPU_DBG_GPU_IOCTL_WRITE_COMPTAGS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104416 || Inout || 16 || NVGPU_DBG_GPU_IOCTL_RESERVE_COMPTAGS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104417 || Inout || 16 || NVGPU_DBG_GPU_IOCTL_FREE_RESERVED_COMPTAGS&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104418 || Inout || 16 || NVGPU_DBG_GPU_IOCTL_RESERVE_PA&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104419 || Inout || 16 || NVGPU_DBG_GPU_IOCTL_FREE_RESERVED_PA&lt;br /&gt;
|-&lt;br /&gt;
| 0xC018441A || Inout || 24 || NVGPU_DBG_GPU_IOCTL_LAZY_ALLOC_RESERVED_PA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT ===&lt;br /&gt;
Uses [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_PDES ===&lt;br /&gt;
Uses [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_DBG_GPU_IOCTL_GET_GPU_VA_RANGE_PTES ===&lt;br /&gt;
Uses [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_DBG_GPU_IOCTL_READ_COMPTAGS ===&lt;br /&gt;
Uses [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_DBG_GPU_IOCTL_WRITE_COMPTAGS ===&lt;br /&gt;
Uses [[#Ioctl2|Ioctl2]].&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhost-prof-gpu ==&lt;br /&gt;
Returns [[#Errors|NotSupported]] on Open unless nn::settings::detail::GetDebugModeFlag is set.&lt;br /&gt;
&lt;br /&gt;
This device is identical to [[#/dev/nvhost-dbg-gpu|/dev/nvhost-dbg-gpu]].&lt;br /&gt;
&lt;br /&gt;
== /dev/nvhost-ctrl-gpu ==&lt;br /&gt;
This device is for global (context independent) operations on the gpu.  &lt;br /&gt;
                                                                                                                                               &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Direction || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x80044701 || Out || 4 || [[#NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80284702 || Out || 40 || [[#NVGPU_GPU_IOCTL_ZCULL_GET_INFO]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x402C4703 || In || 44 || [[#NVGPU_GPU_IOCTL_ZBC_SET_TABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0344704 || Inout || 52 || [[#NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0B04705 || Inout || 176 || [[#NVGPU_GPU_IOCTL_GET_CHARACTERISTICS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0184706 || Inout || 24 || [[#NVGPU_GPU_IOCTL_GET_TPC_MASKS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084707 || In || 8 || [[#NVGPU_GPU_IOCTL_FLUSH_L2]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008470D || In || 8 || [[#NVGPU_GPU_IOCTL_INVAL_ICACHE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008470E || In || 8 || [[#NVGPU_GPU_IOCTL_SET_MMU_DEBUG_MODE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4010470F || In || 16 || [[#NVGPU_GPU_IOCTL_SET_SM_DEBUG_MODE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0304710&amp;lt;/br&amp;gt;([1.0.0-6.1.0] 0xC0084710) || Inout || 48&amp;lt;/br&amp;gt;([1.0.0-6.1.0] 8) || [[#NVGPU_GPU_IOCTL_WAIT_FOR_PAUSE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80084711 || Out || 8 || [[#NVGPU_GPU_IOCTL_GET_TPC_EXCEPTION_EN_STATUS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80084712 || Out || 8 || [[#NVGPU_GPU_IOCTL_NUM_VSMS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0044713 || Inout || 4 || [[#NVGPU_GPU_IOCTL_VSMS_MAPPING]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80084714 || Out || 8 || [[#NVGPU_GPU_IOCTL_ZBC_GET_ACTIVE_SLOT_MASK]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80044715 || Out || 4 || [[#NVGPU_GPU_IOCTL_PMU_GET_GPU_LOAD]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084716 || In || 8 || [[#NVGPU_GPU_IOCTL_SET_CG_CONTROLS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0084717 || Inout || 8 || [[#NVGPU_GPU_IOCTL_GET_CG_CONTROLS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084718 || In || 8 || [[#NVGPU_GPU_IOCTL_SET_PG_CONTROLS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0084719 || Inout || 8 || [[#NVGPU_GPU_IOCTL_GET_PG_CONTROLS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x8018471A || Out || 24 || [[#NVGPU_GPU_IOCTL_PMU_GET_ELPG_RESIDENCY_GATING]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC008471B || Inout || 8 || [[#NVGPU_GPU_IOCTL_GET_ERROR_CHANNEL_USER_DATA]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010471C || Inout || 16 || [[#NVGPU_GPU_IOCTL_GET_GPU_TIME]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC108471D || Inout || 264 || [[#NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE ===&lt;br /&gt;
Returns the GPU&#039;s ZCULL context size. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __out u32 size;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_ZCULL_GET_INFO ===&lt;br /&gt;
Returns GPU&#039;s ZCULL information. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __out u32 width_align_pixels;&lt;br /&gt;
    __out u32 height_align_pixels;&lt;br /&gt;
    __out u32 pixel_squares_by_aliquots;&lt;br /&gt;
    __out u32 aliquot_total;&lt;br /&gt;
    __out u32 region_byte_multiplier;&lt;br /&gt;
    __out u32 region_header_size;&lt;br /&gt;
    __out u32 subregion_header_size;&lt;br /&gt;
    __out u32 subregion_width_align_pixels;&lt;br /&gt;
    __out u32 subregion_height_align_pixels;&lt;br /&gt;
    __out u32 subregion_count;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_ZBC_SET_TABLE ===&lt;br /&gt;
Sets the active ZBC table. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __in u32 color_ds[4];&lt;br /&gt;
    __in u32 color_l2[4];&lt;br /&gt;
    __in u32 depth;&lt;br /&gt;
    __in u32 format;&lt;br /&gt;
    __in u32 type;         // 1=color, 2=depth&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE ===&lt;br /&gt;
Queries the active ZBC table. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __out u32 color_ds[4];&lt;br /&gt;
    __out u32 color_l2[4];&lt;br /&gt;
    __out u32 depth;&lt;br /&gt;
    __out u32 ref_cnt;&lt;br /&gt;
    __out u32 format;&lt;br /&gt;
    __out u32 type;&lt;br /&gt;
    __inout u32 index_size;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_CHARACTERISTICS ===&lt;br /&gt;
Returns the GPU characteristics. Modified to return inline data instead of using a pointer.&lt;br /&gt;
&lt;br /&gt;
[3.0.0+] Uses either [[#Ioctl|Ioctl]] or [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
  struct gpu_characteristics {&lt;br /&gt;
    u32 arch;                       // 0x120 (NVGPU_GPU_ARCH_GM200)&lt;br /&gt;
    u32 impl;                       // 0xB (NVGPU_GPU_IMPL_GM20B) or 0xE (NVGPU_GPU_IMPL_GM20B_B)&lt;br /&gt;
    u32 rev;                        // 0xA1 (Revision A1)&lt;br /&gt;
    u32 num_gpc;                    // 0x1&lt;br /&gt;
    u64 l2_cache_size;              // 0x40000&lt;br /&gt;
    u64 on_board_video_memory_size; // 0x0 (not used)&lt;br /&gt;
    u32 num_tpc_per_gpc;            // 0x2&lt;br /&gt;
    u32 bus_type;                   // 0x20 (NVGPU_GPU_BUS_TYPE_AXI)&lt;br /&gt;
    u32 big_page_size;              // 0x20000&lt;br /&gt;
    u32 compression_page_size;      // 0x20000&lt;br /&gt;
    u32 pde_coverage_bit_count;     // 0x1B&lt;br /&gt;
    u32 available_big_page_sizes;   // 0x30000&lt;br /&gt;
    u32 gpc_mask;                   // 0x1&lt;br /&gt;
    u32 sm_arch_sm_version;         // 0x503 (Maxwell Generation 5.0.3)&lt;br /&gt;
    u32 sm_arch_spa_version;        // 0x503 (Maxwell Generation 5.0.3)&lt;br /&gt;
    u32 sm_arch_warp_count;         // 0x80&lt;br /&gt;
    u32 gpu_va_bit_count;           // 0x28&lt;br /&gt;
    u32 reserved;                   // NULL&lt;br /&gt;
    u64 flags;                      // 0x55 (HAS_SYNCPOINTS | SUPPORT_SPARSE_ALLOCS | SUPPORT_CYCLE_STATS | SUPPORT_CYCLE_STATS_SNAPSHOT)&lt;br /&gt;
    u32 twod_class;                 // 0x902D (FERMI_TWOD_A)&lt;br /&gt;
    u32 threed_class;               // 0xB197 (MAXWELL_B)&lt;br /&gt;
    u32 compute_class;              // 0xB1C0 (MAXWELL_COMPUTE_B)&lt;br /&gt;
    u32 gpfifo_class;               // 0xB06F (MAXWELL_CHANNEL_GPFIFO_A)&lt;br /&gt;
    u32 inline_to_memory_class;     // 0xA140 (KEPLER_INLINE_TO_MEMORY_B)&lt;br /&gt;
    u32 dma_copy_class;             // 0xB0B5 (MAXWELL_DMA_COPY_A)&lt;br /&gt;
    u32 max_fbps_count;             // 0x1&lt;br /&gt;
    u32 fbp_en_mask;                // 0x0 (disabled)&lt;br /&gt;
    u32 max_ltc_per_fbp;            // 0x2&lt;br /&gt;
    u32 max_lts_per_ltc;            // 0x1&lt;br /&gt;
    u32 max_tex_per_tpc;            // 0x0 (not supported)&lt;br /&gt;
    u32 max_gpc_count;              // 0x1&lt;br /&gt;
    u32 rop_l2_en_mask_0;           // 0x21D70 (fuse_status_opt_rop_l2_fbp_r)&lt;br /&gt;
    u32 rop_l2_en_mask_1;           // 0x0&lt;br /&gt;
    u64 chipname;                   // 0x6230326D67 (&amp;quot;gm20b&amp;quot;)&lt;br /&gt;
    u64 gr_compbit_store_base_hw;   // 0x0 (not supported)&lt;br /&gt;
  };&lt;br /&gt;
 &lt;br /&gt;
  struct {&lt;br /&gt;
    __inout u64 gpu_characteristics_buf_size;   // must not be NULL, but gets overwritten with 0xA0=max_size&lt;br /&gt;
    __in    u64 gpu_characteristics_buf_addr;   // ignored, but must not be NULL&lt;br /&gt;
    __out struct gpu_characteristics gc;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_TPC_MASKS ===&lt;br /&gt;
Returns the TPC mask value for each GPC. Modified to return inline data instead of using a pointer.&lt;br /&gt;
&lt;br /&gt;
[3.0.0+] Uses either [[#Ioctl|Ioctl]] or [[#Ioctl3|Ioctl3]].&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 mask_buf_size;       // ignored, but must not be NULL&lt;br /&gt;
    __in u32 reserved[3];&lt;br /&gt;
    __out u64 mask_buf;           // receives one 32-bit TPC mask per GPC (GPC 0 and GPC 1)&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_FLUSH_L2 ===&lt;br /&gt;
Flushes the GPU L2 cache.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 flush;          // l2_flush | l2_invalidate &amp;lt;&amp;lt; 1 | fb_flush &amp;lt;&amp;lt; 2&lt;br /&gt;
    __in u32 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_INVAL_ICACHE ===&lt;br /&gt;
Invalidates the GPU instruction cache. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in s32 channel_fd;&lt;br /&gt;
    __in u32 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_SET_MMU_DEBUG_MODE ===&lt;br /&gt;
Sets the GPU MMU debug mode. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 state;&lt;br /&gt;
    __in u32 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_SET_SM_DEBUG_MODE ===&lt;br /&gt;
Sets the GPU SM debug mode. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in s32 channel_fd;&lt;br /&gt;
    __in u32 enable;&lt;br /&gt;
    __in u64 sms;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_WAIT_FOR_PAUSE ===&lt;br /&gt;
Waits until all valid warps on the GPU SM are paused and returns their current state.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 pwarpstate;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
[6.1.0+] This command was modified to return inline data instead of using a pointer.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 sm0_valid_warps;&lt;br /&gt;
    __out u64 sm0_trapped_warps;&lt;br /&gt;
    __out u64 sm0_paused_warps;&lt;br /&gt;
    __out u64 sm1_valid_warps;&lt;br /&gt;
    __out u64 sm1_trapped_warps;&lt;br /&gt;
    __out u64 sm1_paused_warps;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_TPC_EXCEPTION_EN_STATUS ===&lt;br /&gt;
Returns a mask value describing all active TPC exceptions. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 tpc_exception_en_sm_mask;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_NUM_VSMS ===&lt;br /&gt;
Returns the number of GPU SM units present. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 num_vsms;&lt;br /&gt;
    __out u32 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_VSMS_MAPPING ===&lt;br /&gt;
Returns mapping information on each GPU SM unit. Modified to return inline data instead of using a pointer.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u8 sm0_gpc_index;&lt;br /&gt;
    __out u8 sm0_tpc_index;&lt;br /&gt;
    __out u8 sm1_gpc_index;&lt;br /&gt;
    __out u8 sm1_tpc_index;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_ZBC_GET_ACTIVE_SLOT_MASK ===&lt;br /&gt;
Returns the mask value for a ZBC slot.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 slot;       // always 0x07&lt;br /&gt;
    __out u32 mask;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_PMU_GET_GPU_LOAD ===&lt;br /&gt;
Returns the GPU load value from the PMU.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 pmu_gpu_load;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_SET_CG_CONTROLS ===&lt;br /&gt;
Sets the clock gate control value.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 cg_mask;&lt;br /&gt;
    __in u32 cg_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_CG_CONTROLS ===&lt;br /&gt;
Returns the clock gate control value.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 cg_mask;&lt;br /&gt;
    __out u32 cg_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_SET_PG_CONTROLS ===&lt;br /&gt;
Sets the power gate control value.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 pg_mask;&lt;br /&gt;
    __in u32 pg_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_PG_CONTROLS ===&lt;br /&gt;
Returns the power gate control value.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 pg_mask;&lt;br /&gt;
    __out u32 pg_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_PMU_GET_ELPG_RESIDENCY_GATING ===&lt;br /&gt;
Returns the GPU PMU ELPG residency gating values.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 pg_ingating_time_us;&lt;br /&gt;
    __out u64 pg_ungating_time_us;&lt;br /&gt;
    __out u64 pg_gating_cnt;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_ERROR_CHANNEL_USER_DATA ===&lt;br /&gt;
Returns user specific data from the error channel, if one exists.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 data;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_GPU_TIME ===&lt;br /&gt;
Returns the timestamp from the GPU&#039;s nanosecond timer (PTIMER). Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 gpu_timestamp;      // raw GPU counter (PTIMER) value&lt;br /&gt;
    __out u64 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO ===&lt;br /&gt;
Returns CPU/GPU timestamp pairs for correlation analysis. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct time_correlation_sample {&lt;br /&gt;
   u64 cpu_timestamp;                                  // from CPU&#039;s CNTPCT_EL0 register&lt;br /&gt;
   u64 gpu_timestamp;                                  // from GPU&#039;s PTIMER registers&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 struct {&lt;br /&gt;
   __out struct time_correlation_sample samples[16];   // timestamp pairs&lt;br /&gt;
   __in u32     count;                                 // number of pairs to read&lt;br /&gt;
   __in u32     source_id;                             // cpu clock source id (must be 1)&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Channels ==&lt;br /&gt;
Channels are a concept for  NVIDIA hardware blocks that share a common interface.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Path || Name&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-gpu || GPU&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-msenc || Video Encoder&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-nvdec || Video Decoder&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-nvjpg || JPEG Decoder&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-vic || Video Image Compositor&lt;br /&gt;
|-&lt;br /&gt;
| /dev/nvhost-display || Display&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Channel Ioctls ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Value || Size || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??0001 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080002 || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080003 || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_WAITBASE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080004 || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_MODMUTEX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40040007 || 4 || [[#NVHOST_IOCTL_CHANNEL_SET_SUBMIT_TIMEOUT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40080008 || 8 || [[#NVHOST_IOCTL_CHANNEL_SET_CLK_RATE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??0009 || Variable || [[#NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??000A || Variable || [[#NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000013 || 0 || [[#NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0080023&amp;lt;/br&amp;gt;([1.0.0-7.0.1] 0xC0080014) || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_CLK_RATE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??0024 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT_EX&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??0025 || Variable || [[#NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??0026 || Variable || [[#NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER_EX]]&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| 0x40044801 || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40044803 || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_TIMEOUT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084805 || 8 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40184806 || 24 || [[#NVGPU_IOCTL_CHANNEL_WAIT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0044807 || 4 || [[#NVGPU_IOCTL_CHANNEL_CYCLE_STATS]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??4808 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104809 || 16 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4008480A || 8 || [[#NVHOST_IOCTL_CHANNEL_FREE_OBJ_CTX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC010480B || 16 || [[#NVGPU_IOCTL_CHANNEL_ZCULL_BIND]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC018480C || 24 || [[#NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x4004480D || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_PRIORITY]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x0000480E || 0 || [[#NVGPU_IOCTL_CHANNEL_ENABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x0000480F || 0 || [[#NVGPU_IOCTL_CHANNEL_DISABLE]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00004810 || 0 || [[#NVGPU_IOCTL_CHANNEL_PREEMPT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00004811 || 0 || [[#NVGPU_IOCTL_CHANNEL_FORCE_RESET]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40084812 || 8 || [[#NVGPU_IOCTL_CHANNEL_EVENT_ID_CONTROL]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104813 || 16 || [[#NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80804816 || 128 || [[#NVGPU_IOCTL_CHANNEL_GET_ERROR_INFO]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0104817 || 16 || [[#NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x40204818 || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0??4819 || Variable || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC020481A || 32 || [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC018481B || 24 || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC018481C || 24 || [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY_EX]]&lt;br /&gt;
|-&lt;br /&gt;
| 0xC004481D || 4 || [[#NVGPU_IOCTL_CHANNEL_SET_TIMESLICE]]&lt;br /&gt;
|- style=&amp;quot;border-top: double&amp;quot;&lt;br /&gt;
| 0x40084714 || 8 || [[#NVGPU_IOCTL_CHANNEL_SET_USER_DATA]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x80084715 || 8 || [[#NVGPU_IOCTL_CHANNEL_GET_USER_DATA]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT ===&lt;br /&gt;
Returns the current syncpoint value for a given module. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 module_id;&lt;br /&gt;
    __out   u32 syncpt_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_GET_WAITBASE ===&lt;br /&gt;
Returns the current waitbase value for a given module. Always returns 0.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 module_id;&lt;br /&gt;
    __out   u32 waitbase_value;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_GET_MODMUTEX ===&lt;br /&gt;
Stubbed. Does a debug print and returns 0.&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_SET_SUBMIT_TIMEOUT ===&lt;br /&gt;
Sets the submit timeout value for the channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 timeout;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_SET_CLK_RATE ===&lt;br /&gt;
Sets the clock rate value for a given module. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 clk_rate;&lt;br /&gt;
    __in    u32 module_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER ===&lt;br /&gt;
Uses &#039;&#039;&#039;nvmap_pin&#039;&#039;&#039; internally to pin a given number of nvmap handles to an appropriate device physical address.&lt;br /&gt;
&lt;br /&gt;
  struct handle {&lt;br /&gt;
    u32 handle_id_in;                 // nvmap handle to map&lt;br /&gt;
    u32 phys_addr_out;                // returned device physical address mapped to the handle&lt;br /&gt;
  };&lt;br /&gt;
 &lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 num_handles;          // number of nvmap handles to map&lt;br /&gt;
    __in    u32 reserved;             // ignored&lt;br /&gt;
    __in    u8  is_compr;             // memory to map is compressed&lt;br /&gt;
    __in    u8  padding[3];           // ignored&lt;br /&gt;
    __inout struct handle handles[];  // depends on num_handles&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER ===&lt;br /&gt;
Uses &#039;&#039;&#039;nvmap_unpin&#039;&#039;&#039; internally to unpin a given number of nvmap handles from their device physical address.&lt;br /&gt;
&lt;br /&gt;
  struct handle {&lt;br /&gt;
    u32 handle_id_in;                 // nvmap handle to unmap&lt;br /&gt;
    u32 reserved;                     // ignored&lt;br /&gt;
  };&lt;br /&gt;
 &lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 num_handles;          // number of nvmap handles to unmap&lt;br /&gt;
    __in    u32 reserved;             // ignored&lt;br /&gt;
    __in    u8  is_compr;             // memory to unmap is compressed&lt;br /&gt;
    __in    u8  padding[3];           // ignored&lt;br /&gt;
    __inout struct handle handles[];  // depends on num_handles&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX ===&lt;br /&gt;
Sets the global timeout value for the channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 timeout;&lt;br /&gt;
    __in    u32 flags;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_GET_CLK_RATE ===&lt;br /&gt;
Returns the clock rate value for a given module. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out   u32 clk_rate;&lt;br /&gt;
    __in    u32 module_id;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX ===&lt;br /&gt;
Same as [[#NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER|NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER]], but calls &#039;&#039;&#039;nvmap_unpin&#039;&#039;&#039; internally in case of error.&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER_EX ===&lt;br /&gt;
Same as [[#NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER|NVHOST_IOCTL_CHANNEL_UNMAP_CMD_BUFFER]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD ===&lt;br /&gt;
Binds a nvmap object to this channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 nvmap_fd;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_TIMEOUT ===&lt;br /&gt;
Sets the timeout value for the GPU channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 timeout;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO ===&lt;br /&gt;
Allocates gpfifo entries. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 num_entries;&lt;br /&gt;
    __in u32 flags;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_WAIT ===&lt;br /&gt;
Waits on channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 type;            // wait type (0=notifier, 1=semaphore)&lt;br /&gt;
    __in u32 timeout;         // wait timeout value&lt;br /&gt;
    __in u32 dmabuf_fd;       // nvmap handle&lt;br /&gt;
    __in u32 offset;          // nvmap memory offset&lt;br /&gt;
    __in u32 payload;         // payload data (semaphore only)&lt;br /&gt;
    __in u32 padding;         // ignored&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_CYCLE_STATS ===&lt;br /&gt;
Maps memory for the cycle stats buffer. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 dmabuf_fd;   // nvmap handle&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO ===&lt;br /&gt;
Submits a gpfifo object. Modified to take inline entry objects instead of a pointer.&lt;br /&gt;
&lt;br /&gt;
  struct fence {&lt;br /&gt;
    u32 syncpt_id;&lt;br /&gt;
    u32 syncpt_value;&lt;br /&gt;
  };&lt;br /&gt;
  &lt;br /&gt;
  struct gpfifo_entry {&lt;br /&gt;
    u64 entry;                               // gpu_iova | (unk_2bits &amp;lt;&amp;lt; 40) | (size &amp;lt;&amp;lt; 42) | (unk_flag &amp;lt;&amp;lt; 63)&lt;br /&gt;
  };&lt;br /&gt;
  &lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u64 gpfifo;                      // (ignored) pointer to gpfifo fence structs&lt;br /&gt;
    __in    u32 num_entries;                 // number of fence objects being submitted&lt;br /&gt;
    __in    u32 flags;&lt;br /&gt;
    __inout struct fence fence_out;          // returned new fence object for others to wait on&lt;br /&gt;
    __in    struct gpfifo_entry entries[];   // depends on num_entries&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX ===&lt;br /&gt;
Allocates a graphics context object. Modified to ignore object&#039;s ID.&lt;br /&gt;
&lt;br /&gt;
You can only have one object context allocated at a time. You must have bound an address space before using this.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in  u32 class_num;    // 0x902D=2d, 0xB197=3d, 0xB1C0=compute, 0xA140=kepler, 0xB0B5=DMA, 0xB06F=channel_gpfifo&lt;br /&gt;
    __in  u32 flags;        // bit0: LOCKBOOST_ZERO&lt;br /&gt;
    __out u64 obj_id;       // (ignored) used for FREE_OBJ_CTX ioctl, which is not supported&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVHOST_IOCTL_CHANNEL_FREE_OBJ_CTX ===&lt;br /&gt;
Frees a graphics context object. Not supported.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 obj_id;       // ignored&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ZCULL_BIND ===&lt;br /&gt;
Binds a ZCULL context to the channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
 struct {&lt;br /&gt;
    __in u64 gpu_va;&lt;br /&gt;
    __in u32 mode;         // 0=global, 1=no_ctxsw, 2=separate_buffer, 3=part_of_regular_buf&lt;br /&gt;
    __in u32 reserved;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER ===&lt;br /&gt;
Initializes the error notifier for this channel. Unlike for the Linux kernel, the Switch driver cannot write to an arbitrary userspace buffer. Thus new ioctls have been introduced to fetch the error information rather than using a shared memory buffer.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 offset;   // ignored&lt;br /&gt;
    __in u64 size;     // ignored&lt;br /&gt;
    __in u32 mem;      // must be non-zero to initialize, zero to de-initialize&lt;br /&gt;
    __in u32 reserved; // ignored&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_PRIORITY ===&lt;br /&gt;
Changes channel&#039;s priority. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 priority;    // 0x32 is low, 0x64 is medium and 0x96 is high&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ENABLE ===&lt;br /&gt;
Enables the current channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_DISABLE ===&lt;br /&gt;
Disables the current channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_PREEMPT ===&lt;br /&gt;
Clears the FIFO pipe for this channel. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_FORCE_RESET ===&lt;br /&gt;
Forces the channel to reset. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_EVENT_ID_CONTROL ===&lt;br /&gt;
Controls event notifications.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 cmd;    // 0=disable, 1=enable, 2=clear&lt;br /&gt;
    __in u32 id;     // same id&#039;s as for [[#QueryEvent]]&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT ===&lt;br /&gt;
Controls the cycle stats snapshot buffer. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in    u32 cmd;         // command to handle (0=flush, 1=attach, 2=detach)&lt;br /&gt;
    __in    u32 dmabuf_fd;   // nvmap handle&lt;br /&gt;
    __inout u32 extra;       // extra payload data/result&lt;br /&gt;
    __in    u32 padding;     // ignored&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_GET_ERROR_INFO ===&lt;br /&gt;
Returns information on the current error notification caught by the error notifier. Exclusive to the Switch.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u32 error_info[32];    // first word is an error code (0=no_error, 1=gr_error, 2=gr_error, 3=invalid, 4=invalid)&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_GET_ERROR_NOTIFICATION ===&lt;br /&gt;
Returns the current error notification caught by the error notifier. Exclusive to the Switch.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 timestamp;    // fetched straight from armGetSystemTick&lt;br /&gt;
    __out u32 info32;       // error code&lt;br /&gt;
    __out u16 info16;       // additional error info&lt;br /&gt;
    __out u16 status;       // always 0xFFFF&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX ===&lt;br /&gt;
Allocates gpfifo entries with additional parameters. Exclusive to the Switch.&lt;br /&gt;
&lt;br /&gt;
 struct fence {&lt;br /&gt;
   u32 syncpt_id;&lt;br /&gt;
   u32 syncpt_value;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 struct {&lt;br /&gt;
   __in    u32 num_entries;&lt;br /&gt;
   __in    u32 num_jobs;&lt;br /&gt;
   __in    u32 flags;&lt;br /&gt;
   __out   struct fence fence_out;          // returned new fence object for others to wait on&lt;br /&gt;
   __in    u32 reserved[3];                 // ignored&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY ===&lt;br /&gt;
Same as [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO|NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX2 ===&lt;br /&gt;
Same as [[#NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX|NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_EX ===&lt;br /&gt;
Same as [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO|NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO]], but uses [[#Ioctl2|Ioctl2]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY_EX ===&lt;br /&gt;
Same as [[#NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY|NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO_RETRY]], but uses [[#Ioctl2|Ioctl2]].&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_TIMESLICE ===&lt;br /&gt;
Changes channel&#039;s timeslice. Identical to Linux driver.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u32 timeslice;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_SET_USER_DATA ===&lt;br /&gt;
Sets user specific data.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __in u64 data;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
=== NVGPU_IOCTL_CHANNEL_GET_USER_DATA ===&lt;br /&gt;
Returns user specific data.&lt;br /&gt;
&lt;br /&gt;
  struct {&lt;br /&gt;
    __out u64 data;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
= nvmemp =&lt;br /&gt;
NVIDIA memory profiler (this service is not available on retail units). &lt;br /&gt;
/dev/nvhost-ctrl sends the ioctl NVHOST_IOCTL_CTRL_GET_CONFIG to check the config &amp;quot;nv!NV_MEMORY_PROFILER&amp;quot;. If config_str returns &amp;quot;1&amp;quot;, the application attempts to use nvmemp.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Open&lt;br /&gt;
|-&lt;br /&gt;
| 1 || GetAruid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= nvdrvdbg =&lt;br /&gt;
This is &amp;quot;nns::nvdrv::INvDrvDebugFSServices&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#OpenDebugFS]]&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#CloseDebugFS]]&lt;br /&gt;
|-&lt;br /&gt;
| 2 || [[#GetDebugFSKeys]]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || GetDebugFSValue&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SetDebugFSValue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== OpenDebugFS ==&lt;br /&gt;
Takes a process handle. Returns a u32 &#039;&#039;&#039;fd&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== CloseDebugFS ==&lt;br /&gt;
Takes a u32 &#039;&#039;&#039;fd&#039;&#039;&#039; and closes it.&lt;br /&gt;
&lt;br /&gt;
== GetDebugFSKeys ==&lt;br /&gt;
Takes a u32 &#039;&#039;&#039;fd&#039;&#039;&#039; and reads debug contents into a type-6 buffer.&lt;br /&gt;
&lt;br /&gt;
= nvgem:c =&lt;br /&gt;
This is &amp;quot;nv::gemcontrol::INvGemControl&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Initialize&lt;br /&gt;
|-&lt;br /&gt;
| 1 || GetGemEvent&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &lt;br /&gt;
|-&lt;br /&gt;
| 3 || RegisterUnregisterAppIdLocked&lt;br /&gt;
|-&lt;br /&gt;
| 4 ||&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0-4.1.0] 5 || GetAruid&lt;br /&gt;
|-&lt;br /&gt;
| 6 || HandleDeferredErrors&lt;br /&gt;
|-&lt;br /&gt;
| 7 || [3.0.0+]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= nvgem:cd =&lt;br /&gt;
This is &amp;quot;nv::gemcoredump::INvGemCoreDump&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Initialize&lt;br /&gt;
|-&lt;br /&gt;
| 1 || GetAruid&lt;br /&gt;
|-&lt;br /&gt;
| [1.0.0-8.1.0] 2 || ReadNextCdBlock&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [8.0.0+]&lt;br /&gt;
|-&lt;br /&gt;
| 4 || [8.0.0+]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Errors =&lt;br /&gt;
Most nvidia driver commands return an error code apart from the normal return code.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Success&lt;br /&gt;
|-&lt;br /&gt;
| 1 || NotImplemented&lt;br /&gt;
|-&lt;br /&gt;
| 2 || NotSupported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || NotInitialized&lt;br /&gt;
|-&lt;br /&gt;
| 4 || BadParameter&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Timeout&lt;br /&gt;
|-&lt;br /&gt;
| 6 || InsufficientMemory&lt;br /&gt;
|-&lt;br /&gt;
| 7 || ReadOnlyAttribute&lt;br /&gt;
|-&lt;br /&gt;
| 8 || InvalidState&lt;br /&gt;
|-&lt;br /&gt;
| 9 || InvalidAddress&lt;br /&gt;
|-&lt;br /&gt;
| 0xA || InvalidSize&lt;br /&gt;
|-&lt;br /&gt;
| 0xB || BadValue&lt;br /&gt;
|-&lt;br /&gt;
| 0xD || AlreadyAllocated&lt;br /&gt;
|-&lt;br /&gt;
| 0xE || Busy&lt;br /&gt;
|-&lt;br /&gt;
| 0xF || ResourceError&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || CountMismatch&lt;br /&gt;
|-&lt;br /&gt;
| 0x1000 || SharedMemoryTooSmall&lt;br /&gt;
|-&lt;br /&gt;
| 0x30003 || FileOperationFailed&lt;br /&gt;
|-&lt;br /&gt;
| 0x30004 || DirOperationFailed&lt;br /&gt;
|-&lt;br /&gt;
| 0x3000F || IoctlFailed                        &lt;br /&gt;
|-&lt;br /&gt;
| 0x30010 || AccessDenied&lt;br /&gt;
|-&lt;br /&gt;
| 0x30013 || FileNotFound&lt;br /&gt;
|-&lt;br /&gt;
| 0xA000E || ModuleNotPresent&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Panic =&lt;br /&gt;
In some cases, a panic may occur. NV forces a crash by doing:&lt;br /&gt;
 (void *)0 = 0xCAFE;&lt;br /&gt;
End result is that the system hangs with a white-screen.&lt;br /&gt;
&lt;br /&gt;
== Gpfifo Panic ==&lt;br /&gt;
When the gpfifo data in the gpu_va buffers specified by the submitted gpfifo entries is invalid(?), eventually the user-process will be force-terminated after using the submit-gpfifo ioctl. It&#039;s unknown how exactly this is done.&lt;br /&gt;
&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=HIPC&amp;diff=7981</id>
		<title>HIPC</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=HIPC&amp;diff=7981"/>
		<updated>2019-09-23T09:45:18Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: Fix bracket location&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== IPC Command Structure ==&lt;br /&gt;
This is an array of u32&#039;s, usually located in [[Thread Local Storage]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 15-0 || [[#Type|Type]].&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 19-16 || Number of buf X descriptors (each: 2 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 23-20 || Number of buf A descriptors (each: 3 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 27-24 || Number of buf B descriptors (each: 3 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-28 || Number of buf W desciptors (each: 3 words), not observed&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 9-0 || Size of [[#Raw data section|raw data]] in u32s.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 13-10 || Flags for buf C descriptor.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 30-20 || Empty.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 31 || Enable handle descriptor.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Handle descriptor|Handle descriptor]], if enabled.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor X &amp;quot;Pointer&amp;quot;|Buf X descriptors]], each one 2 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf A descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf B descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf W descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Raw_data_section|Raw data section]] (including padding before and after aligned data section).&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor C &amp;quot;ReceiveList&amp;quot;|Buf C descriptors]], each one 2 words.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First two header u32&#039;s and handle descriptor (if enabled) are copied as-is from one process to the other.&lt;br /&gt;
&lt;br /&gt;
=== Type ===&lt;br /&gt;
IPC commands can have different types which influence how the IPC server processes requests in &amp;quot;nn::sf::hipc::server::HipcServerSessionManagerBase::ProcessRequest&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Invalid&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#LegacyRequest, LegacyControl|LegacyRequest]]&lt;br /&gt;
|-&lt;br /&gt;
| 2 || [[#Close|Close]]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [[#LegacyRequest, LegacyControl|LegacyControl]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 || [[#Request, Control|Request]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || [[#Request, Control|Control]]&lt;br /&gt;
|-&lt;br /&gt;
| 6 || [5.0.0+] [[#RequestWithContext, ControlWithContext|RequestWithContext]]&lt;br /&gt;
|-&lt;br /&gt;
| 7 || [5.0.0+] [[#RequestWithContext, ControlWithContext|ControlWithContext]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Close ====&lt;br /&gt;
When processing a request of this type, the IPC server calls:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::DestroyServerSession&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::CloseServerSessionHandle&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This ensures that the server session is destroyed internally and properly closed.&lt;br /&gt;
&lt;br /&gt;
==== LegacyRequest, LegacyControl ====&lt;br /&gt;
These types are handled by calling:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::detail::HipcMessageBufferAccessor::ParseHeader&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::ProcessMessage&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::Reply&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::RegisterServerSessionToWaitBase&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It is speculated that these are part of an older message processing system where headers were further partitioned.&lt;br /&gt;
&lt;br /&gt;
==== Request, Control ====&lt;br /&gt;
These types are handled by calling:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::ProcessMessage2&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::RegisterServerSessionToWaitBase&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This represents a more modern message handling system where contents follow the general marshalling structure.&lt;br /&gt;
&lt;br /&gt;
==== RequestWithContext, ControlWithContext ====&lt;br /&gt;
These are identical to normal Request and Control types, but with the additional requirement of suppling a token in their [[#Data payload|data payload]].&lt;br /&gt;
&lt;br /&gt;
This token is used by &amp;quot;nn::sf::cmif::SetInlineContext&amp;quot; which has the sole purpose of saving it into the TLS in order for it to be distributed to any IPC commands that are made while processing the current command. It&#039;s unknown if this token serves any purpose or if it&#039;s just a debug-tool to figure out what IPC command caused a particular chain of commands.&lt;br /&gt;
&lt;br /&gt;
=== Handle descriptor ===&lt;br /&gt;
There can only be one of this descriptor type. It is enabled by bit31 of the second word.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || Send current PID.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 4-1 || Number of handles to copy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-5 || Number of handles to move&lt;br /&gt;
|-&lt;br /&gt;
| ... || || 8-byte PID if enabled&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Handles to copy&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Handles to move&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sysmodules load the last u64 of rawdata when handling the PID. This is not written by kernel. For sysmodule handling:&lt;br /&gt;
* In some cases: these commands require a placeholder u64 value passed in the input parameters, as mentioned above. In these cases the OverwriteClientProcessId method is called to replace the value before it is used.&lt;br /&gt;
* In other cases: The rawdata_u64 is compared with the PID from the descriptor. On mismatch and when rawdata_u64!=0, error 0x60A is returned. The PID value passed to the cmdhandler vtable funcptr is the rawdata_u64.&lt;br /&gt;
&lt;br /&gt;
Handle 0 is allowed, and just means no handle was sent.&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor X &amp;quot;Pointer&amp;quot; ===&lt;br /&gt;
This one is packed even worse than A, they inserted the bit38-36 of the address &#039;&#039;on top&#039;&#039; of the counter field.&lt;br /&gt;
&lt;br /&gt;
Officially, the counter is known as &amp;quot;receive index&amp;quot;. This one writes to the buffer described in the ReceiveList.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 5-0 || Bits 5-0 of counter.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-6 || Bit 38-36 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 11-9 || Bits 11-9 of counter.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 15-12 || Bit 35-32 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-16 || Size&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Lower 32-bits of address.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot; ===&lt;br /&gt;
This packing is so unnecessarily complex.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || || Lower 32-bits of size.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Lower 32-bits of address.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1-0 || Flags. Always set to 0, 1 or 3.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4-2 || Bit 38-36 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 27-24 || Bit 35-32 of size.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 31-28 || Bit 35-32 of address.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A reply must not use A/B/W, svcReplyAndReceive will return 0xE801.&lt;br /&gt;
&lt;br /&gt;
[[SVC|MemoryAttribute]] IsBorrowed and IsUncached are never allowed for the source address.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Send&amp;quot; means buffer is sent from source process into service process.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Receive&amp;quot; means that data is copied from service process into user process.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Exchange&amp;quot; means both &amp;quot;Send&amp;quot; and &amp;quot;Receive&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Flags ====&lt;br /&gt;
Determines what [[SVC|MemoryState]] to use with the mapped memory in the sysmodule.&lt;br /&gt;
&lt;br /&gt;
Used to enforce whether or not device mapping is allowed for src and dst buffers respectively.&lt;br /&gt;
 &lt;br /&gt;
* Ipc (flag=0): Device mapping *not* allowed for src or dst.&lt;br /&gt;
* NonSecureIpc (flag=1): Device mapping allowed for src and dst.&lt;br /&gt;
* NonDeviceIpc (flag=3): Device mapping allowed for src but not for dst.&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor C &amp;quot;ReceiveList&amp;quot; ===&lt;br /&gt;
There&#039;s a 4-bit flag in the main header controlling the behavior of C descriptors.&lt;br /&gt;
&lt;br /&gt;
If it has value 0, the C descriptor functionality is disabled.&lt;br /&gt;
&lt;br /&gt;
If it has value 1, there is an &amp;quot;inlined&amp;quot; C buffer after the raw data. Received data is copied to ROUND_UP(cmdbuf+raw_size+index, 16)&lt;br /&gt;
&lt;br /&gt;
If it has value 2, there is a single C descriptor.&lt;br /&gt;
&lt;br /&gt;
Otherwise it has (flag-2) C descriptors. In this case, index picks which C descriptor to copy received data to [instead of picking the offset into the buffer].&lt;br /&gt;
&lt;br /&gt;
Data sent with this method must have MemoryState 0x4000000 mask set.&lt;br /&gt;
&lt;br /&gt;
After reply, X descriptors are written to the sender containing the address, size and index that were copied to.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || || Lower 32-bits of address.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 15-0 || Rest of address.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 31-16 || Size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== IPC buffers ===&lt;br /&gt;
Buffer descriptor A/B/... map memory into the sysmodule process. For the mapped memory in the sysmodule the permissions are: desc-A = R--, desc-B = RW-. The buffer is automatically unmapped while the kernel handles the cmdreply, the sysmodule doesn&#039;t need to specify anything in the cmdreply to trigger this.&lt;br /&gt;
&lt;br /&gt;
This memory is mapped in the sysmodule to the same vaddr from the original user-process cmd-request, except with with bits &amp;gt;=(~28(?)) changed to a different ASLR&#039;d region.&lt;br /&gt;
&lt;br /&gt;
No user-process-&amp;gt;sysmodule memcpy is done for outbufs, only sysmodule-&amp;gt;user-process.&lt;br /&gt;
&lt;br /&gt;
Buffer descriptors C/X are somewhat different. Rather than mapping new memory into the server process, C/X descriptors copy data between existing buffers in different processes. Each X descriptor in a message has its data copied into a C descriptor on the other side. Each C descriptor in a message is used to reserve space for the other side&#039;s X descriptors to copy into.&lt;br /&gt;
&lt;br /&gt;
When the kernel processes X descriptors, it must determine where to copy the data to. If the destination used C descriptors with flags &amp;gt;= 3, each X descriptor from the source is matched to a C descriptor in the destination by the X descriptor&#039;s index field. If the destination used a &amp;quot;single&amp;quot; C descriptor, the data from all the X descriptors is copied into the same buffer specified by the destination&#039;s C descriptor (causing error 0xce01 if there is not enough space) and the X descriptor index is ignored. The kernel then modifies the addresses in the X descriptors to indicate where the data was copied to in the destination.&lt;br /&gt;
&lt;br /&gt;
Before receiving a request, if the IPC server is expecting X descriptors, it prepares a message with a &amp;quot;single&amp;quot; C descriptor (flags=2) in its message buffer before calling svcReplyAndReceive so that X descriptors from the client have a place to copy their data to.  The usage of the flag-2 C descriptor allows the server to receive an arbitrary number of X descriptors, since they&#039;re all packed into the same buffer. If the server had used flag-3+ C descriptors, it would be limited in how many X descriptors it could receive since the X descriptors would have to be matched to distinct C descriptors. The buffer that the server&#039;s C descriptor points to is called the &#039;&#039;&#039;pointer buffer&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When the client sends X descriptors, data is copied into the server&#039;s pointer buffer. When the client sends C descriptors, no data is copied automatically. The server needs to use X descriptors to copy the data back to the client&#039;s C descriptors (using the index field to match X descriptors in the response back to the correct C descriptors).&lt;br /&gt;
&lt;br /&gt;
== Raw data section ==&lt;br /&gt;
[[File:Ipc msg buffer type a example.png|thumb|An example of an IPC message with a type 0xA buffer in it. Red is headers/descriptors, yellow is padding, and blue is data/buffer lengths. Note that the size of the u16 array for type A lengths is padded to fill up a whole word.]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Description&lt;br /&gt;
|-&lt;br /&gt;
| ... || Padding to align to 16 bytes.&lt;br /&gt;
|-&lt;br /&gt;
| ... || If sent to an object domain, a [[#Domain_message|domain message]], otherwise a [[#Data payload|data payload]]&lt;br /&gt;
|-&lt;br /&gt;
| ... || Padding&lt;br /&gt;
|-&lt;br /&gt;
| ... || Buffer type 0xA lengths (u16 array)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The total amount of padding within the raw data section is always 0x10 bytes. This means that if no padding is required before the message, there will be 0x10 bytes of padding after the message (before the buffer type 0xA lengths).&lt;br /&gt;
&lt;br /&gt;
=== Domains ===&lt;br /&gt;
Because the switch has relatively low limits on the total number of sessions available to the system (Kernel slabheap limits, sysmodule handle table size limits), HIPC supports a &amp;quot;Domains&amp;quot; feature that allows multiplexing multiple service sessions through a single handle. Domains store (effectively) a mapping from u32 object id to a SharedPointer&amp;lt;IServiceObject&amp;gt; -- When messages are sent to a domain, an extra header is sent in the raw data section (before anything else) with information about what object in the domain is being acted on; responses similarly contain an additional header. Official session code implements this by just using the dispatch table for the object in the map with the appropriate ID, instead of the dispatch table the session was initialized with.&lt;br /&gt;
&lt;br /&gt;
Format for the extra request header for domain message:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 7-0 || Command. 1=send message, 2=close virtual handle&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-15 || Input object count&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-16 || Length of [[IPC_Marshalling#Data_payload|data payload]] in bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Object ID (from cmd 0 in [[IPC_Marshalling#Control|Control]]).&lt;br /&gt;
|-&lt;br /&gt;
| 2 || || Padding&lt;br /&gt;
|-&lt;br /&gt;
| 3 || || [1.0.0-4.1.0] Padding [5.0.0+] Token (for NewRequest only)&lt;br /&gt;
|-&lt;br /&gt;
| 4... || || [[#Data payload|Data payload]]&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Input object IDs (u32s, not aligned)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Format for the extra response header for domain message:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-0 || Output object count&lt;br /&gt;
|-&lt;br /&gt;
| 1-3 || || Padding&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Data payload ===&lt;br /&gt;
This is an array of u32&#039;s, but individual parameters are generally stored as u64&#039;s.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Magic (&amp;quot;SFCI&amp;quot; for requests, &amp;quot;SFCO&amp;quot; for responses) as u32.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Version as u32. 1 for NewRequest, 0 for Request.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Command id as u64 for requests, [[Error_codes|error code]] as u64 for responses.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [1.0.0-4.1.0] Padding [5.0.0+] Token (for NewRequest only, non-domain messages).&lt;br /&gt;
|-&lt;br /&gt;
| 4... || Input parameters or return values&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] Version was incremented from 0 to 1, and a token value was introduced into raw_data+12 (regardless of domain or not, in either case it overlaps with padding).&lt;br /&gt;
&lt;br /&gt;
The input rawdata struct is generated by stable-sorting function parameters by alignment, from low to high. It is likely this is a mistake, as it generates structs with suboptimal possible padding -- Nintendo probably meant to sort from high to low (which would give minimized padding), but couldn&#039;t/can&#039;t change this without breaking backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
== Official marshalling code ==&lt;br /&gt;
The official marshalling function is called &amp;quot;nn::sf::hipc::client::Hipc2ClientCoreProcessorImpl::WriteBufferDataImpl&amp;quot; and takes:&lt;br /&gt;
* A pointer to a &amp;quot;nn::sf::hipc::detail::HipcMessageWriter&amp;quot; context;&lt;br /&gt;
* The number of (buf_ptr, size) pairs;&lt;br /&gt;
* An array of (buf_ptr, size) pairs (called &amp;quot;nn::sf::detail::PointerAndSize&amp;quot;);&lt;br /&gt;
* A pointer to a type bitfield for each such pair;&lt;br /&gt;
* The offset of the main IPC command structure;&lt;br /&gt;
* The size of the IPC command&#039;s [[IPC_Marshalling#Raw_data_section|raw data]].&lt;br /&gt;
&lt;br /&gt;
The type of an IPC command is described by a bitfield as below:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || In || Direction is input.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Out || Direction is output.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || HipcMapAlias || Use buffer descriptors A (&amp;quot;Send&amp;quot;), B (&amp;quot;Receive&amp;quot;) or W (&amp;quot;Exchange&amp;quot;).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || HipcPointer || Use buffer descriptors X (&amp;quot;Pointer&amp;quot;) or C (&amp;quot;ReceiveList&amp;quot;).&lt;br /&gt;
|-&lt;br /&gt;
| 4 || FixedSize || Skip saving the pointer buffer size in raw data.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || HipcAutoSelect || Select which buffer descriptor to use automatically.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || HipcMapTransferAllowsNonSecure || Use [[#Flags|NonSecureIpc flag]].&lt;br /&gt;
|-&lt;br /&gt;
| 7 || HipcMapTransferAllowsNonDevice || Use [[#Flags|NonDeviceIpc flag]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
X and C (Pointer and ReceiveList) descriptors are backed by the &amp;quot;pointer buffer&amp;quot;, a buffer in the service process. Its size is a u16, which is retrieved using the &amp;quot;QueryPointerBufferSize&amp;quot; control message. If the client code determines all buffers with flag 8 do not fit in the pointer buffer, it returns error 0x11A0B.&lt;br /&gt;
&lt;br /&gt;
For buffers with flag 0x20 it creates two descriptors (A+X or B+C), but one descriptor is NULL (zero size and pointer), while the other holds the expected values. X/C descriptors are used as the non-NULL descriptor where possible, but if they don&#039;t fit in the pointer buffer, A/B descriptors are used instead. The code defers processing of type 0x20 buffers with sizes that fit in a u16 (and may therefore fit in the pointer buffer), which ensures all type 8 buffers get pointer-buffer space before any type 0x20. The order in which the deferred type 0x20 buffers are processed is determined by a convoluted loop.&lt;br /&gt;
&lt;br /&gt;
== Official IPC Cmd Structure ==&lt;br /&gt;
Official struct that is stored for each IPC command. It contains precalculated offsets for different portions of the command structure.&lt;br /&gt;
&lt;br /&gt;
All offsets are given is in number of u32 words.&lt;br /&gt;
&lt;br /&gt;
 struct IpcCmdStruct {&lt;br /&gt;
   u8  unk0;&lt;br /&gt;
   u8  has_handle_descriptor;&lt;br /&gt;
   u8  pad0[2];&lt;br /&gt;
   u32 cmd0;&lt;br /&gt;
   u32 cmd1;&lt;br /&gt;
   u32 offset_handle_descriptor;&lt;br /&gt;
   u32 pad1;&lt;br /&gt;
   u32 offset_handles;          &lt;br /&gt;
   u32 pad2;&lt;br /&gt;
   u32 offset_x_descriptors;&lt;br /&gt;
   u32 offset_a_descriptors;&lt;br /&gt;
   u32 offset_b_descriptors;&lt;br /&gt;
   u32 offset_w_descriptors; /* this is a guess */&lt;br /&gt;
   u32 offset_raw_data;&lt;br /&gt;
   u32 offset_c_descriptors;&lt;br /&gt;
   u32 unk2;&lt;br /&gt;
   u32 unk3;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Control ==&lt;br /&gt;
When type is [[IPC_Marshalling#Request.2C_Control|Control]], you are talking to the IPC manager. These are processed by the sysmodule.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name || Arguments || Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || ConvertCurrentObjectToDomain || None || u32 CmifDomainObjectId&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CopyFromCurrentDomain || u32 CmifDomainObjectId || u32 NativeHandle&lt;br /&gt;
|-&lt;br /&gt;
| 2 || CloneCurrentObject || None || u32 NativeHandle&lt;br /&gt;
|-&lt;br /&gt;
| 3 || QueryPointerBufferSize || None || u16 size&lt;br /&gt;
|-&lt;br /&gt;
| 4 || CloneCurrentObjectEx || u32 unknown || u32 NativeHandle&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=HIPC&amp;diff=7967</id>
		<title>HIPC</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=HIPC&amp;diff=7967"/>
		<updated>2019-09-20T10:46:49Z</updated>

		<summary type="html">&lt;p&gt;PixelyIon: Corrects order of buffers to match that of their descriptions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== IPC Command Structure ==&lt;br /&gt;
This is an array of u32&#039;s, usually located in [[Thread Local Storage]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 15-0 || [[#Type|Type]].&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 19-16 || Number of buf X descriptors (each: 2 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 23-20 || Number of buf A descriptors (each: 3 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 27-24 || Number of buf B descriptors (each: 3 words).&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-28 || Number of buf W desciptors (each: 3 words), not observed&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 9-0 || Size of [[#Raw data section|raw data]] in u32s.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 13-10 || Flags for buf C descriptor.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 30-20 || Empty.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 31 || Enable handle descriptor.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Handle descriptor|Handle descriptor]], if enabled.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor X &amp;quot;Pointer&amp;quot;|Buf X descriptors]], each one 2 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf A descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf B descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot;|Buf W descriptors]], each one 3 words.&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Raw_data_section|Raw data section]] (including padding before and after aligned data section).&lt;br /&gt;
|-&lt;br /&gt;
| ... || || [[#Buffer descriptor C &amp;quot;ReceiveList&amp;quot;|Buf C descriptors]], each one 2 words.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First two header u32&#039;s and handle descriptor (if enabled) are copied as-is from one process to the other.&lt;br /&gt;
&lt;br /&gt;
=== Type ===&lt;br /&gt;
IPC commands can have different types which influence how the IPC server processes requests in &amp;quot;nn::sf::hipc::server::HipcServerSessionManagerBase::ProcessRequest&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Invalid&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#LegacyRequest, LegacyControl|LegacyRequest]]&lt;br /&gt;
|-&lt;br /&gt;
| 2 || [[#Close|Close]]&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [[#LegacyRequest, LegacyControl|LegacyControl]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 || [[#Request, Control|Request]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || [[#Request, Control|Control]]&lt;br /&gt;
|-&lt;br /&gt;
| 6 || [5.0.0+] [[#RequestWithContext, ControlWithContext|RequestWithContext]]&lt;br /&gt;
|-&lt;br /&gt;
| 7 || [5.0.0+] [[#RequestWithContext, ControlWithContext|ControlWithContext]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Close ====&lt;br /&gt;
When processing a request of this type, the IPC server calls:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::DestroyServerSession&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::CloseServerSessionHandle&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This ensures that the server session is destroyed internally and properly closed.&lt;br /&gt;
&lt;br /&gt;
==== LegacyRequest, LegacyControl ====&lt;br /&gt;
These types are handled by calling:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::detail::HipcMessageBufferAccessor::ParseHeader&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::ProcessMessage&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::Reply&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::RegisterServerSessionToWaitBase&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It is speculated that these are part of an older message processing system where headers were further partitioned.&lt;br /&gt;
&lt;br /&gt;
==== Request, Control ====&lt;br /&gt;
These types are handled by calling:&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::ProcessMessage2&amp;quot;&lt;br /&gt;
* &amp;quot;nn::sf::hipc::server::HipcServerSessionManager::RegisterServerSessionToWaitBase&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This represents a more modern message handling system where contents follow the general marshalling structure.&lt;br /&gt;
&lt;br /&gt;
==== RequestWithContext, ControlWithContext ====&lt;br /&gt;
These are identical to normal Request and Control types, but with the additional requirement of suppling a token in their [[#Data payload|data payload]].&lt;br /&gt;
&lt;br /&gt;
This token is used by &amp;quot;nn::sf::cmif::SetInlineContext&amp;quot; which has the sole purpose of saving it into the TLS in order for it to be distributed to any IPC commands that are made while processing the current command. It&#039;s unknown if this token serves any purpose or if it&#039;s just a debug-tool to figure out what IPC command caused a particular chain of commands.&lt;br /&gt;
&lt;br /&gt;
=== Handle descriptor ===&lt;br /&gt;
There can only be one of this descriptor type. It is enabled by bit31 of the second word.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || Send current PID.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 4-1 || Number of handles to copy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-5 || Number of handles to move&lt;br /&gt;
|-&lt;br /&gt;
| ... || || 8-byte PID if enabled&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Handles to copy&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Handles to move&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sysmodules load the last u64 of rawdata when handling the PID. This is not written by kernel. For sysmodule handling:&lt;br /&gt;
* In some cases: these commands require a placeholder u64 value passed in the input parameters, as mentioned above. In these cases the OverwriteClientProcessId method is called to replace the value before it is used.&lt;br /&gt;
* In other cases: The rawdata_u64 is compared with the PID from the descriptor. On mismatch and when rawdata_u64!=0, error 0x60A is returned. The PID value passed to the cmdhandler vtable funcptr is the rawdata_u64.&lt;br /&gt;
&lt;br /&gt;
Handle 0 is allowed, and just means no handle was sent.&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor X &amp;quot;Pointer&amp;quot; ===&lt;br /&gt;
This one is packed even worse than A, they inserted the bit38-36 of the address &#039;&#039;on top&#039;&#039; of the counter field.&lt;br /&gt;
&lt;br /&gt;
Officially, the counter is known as &amp;quot;receive index&amp;quot;. This one writes to the buffer described in the ReceiveList.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 5-0 || Bits 5-0 of counter.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-6 || Bit 38-36 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 11-9 || Bits 11-9 of counter.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 15-12 || Bit 35-32 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-16 || Size&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Lower 32-bits of address.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor A/B/W &amp;quot;Send&amp;quot;/&amp;quot;Receive&amp;quot;/&amp;quot;Exchange&amp;quot; ===&lt;br /&gt;
This packing is so unnecessarily complex.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || || Lower 32-bits of size.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Lower 32-bits of address.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1-0 || Flags. Always set to 0, 1 or 3.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4-2 || Bit 38-36 of address.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 27-24 || Bit 35-32 of size.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 31-28 || Bit 35-32 of address.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A reply must not use A/B/W, svcReplyAndReceive will return 0xE801.&lt;br /&gt;
&lt;br /&gt;
[[SVC|MemoryAttribute]] IsBorrowed and IsUncached are never allowed for the source address.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Send&amp;quot; means buffer is sent from source process into service process.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Receive&amp;quot; means that data is copied from service process into user process.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Exchange&amp;quot; means both &amp;quot;Send&amp;quot; and &amp;quot;Receive&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Flags ====&lt;br /&gt;
Determines what [[SVC|MemoryState]] to use with the mapped memory in the sysmodule.&lt;br /&gt;
&lt;br /&gt;
Used to enforce whether or not device mapping is allowed for src and dst buffers respectively.&lt;br /&gt;
 &lt;br /&gt;
* Ipc (flag=0): Device mapping *not* allowed for src or dst.&lt;br /&gt;
* NonSecureIpc (flag=1): Device mapping allowed for src and dst.&lt;br /&gt;
* NonDeviceIpc (flag=3): Device mapping allowed for src but not for dst.&lt;br /&gt;
&lt;br /&gt;
=== Buffer descriptor C &amp;quot;ReceiveList&amp;quot; ===&lt;br /&gt;
There&#039;s a 4-bit flag in the main header controlling the behavior of C descriptors.&lt;br /&gt;
&lt;br /&gt;
If it has value 0, the C descriptor functionality is disabled.&lt;br /&gt;
&lt;br /&gt;
If it has value 1, there is an &amp;quot;inlined&amp;quot; C buffer after the raw data. Received data is copied to ROUND_UP(cmdbuf+raw_size+index, 16)&lt;br /&gt;
&lt;br /&gt;
If it has value 2, there is a single C descriptor.&lt;br /&gt;
&lt;br /&gt;
Otherwise it has (flag-2) C descriptors. In this case, index picks which C descriptor to copy received data to [instead of picking the offset into the buffer].&lt;br /&gt;
&lt;br /&gt;
Data sent with this method must have MemoryState 0x4000000 mask set.&lt;br /&gt;
&lt;br /&gt;
After reply, X descriptors are written to the sender containing the address, size and index that were copied to.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || || Lower 32-bits of address.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 15-0 || Rest of address.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 31-16 || Size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== IPC buffers ===&lt;br /&gt;
Buffer descriptor A/B/... map memory into the sysmodule process. For the mapped memory in the sysmodule the permissions are: desc-A = R--, desc-B = RW-. The buffer is automatically unmapped while the kernel handles the cmdreply, the sysmodule doesn&#039;t need to specify anything in the cmdreply to trigger this.&lt;br /&gt;
&lt;br /&gt;
This memory is mapped in the sysmodule to the same vaddr from the original user-process cmd-request, except with with bits &amp;gt;=(~28(?)) changed to a different ASLR&#039;d region.&lt;br /&gt;
&lt;br /&gt;
No user-process-&amp;gt;sysmodule memcpy is done for outbufs, only sysmodule-&amp;gt;user-process.&lt;br /&gt;
&lt;br /&gt;
Buffer descriptors C/X are somewhat different. Rather than mapping new memory into the server process, C/X descriptors copy data between existing buffers in different processes. Each X descriptor in a message has its data copied into a C descriptor on the other side. Each C descriptor in a message is used to reserve space for the other side&#039;s X descriptors to copy into.&lt;br /&gt;
&lt;br /&gt;
When the kernel processes X descriptors, it must determine where to copy the data to. If the destination used C descriptors with flags &amp;gt;= 3, each X descriptor from the source is matched to a C descriptor in the destination by the X descriptor&#039;s index field. If the destination used a &amp;quot;single&amp;quot; C descriptor, the data from all the X descriptors is copied into the same buffer specified by the destination&#039;s C descriptor (causing error 0xce01 if there is not enough space) and the X descriptor index is ignored. The kernel then modifies the addresses in the X descriptors to indicate where the data was copied to in the destination.&lt;br /&gt;
&lt;br /&gt;
Before receiving a request, if the IPC server is expecting X descriptors, it prepares a message with a &amp;quot;single&amp;quot; C descriptor (flags=2) in its message buffer before calling svcReplyAndReceive so that X descriptors from the client have a place to copy their data to.  The usage of the flag-2 C descriptor allows the server to receive an arbitrary number of X descriptors, since they&#039;re all packed into the same buffer. If the server had used flag-3+ C descriptors, it would be limited in how many X descriptors it could receive since the X descriptors would have to be matched to distinct C descriptors. The buffer that the server&#039;s C descriptor points to is called the &#039;&#039;&#039;pointer buffer&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When the client sends X descriptors, data is copied into the server&#039;s pointer buffer. When the client sends C descriptors, no data is copied automatically. The server needs to use X descriptors to copy the data back to the client&#039;s C descriptors (using the index field to match X descriptors in the response back to the correct C descriptors).&lt;br /&gt;
&lt;br /&gt;
== Raw data section ==&lt;br /&gt;
[[File:Ipc msg buffer type a example.png|thumb|An example of an IPC message with a type 0xA buffer in it. Red is headers/descriptors, yellow is padding, and blue is data/buffer lengths. Note that the size of the u16 array for type A lengths is padded to fill up a whole word.]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Description&lt;br /&gt;
|-&lt;br /&gt;
| ... || Padding to align to 16 bytes.&lt;br /&gt;
|-&lt;br /&gt;
| ... || If sent to an object domain, a [[#Domain_message|domain message]], otherwise a [[#Data payload|data payload]]&lt;br /&gt;
|-&lt;br /&gt;
| ... || Padding&lt;br /&gt;
|-&lt;br /&gt;
| ... || Buffer type 0xA lengths (u16 array)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The total amount of padding within the raw data section is always 0x10 bytes. This means that if no padding is required before the message, there will be 0x10 bytes of padding after the message (before the buffer type 0xA lengths).&lt;br /&gt;
&lt;br /&gt;
=== Domains ===&lt;br /&gt;
Because the switch has relatively low limits on the total number of sessions available to the system (Kernel slabheap limits, sysmodule handle table size limits), HIPC supports a &amp;quot;Domains&amp;quot; feature that allows multiplexing multiple service sessions through a single handle. Domains store (effectively) a mapping from u32 object id to a SharedPointer&amp;lt;IServiceObject&amp;gt; -- When messages are sent to a domain, an extra header is sent in the raw data section (before anything else) with information about what object in the domain is being acted on; responses similarly contain an additional header. Official session code implements this by just using the dispatch table for the object in the map with the appropriate ID, instead of the dispatch table the session was initialized with.&lt;br /&gt;
&lt;br /&gt;
Format for the extra request header for domain message:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 7-0 || Command. 1=send message, 2=close virtual handle&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 8-15 || Input object count&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-16 || Length of [[IPC_Marshalling#Data_payload|data payload]] in bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || || Object ID (from cmd 0 in [[IPC_Marshalling#Control|Control]]).&lt;br /&gt;
|-&lt;br /&gt;
| 2 || || Padding&lt;br /&gt;
|-&lt;br /&gt;
| 3 || || [1.0.0-4.1.0] Padding [5.0.0+] Token for (NewRequest only)&lt;br /&gt;
|-&lt;br /&gt;
| 4... || || [[#Data payload|Data payload]]&lt;br /&gt;
|-&lt;br /&gt;
| ... || || Input object IDs (u32s, not aligned)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Format for the extra response header for domain message:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Bits || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 31-0 || Output object count&lt;br /&gt;
|-&lt;br /&gt;
| 1-3 || || Padding&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Data payload ===&lt;br /&gt;
This is an array of u32&#039;s, but individual parameters are generally stored as u64&#039;s.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Word || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Magic (&amp;quot;SFCI&amp;quot; for requests, &amp;quot;SFCO&amp;quot; for responses) as u32.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Version as u32. 1 for NewRequest, 0 for Request.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Command id as u64 for requests, [[Error_codes|error code]] as u64 for responses.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || [1.0.0-4.1.0] Padding [5.0.0+] Token (for NewRequest only, non-domain messages).&lt;br /&gt;
|-&lt;br /&gt;
| 4... || Input parameters or return values&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[5.0.0+] Version was incremented from 0 to 1, and a token value was introduced into raw_data+12 (regardless of domain or not, in either case it overlaps with padding).&lt;br /&gt;
&lt;br /&gt;
The input rawdata struct is generated by stable-sorting function parameters by alignment, from low to high. It is likely this is a mistake, as it generates structs with suboptimal possible padding -- Nintendo probably meant to sort from high to low (which would give minimized padding), but couldn&#039;t/can&#039;t change this without breaking backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
== Official marshalling code ==&lt;br /&gt;
The official marshalling function is called &amp;quot;nn::sf::hipc::client::Hipc2ClientCoreProcessorImpl::WriteBufferDataImpl&amp;quot; and takes:&lt;br /&gt;
* A pointer to a &amp;quot;nn::sf::hipc::detail::HipcMessageWriter&amp;quot; context;&lt;br /&gt;
* The number of (buf_ptr, size) pairs;&lt;br /&gt;
* An array of (buf_ptr, size) pairs (called &amp;quot;nn::sf::detail::PointerAndSize&amp;quot;);&lt;br /&gt;
* A pointer to a type bitfield for each such pair;&lt;br /&gt;
* The offset of the main IPC command structure;&lt;br /&gt;
* The size of the IPC command&#039;s [[IPC_Marshalling#Raw_data_section|raw data]].&lt;br /&gt;
&lt;br /&gt;
The type of an IPC command is described by a bitfield as below:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Bits || Name || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || In || Direction is input.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Out || Direction is output.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || HipcMapAlias || Use buffer descriptors A (&amp;quot;Send&amp;quot;), B (&amp;quot;Receive&amp;quot;) or W (&amp;quot;Exchange&amp;quot;).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || HipcPointer || Use buffer descriptors X (&amp;quot;Pointer&amp;quot;) or C (&amp;quot;ReceiveList&amp;quot;).&lt;br /&gt;
|-&lt;br /&gt;
| 4 || FixedSize || Skip saving the pointer buffer size in raw data.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || HipcAutoSelect || Select which buffer descriptor to use automatically.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || HipcMapTransferAllowsNonSecure || Use [[#Flags|NonSecureIpc flag]].&lt;br /&gt;
|-&lt;br /&gt;
| 7 || HipcMapTransferAllowsNonDevice || Use [[#Flags|NonDeviceIpc flag]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
X and C (Pointer and ReceiveList) descriptors are backed by the &amp;quot;pointer buffer&amp;quot;, a buffer in the service process. Its size is a u16, which is retrieved using the &amp;quot;QueryPointerBufferSize&amp;quot; control message. If the client code determines all buffers with flag 8 do not fit in the pointer buffer, it returns error 0x11A0B.&lt;br /&gt;
&lt;br /&gt;
For buffers with flag 0x20 it creates two descriptors (A+X or B+C), but one descriptor is NULL (zero size and pointer), while the other holds the expected values. X/C descriptors are used as the non-NULL descriptor where possible, but if they don&#039;t fit in the pointer buffer, A/B descriptors are used instead. The code defers processing of type 0x20 buffers with sizes that fit in a u16 (and may therefore fit in the pointer buffer), which ensures all type 8 buffers get pointer-buffer space before any type 0x20. The order in which the deferred type 0x20 buffers are processed is determined by a convoluted loop.&lt;br /&gt;
&lt;br /&gt;
== Official IPC Cmd Structure ==&lt;br /&gt;
Official struct that is stored for each IPC command. It contains precalculated offsets for different portions of the command structure.&lt;br /&gt;
&lt;br /&gt;
All offsets are given is in number of u32 words.&lt;br /&gt;
&lt;br /&gt;
 struct IpcCmdStruct {&lt;br /&gt;
   u8  unk0;&lt;br /&gt;
   u8  has_handle_descriptor;&lt;br /&gt;
   u8  pad0[2];&lt;br /&gt;
   u32 cmd0;&lt;br /&gt;
   u32 cmd1;&lt;br /&gt;
   u32 offset_handle_descriptor;&lt;br /&gt;
   u32 pad1;&lt;br /&gt;
   u32 offset_handles;          &lt;br /&gt;
   u32 pad2;&lt;br /&gt;
   u32 offset_x_descriptors;&lt;br /&gt;
   u32 offset_a_descriptors;&lt;br /&gt;
   u32 offset_b_descriptors;&lt;br /&gt;
   u32 offset_w_descriptors; /* this is a guess */&lt;br /&gt;
   u32 offset_raw_data;&lt;br /&gt;
   u32 offset_c_descriptors;&lt;br /&gt;
   u32 unk2;&lt;br /&gt;
   u32 unk3;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Control ==&lt;br /&gt;
When type is [[IPC_Marshalling#Request.2C_Control|Control]], you are talking to the IPC manager. These are processed by the sysmodule.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name || Arguments || Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || ConvertCurrentObjectToDomain || None || u32 CmifDomainObjectId&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CopyFromCurrentDomain || u32 CmifDomainObjectId || u32 NativeHandle&lt;br /&gt;
|-&lt;br /&gt;
| 2 || CloneCurrentObject || None || u32 NativeHandle&lt;br /&gt;
|-&lt;br /&gt;
| 3 || QueryPointerBufferSize || None || u16 size&lt;br /&gt;
|-&lt;br /&gt;
| 4 || CloneCurrentObjectEx || u32 unknown || u32 NativeHandle&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>PixelyIon</name></author>
	</entry>
</feed>