SVC: Difference between revisions
| (42 intermediate revisions by 8 users not shown) | |||
| Line 3: | Line 3: | ||
= System calls = | = System calls = | ||
{| class=wikitable | {| class=wikitable | ||
! | ! ID || Return Type || Name || Arguments | ||
|- | |- | ||
| | | 0x01 || Result || [[#SetHeapSize|SetHeapSize]] || uintptr_t *out_address, size_t size | ||
|- | |- | ||
| | | 0x02 || Result || [[#SetMemoryPermission|SetMemoryPermission]] || uintptr_t address, size_t size, MemoryPermission perm | ||
|- | |- | ||
| | | 0x03 || Result || [[#SetMemoryAttribute|SetMemoryAttribute]] || uintptr_t address, size_t size, uint32_t mask, uint32_t attr | ||
|- | |- | ||
| | | 0x04 || Result || [[#MapMemory|MapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size | ||
|- | |- | ||
| | | 0x05 || Result || [[#UnmapMemory|UnmapMemory]] || uintptr_t dst_address, uintptr_t src_address, size_t size | ||
|- | |- | ||
| | | 0x06 || Result || [[#QueryMemory|QueryMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, uintptr_t address | ||
|- | |- | ||
| | | 0x07 || void || [[#ExitProcess|ExitProcess]] || | ||
|- | |- | ||
| | | 0x08 || Result || [[#CreateThread|CreateThread]] || Handle *out_handle, ThreadFunc func, uintptr_t arg, uintptr_t stack_bottom, int32_t priority, int32_t core_id | ||
|- | |- | ||
| | | 0x09 || Result || [[#StartThread|StartThread]] || Handle thread_handle | ||
|- | |- | ||
| | | 0x0A || void || [[#ExitThread|ExitThread]] || | ||
|- | |- | ||
| | | 0x0B || void || [[#SleepThread|SleepThread]] || int64_t ns | ||
|- | |- | ||
| | | 0x0C || Result || [[#GetThreadPriority|GetThreadPriority]] || int32_t *out_priority, Handle thread_handle | ||
|- | |- | ||
| | | 0x0D || Result || [[#SetThreadPriority|SetThreadPriority]] || Handle thread_handle, int32_t priority | ||
|- | |- | ||
| | | 0x0E || Result || [[#GetThreadCoreMask|GetThreadCoreMask]] || int32_t *out_core_id, uint64_t *out_affinity_mask, Handle thread_handle | ||
|- | |- | ||
| | | 0x0F || Result || [[#SetThreadCoreMask|SetThreadCoreMask]] || Handle thread_handle, int32_t core_id, uint64_t affinity_mask | ||
|- | |- | ||
| 0x10 || [[#GetCurrentProcessorNumber]] | | 0x10 || int32_t || [[#GetCurrentProcessorNumber|GetCurrentProcessorNumber]] || | ||
|- | |- | ||
| 0x11 || [[#SignalEvent]] || | | 0x11 || Result || [[#SignalEvent|SignalEvent]] || Handle event_handle | ||
|- | |- | ||
| 0x12 || [[#ClearEvent]] || | | 0x12 || Result || [[#ClearEvent|ClearEvent]] || Handle event_handle | ||
|- | |- | ||
| 0x13 || [[#MapSharedMemory]] || | | 0x13 || Result || [[#MapSharedMemory|MapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size, MemoryPermission map_perm | ||
|- | |- | ||
| 0x14 || [[#UnmapSharedMemory]] || | | 0x14 || Result || [[#UnmapSharedMemory|UnmapSharedMemory]] || Handle shmem_handle, uintptr_t address, size_t size | ||
|- | |- | ||
| 0x15 || [[#CreateTransferMemory]] || | | 0x15 || Result || [[#CreateTransferMemory|CreateTransferMemory]] || Handle *out_handle, uintptr_t address, size_t size, MemoryPermission map_perm | ||
|- | |- | ||
| 0x16 || [[#CloseHandle]] || | | 0x16 || Result || [[#CloseHandle|CloseHandle]] || Handle handle | ||
|- | |- | ||
| 0x17 || [[#ResetSignal]] || | | 0x17 || Result || [[#ResetSignal|ResetSignal]] || Handle handle | ||
|- | |- | ||
| 0x18 || [[#WaitSynchronization]] || | | 0x18 || Result || [[#WaitSynchronization|WaitSynchronization]] || int32_t *out_index, const Handle *handles, int32_t numHandles, int64_t timeout_ns | ||
|- | |- | ||
| 0x19 || [[#CancelSynchronization]] || | | 0x19 || Result || [[#CancelSynchronization|CancelSynchronization]] || Handle handle | ||
|- | |- | ||
| 0x1A || [[#ArbitrateLock]] || | | 0x1A || Result || [[#ArbitrateLock|ArbitrateLock]] || Handle thread_handle, uintptr_t address, uint32_t tag | ||
|- | |- | ||
| 0x1B || [[#ArbitrateUnlock]] || | | 0x1B || Result || [[#ArbitrateUnlock|ArbitrateUnlock]] || uintptr_t address | ||
|- | |- | ||
| 0x1C || [[#WaitProcessWideKeyAtomic]] || | | 0x1C || Result || [[#WaitProcessWideKeyAtomic|WaitProcessWideKeyAtomic]] || uintptr_t address, uintptr_t cv_key, uint32_t tag, int64_t timeout_ns | ||
|- | |- | ||
| 0x1D || [[#SignalProcessWideKey]] || | | 0x1D || void || [[#SignalProcessWideKey|SignalProcessWideKey]] || uintptr_t cv_key, int32_t count | ||
|- | |- | ||
| 0x1E || [[#GetSystemTick]] | | 0x1E || int64_t || [[#GetSystemTick|GetSystemTick]] || | ||
|- | |- | ||
| 0x1F || [[#ConnectToNamedPort]] || | | 0x1F || Result || [[#ConnectToNamedPort|ConnectToNamedPort]] || Handle *out_handle, const char *name | ||
|- | |- | ||
| 0x20 || [[#SendSyncRequestLight]] || | | 0x20 || Result || [[#SendSyncRequestLight|SendSyncRequestLight]] || Handle session_handle | ||
|- | |- | ||
| 0x21 || [[#SendSyncRequest]] || | | 0x21 || Result || [[#SendSyncRequest|SendSyncRequest]] || Handle session_handle | ||
|- | |- | ||
| 0x22 || [[#SendSyncRequestWithUserBuffer]] || | | 0x22 || Result || [[#SendSyncRequestWithUserBuffer|SendSyncRequestWithUserBuffer]] || uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle | ||
|- | |- | ||
| 0x23 || [[#SendAsyncRequestWithUserBuffer]] || | | 0x23 || Result || [[#SendAsyncRequestWithUserBuffer|SendAsyncRequestWithUserBuffer]] || Handle *out_event_handle, uintptr_t message_buffer, size_t message_buffer_size, Handle session_handle | ||
|- | |- | ||
| 0x24 || [[#GetProcessId]] || | | 0x24 || Result || [[#GetProcessId|GetProcessId]] || uint64_t *out_process_id, Handle process_handle | ||
|- | |- | ||
| 0x25 || [[#GetThreadId]] || | | 0x25 || Result || [[#GetThreadId|GetThreadId]] || uint64_t *out_thread_id, Handle thread_handle | ||
|- | |- | ||
| 0x26 || [[#Break]] || | | 0x26 || void || [[#Break|Break]] || BreakReason break_reason, uintptr_t arg, size_t size | ||
|- | |- | ||
| 0x27 || [[#OutputDebugString]] || | | 0x27 || Result || [[#OutputDebugString|OutputDebugString]] || const char *debug_str, size_t len | ||
|- | |- | ||
| 0x28 || [[#ReturnFromException]] || | | 0x28 || void || [[#ReturnFromException|ReturnFromException]] || Result result | ||
|- | |- | ||
| 0x29 || [[#GetInfo]] || | | 0x29 || Result || [[#GetInfo|GetInfo]] || uint64_t *out, InfoType info_type, Handle handle, uint64_t info_subtype | ||
|- | |- | ||
| 0x2A || [[#FlushEntireDataCache]] | | 0x2A || void || [[#FlushEntireDataCache|FlushEntireDataCache]] || | ||
|- | |- | ||
| 0x2B || [[#FlushDataCache]] || | | 0x2B || Result || [[#FlushDataCache|FlushDataCache]] || uintptr_t address, size_t size | ||
|- | |- | ||
| [3.0.0+] 0x2C || Result || [[#MapPhysicalMemory|MapPhysicalMemory]] || uintptr_t address, size_t size | |||
|- | |- | ||
| [3.0.0+] 0x2D || Result || [[#UnmapPhysicalMemory|UnmapPhysicalMemory]] || uintptr_t address, size_t size | |||
|- | |- | ||
| [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 | |||
|- | |- | ||
| | | [6.0.0+] 0x2E || Result || [[#GetDebugFutureThreadInfo|GetDebugFutureThreadInfo]] || arch::LastThreadContext *out_context, uint64_t *thread_id, Handle debug_handle, int64_t ns | ||
|- | |- | ||
| | | 0x2F || Result || [[#GetLastThreadInfo|GetLastThreadInfo]] || arch::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags | ||
|- | |- | ||
| | | 0x30 || Result || [[#GetResourceLimitLimitValue|GetResourceLimitLimitValue]] || int64_t *out_limit_value, Handle resource_limit_handle, LimitableResource which | ||
|- | |- | ||
| | | 0x31 || Result || [[#GetResourceLimitCurrentValue|GetResourceLimitCurrentValue]] || int64_t *out_current_value, Handle resource_limit_handle, LimitableResource which | ||
|- | |- | ||
| | | 0x32 || Result || [[#SetThreadActivity|SetThreadActivity]] || Handle thread_handle, ThreadActivity thread_activity | ||
|- | |- | ||
| | | 0x33 || Result || [[#GetThreadContext3|GetThreadContext3]] || ThreadContext *out_context, Handle thread_handle | ||
|- | |- | ||
| [4.0.0+] 0x34 || Result || [[#WaitForAddress|WaitForAddress]] || uintptr_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns | |||
|- | |- | ||
| | | [4.0.0+] 0x35 || Result || [[#SignalToAddress|SignalToAddress]] || uintptr_t address, SignalType signal_type, int32_t value, int32_t count | ||
|- | |||
| [8.0.0+] 0x36 || void || [[#SynchronizePreemptionState|SynchronizePreemptionState]] || | |||
|- | |||
| [11.0.0+] 0x37 || Result || [[#GetResourceLimitPeakValue|GetResourceLimitPeakValue]] || int64_t *out_peak_value, Handle resource_limit_handle, LimitableResource which | |||
|- style="border-top: double" | |- style="border-top: double" | ||
| [13.0.0+] 0x39 || Result || CreateIoPool || Handle *out_handle, IoPoolType which_pool | |||
|- | |- | ||
| [13.0.0+] 0x3A || Result || CreateIoRegion || Handle *out_handle, Handle io_pool, PhysicalAddress physical_address, size_t size, MemoryMapping mapping, MemoryPermission perm | |||
|- style="border-top: double" | |- style="border-top: double" | ||
| 0x40 || [[#CreateSession]] || || | | [1.0.0-3.0.2] 0x3C || void || [[#DumpInfo|DumpInfo]] || DumpInfoType dump_info_type, uint64_t arg | ||
|- | |||
| [4.0.0+] 0x3C || void || [[#KernelDebug|KernelDebug]] || KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2 | |||
|- | |||
| [4.0.0+] 0x3D || void || [[#ChangeKernelTraceState|ChangeKernelTraceState]] || KernelTraceState kern_trace_state | |||
|- style="border-top: double" | |||
| 0x40 || Result || [[#CreateSession|CreateSession]] || Handle *out_server_session_handle, Handle *out_client_session_handle, bool is_light, uintptr_t name | |||
|- | |||
| 0x41 || Result || [[#AcceptSession|AcceptSession]] || Handle *out_handle, Handle port | |||
|- | |||
| 0x42 || Result || [[#ReplyAndReceiveLight|ReplyAndReceiveLight]] || Handle handle | |||
|- | |||
| 0x43 || Result || [[#ReplyAndReceive|ReplyAndReceive]] || int32_t *out_index, const Handle *handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns | |||
|- | |||
| 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 | |||
|- | |- | ||
| | | 0x45 || Result || [[#CreateEvent|CreateEvent]] || Handle *out_write_handle, Handle *out_read_handle | ||
|- | |- | ||
| | | [13.0.0+] 0x46 || Result || MapIoRegion || Handle io_region, uintptr_t address, size_t size, MemoryPermission perm | ||
|- | |- | ||
| | | [13.0.0+] 0x47 || Result || UnmapIoRegion || Handle io_region, uintptr_t address, size_t size | ||
|- | |- | ||
| | | [5.0.0+] 0x48 || Result || [[#MapPhysicalMemoryUnsafe|MapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size | ||
|- | |- | ||
| [5.0.0+] 0x49 || Result || [[#UnmapPhysicalMemoryUnsafe|UnmapPhysicalMemoryUnsafe]] || uintptr_t address, size_t size | |||
|- | |- | ||
| [5.0.0+] 0x4A || Result || [[#SetUnsafeLimit|SetUnsafeLimit]] || size_t limit | |||
|- | |- | ||
| [4.0.0+] 0x4B || Result || [[#CreateCodeMemory|CreateCodeMemory]] || Handle *out_handle, uintptr_t address, size_t size | |||
|- | |- | ||
| [4.0.0+] 0x4C || Result || [[#ControlCodeMemory|ControlCodeMemory]] || Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm | |||
|- | |- | ||
| | | 0x4D || void || [[#SleepSystem|SleepSystem]] || | ||
|- | |- | ||
| | | 0x4E || Result || [[#ReadWriteRegister|ReadWriteRegister]] || uint32_t *out_value, PhysicalAddress address, uint32_t mask, uint32_t value | ||
|- | |- | ||
| | | 0x4F || Result || [[#SetProcessActivity|SetProcessActivity]] || Handle process_handle, ProcessActivity process_activity | ||
|- | |- | ||
| | | 0x50 || Result || [[#CreateSharedMemory|CreateSharedMemory]] || Handle *out_handle, size_t size, MemoryPermission owner_perm, MemoryPermission remote_perm | ||
|- | |- | ||
| | | 0x51 || Result || [[#MapTransferMemory|MapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size, MemoryPermission owner_perm | ||
|- | |- | ||
| | | 0x52 || Result || [[#UnmapTransferMemory|UnmapTransferMemory]] || Handle trmem_handle, uintptr_t address, size_t size | ||
|- | |- | ||
| | | 0x53 || Result || [[#CreateInterruptEvent|CreateInterruptEvent]] || Handle *out_read_handle, int32_t interrupt_id, InterruptType interrupt_type | ||
|- | |- | ||
| | | 0x54 || Result || [[#QueryPhysicalAddress|QueryPhysicalAddress]] || arch::PhysicalMemoryInfo *out_info, uintptr_t address | ||
|- | |- | ||
| | | [1.0.0-9.2.0] 0x55 || Result || [[#QueryIoMapping|QueryIoMapping]] || uintptr_t *out_address, PhysicalAddress physical_address, size_t size | ||
|- | |- | ||
| 0x55 || | | [10.0.0+] 0x55 || Result || QueryMemoryMapping || uintptr_t *out_address, size_t *out_size, PhysicalAddress physical_address, size_t size | ||
|- | |- | ||
| 0x56 || [[#CreateDeviceAddressSpace]] || | | 0x56 || Result || [[#CreateDeviceAddressSpace|CreateDeviceAddressSpace]] || Handle *out_handle, uint64_t das_address, uint64_t das_size | ||
|- | |- | ||
| 0x57 || [[#AttachDeviceAddressSpace]] || | | 0x57 || Result || [[#AttachDeviceAddressSpace|AttachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle | ||
|- | |- | ||
| 0x58 || [[#DetachDeviceAddressSpace]] || | | 0x58 || Result || [[#DetachDeviceAddressSpace|DetachDeviceAddressSpace]] || DeviceName device_name, Handle das_handle | ||
|- | |- | ||
| 0x59 || [[#MapDeviceAddressSpaceByForce]] || | | 0x59 || Result || [[#MapDeviceAddressSpaceByForce|MapDeviceAddressSpaceByForce]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, uint32_t option | ||
|- | |- | ||
| 0x5A || [[#MapDeviceAddressSpaceAligned]] || | | 0x5A || Result || [[#MapDeviceAddressSpaceAligned|MapDeviceAddressSpaceAligned]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, uint32_t option | ||
|- | |- | ||
| 0x5B || [[#MapDeviceAddressSpace]] || | | [1.0.0-12.1.0] 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 | ||
|- | |- | ||
| 0x5C || [[#UnmapDeviceAddressSpace]] || | | 0x5C || Result || [[#UnmapDeviceAddressSpace|UnmapDeviceAddressSpace]] || Handle das_handle, Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address | ||
|- | |- | ||
| 0x5D || [[#InvalidateProcessDataCache]] || | | 0x5D || Result || [[#InvalidateProcessDataCache|InvalidateProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size | ||
|- | |- | ||
| 0x5E || [[#StoreProcessDataCache]] || | | 0x5E || Result || [[#StoreProcessDataCache|StoreProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size | ||
|- | |- | ||
| 0x5F || [[#FlushProcessDataCache]] || | | 0x5F || Result || [[#FlushProcessDataCache|FlushProcessDataCache]] || Handle process_handle, uint64_t address, uint64_t size | ||
|- | |- | ||
| 0x60 || [[#DebugActiveProcess]] || | | 0x60 || Result || [[#DebugActiveProcess|DebugActiveProcess]] || Handle *out_handle, uint64_t process_id | ||
|- | |- | ||
| 0x61 || [[#BreakDebugProcess]] || | | 0x61 || Result || [[#BreakDebugProcess|BreakDebugProcess]] || Handle debug_handle | ||
|- | |- | ||
| 0x62 || [[#TerminateDebugProcess]] || | | 0x62 || Result || [[#TerminateDebugProcess|TerminateDebugProcess]] || Handle debug_handle | ||
|- | |- | ||
| 0x63 || [[#GetDebugEvent]] || | | 0x63 || Result || [[#GetDebugEvent|GetDebugEvent]] || arch::DebugEventInfo *out_info, Handle debug_handle | ||
|- | |- | ||
| 0x64 || [[#ContinueDebugEvent]] || | | 0x64 || Result || [[#ContinueDebugEvent|ContinueDebugEvent]] || Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids | ||
|- | |- | ||
| 0x65 || [[#GetProcessList]] || | | 0x65 || Result || [[#GetProcessList|GetProcessList]] || int32_t *out_num_processes, uint64_t *out_process_ids, int32_t max_out_count | ||
|- | |- | ||
| 0x66 || [[#GetThreadList]] || | | 0x66 || Result || [[#GetThreadList|GetThreadList]] || int32_t *out_num_threads, uint64_t *out_thread_ids, int32_t max_out_count, Handle debug_handle | ||
|- | |- | ||
| 0x67 || [[#GetDebugThreadContext]] || | | 0x67 || Result || [[#GetDebugThreadContext|GetDebugThreadContext]] || ThreadContext *out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags | ||
|- | |- | ||
| 0x68 || [[#SetDebugThreadContext]] || | | 0x68 || Result || [[#SetDebugThreadContext|SetDebugThreadContext]] || Handle debug_handle, uint64_t thread_id, const ThreadContext *context, uint32_t context_flags | ||
|- | |- | ||
| 0x69 || [[#QueryDebugProcessMemory]] || | | 0x69 || Result || [[#QueryDebugProcessMemory|QueryDebugProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uintptr_t address | ||
|- | |- | ||
| 0x6A || [[#ReadDebugProcessMemory]] || | | 0x6A || Result || [[#ReadDebugProcessMemory|ReadDebugProcessMemory]] || uintptr_t buffer, Handle debug_handle, uintptr_t address, size_t size | ||
|- | |- | ||
| 0x6B || [[#WriteDebugProcessMemory]] || | | 0x6B || Result || [[#WriteDebugProcessMemory|WriteDebugProcessMemory]] || Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size | ||
|- | |- | ||
| 0x6C || [[#SetHardwareBreakPoint]] || | | 0x6C || Result || [[#SetHardwareBreakPoint|SetHardwareBreakPoint]] || HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value | ||
|- | |- | ||
| 0x6D || [[#GetDebugThreadParam]] || | | 0x6D || Result || [[#GetDebugThreadParam|GetDebugThreadParam]] || uint64_t *out_64, uint32_t *out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param | ||
|- style="border-top: double" | |- style="border-top: double" | ||
| [5.0.0+] 0x6F || Result || [[#GetSystemInfo|GetSystemInfo]] || uint64_t *out, SystemInfoType info_type, Handle handle, uint64_t info_subtype | |||
|- | |- | ||
| 0x70 || CreatePort || | | 0x70 || Result || [[#CreatePort|CreatePort]] || Handle *out_server_handle, Handle *out_client_handle, int32_t max_sessions, bool is_light, uintptr_t name | ||
|- | |- | ||
| 0x71 || ManageNamedPort || | | 0x71 || Result || [[#ManageNamedPort|ManageNamedPort]] || Handle *out_server_handle, const char *name, int32_t max_sessions | ||
|- | |- | ||
| 0x72 || ConnectToPort | | | 0x72 || Result || [[#ConnectToPort|ConnectToPort]] || Handle *out_handle, Handle port | ||
|- | |- | ||
| 0x73 || [[#SetProcessMemoryPermission]] || | | 0x73 || Result || [[#SetProcessMemoryPermission|SetProcessMemoryPermission]] || Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm | ||
|- | |- | ||
| 0x74 || [[#MapProcessMemory]] || | | 0x74 || Result || [[#MapProcessMemory|MapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size | ||
|- | |- | ||
| 0x75 || [[#UnmapProcessMemory]] || | | 0x75 || Result || [[#UnmapProcessMemory|UnmapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size | ||
|- | |- | ||
| 0x76 || [[#QueryProcessMemory]] || | | 0x76 || Result || [[#QueryProcessMemory|QueryProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uint64_t address | ||
|- | |- | ||
| 0x77 || [[#MapProcessCodeMemory]] || | | 0x77 || Result || [[#MapProcessCodeMemory|MapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size | ||
|- | |- | ||
| 0x78 || [[#UnmapProcessCodeMemory]] || | | 0x78 || Result || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size | ||
|- | |- | ||
| 0x79 || [[#CreateProcess]] || | | 0x79 || Result || [[#CreateProcess|CreateProcess]] || Handle *out_handle, const arch::CreateProcessParameter *parameters, const uint32_t *caps, int32_t num_caps | ||
|- | |- | ||
| 0x7A || StartProcess || | | 0x7A || Result || [[#StartProcess|StartProcess]] || Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size | ||
|- | |- | ||
| 0x7B || TerminateProcess || | | 0x7B || Result || [[#TerminateProcess|TerminateProcess]] || Handle process_handle | ||
|- | |- | ||
| 0x7C || [[#GetProcessInfo]] || | | 0x7C || Result || [[#GetProcessInfo|GetProcessInfo]] || int64_t *out_info, Handle process_handle, ProcessInfoType info_type | ||
|- | |- | ||
| 0x7D || CreateResourceLimit | | | 0x7D || Result || [[#CreateResourceLimit|CreateResourceLimit]] || Handle *out_handle | ||
|- | |- | ||
| 0x7E || SetResourceLimitLimitValue || | | 0x7E || Result || [[#SetResourceLimitLimitValue|SetResourceLimitLimitValue]] || Handle resource_limit_handle, LimitableResource which, int64_t limit_value | ||
|- | |||
|| | | 0x7F || void || [[#CallSecureMonitor|CallSecureMonitor]] || SecureMonitorArguments *args | ||
|- | |||
| [S2] 0x80 || Result || SetGpuMemoryAttribute || uintptr_t address, size_t size, uint32_t mask, uint32_t attr | |||
|- | |||
| [S2] 0x81 || Result || LockGpuSharableMemory || PhysicalMemoryInfo* info_out, Handle process_handle, uintptr_t address, size_t size | |||
|- | |||
| [S2] 0x80 || Result || UnlockGpuSharableMemory || Handle process_handle, uintptr_t address, size_t size | |||
|- style="border-top: double" | |||
| [15.0.0+] 0x90 || Result || MapInsecurePhysicalMemory || uintptr_t address, size_t size | |||
|- | |||
| [15.0.0+] 0x91 || Result || UnmapInsecurePhysicalMemory || uintptr_t address, size_t size | |||
|- | |- | ||
|} | |} | ||
| Line 270: | Line 273: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || | | (Out) X1 || void* || HeapAddress | ||
|} | |} | ||
</div> | </div> | ||
| Line 282: | Line 285: | ||
Size must be a multiple of 0x200000 (2MB). | Size must be a multiple of 0x200000 (2MB). | ||
On success, the heap base-address (which is fixed by kernel, aslr'd, and always in the Heap memory region) is written to | On success, the heap base-address (which is fixed by kernel, aslr'd, and always in the Heap memory region) is written to HeapAddress. | ||
Uses current process pool partition. The memory allocated counts towards the caller's process Memory ResourceLimit. | Uses current process pool partition. The memory allocated counts towards the caller's process Memory ResourceLimit. | ||
| Line 307: | Line 310: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (In) W2 || [[# | | (In) W2 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 334: | Line 337: | ||
'''0xD801:''' Invalid permission specified. Valid permissions are ---, r-- and rw-. | '''0xD801:''' Invalid permission specified. Valid permissions are ---, r-- and rw-. | ||
'''0xD401:''' The provided memory region was in an invalid state. The region must have the | '''0xD401:''' 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. | ||
'''0xCE01:''' Kernel resource exhausted. | '''0xCE01:''' Kernel resource exhausted. | ||
| Line 344: | Line 347: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (In) W2 || | | (In) W2 || uint32_t || Mask | ||
|- | |- | ||
| (In) W3 || | | (In) W3 || uint32_t || Value | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 356: | Line 359: | ||
</div> | </div> | ||
Changes attribute of page-aligned memory region. | 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. | ||
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU. | This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU. | ||
What happens "under the hood" is the "Memory Attribute Indirection Register" index is changed from 2 to 3 in the MMU descriptor. | What happens "under the hood" is the "Memory Attribute Indirection Register" index is changed from 2 to 3 in the MMU descriptor. | ||
== MapMemory == | == MapMemory == | ||
| Line 378: | Line 371: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || DstAddress | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || SrcAddress | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 410: | Line 403: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || DstAddress | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || SrcAddress | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 432: | Line 425: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || [[#MemoryInfo]]* || | | (In) X0 || [[#MemoryInfo]]* || MemoryInfo | ||
|- | |- | ||
| (In) X2 || void* || | | (In) X2 || void* || Address | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || PageInfo || PageInfo | | (Out) W1 || [[#PageInfo]] || PageInfo | ||
|} | |} | ||
</div> | </div> | ||
| Line 472: | Line 465: | ||
| (In) X3 || R3 || void* || StackTop | | (In) X3 || R3 || void* || StackTop | ||
|- | |- | ||
| (In) W4 || R0 || | | (In) W4 || R0 || int32_t || Priority | ||
|- | |- | ||
| (In) W5 || R4 || | | (In) W5 || R4 || int32_t || ProcessorId | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || Handle<Thread> || | | (Out) W1 || R1 || Handle<Thread> || ThreadHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 484: | Line 477: | ||
Creates a thread in the current process. | Creates a thread in the current process. | ||
ProcessorId must be 0,1,2,3 or -2, where -2 uses the default CpuId for process. | |||
== StartThread == | == StartThread == | ||
| Line 492: | Line 485: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Thread> || | | (In) W0 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (Out) None || || | | (Out) None || || | ||
| Line 520: | Line 513: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0, R1 || | | (In) X0 || R0, R1 || int64_t || Nanoseconds | ||
|} | |} | ||
</div> | </div> | ||
| Line 547: | Line 540: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W1|| Handle<Thread> || | | (In) W1|| Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || | | (Out) W1 || int32_t || Priority | ||
|} | |} | ||
</div> | </div> | ||
| Line 563: | Line 556: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0|| Handle<Thread> || | | (In) W0|| Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (In) W1|| | | (In) W1|| int32_t || Priority | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 581: | Line 574: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W2 || R2 || Handle<Thread> || | | (In) W2 || R2 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || int32_t || CoreMask0 | ||
|- | |- | ||
| (Out) X2 || R2, R3 || | | (Out) X2 || R2, R3 || uint64_t || CoreMask1 | ||
|} | |} | ||
</div> | </div> | ||
| Line 599: | Line 592: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || Handle<Thread> || | | (In) W0 || R0 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (In) W1 || R1 || | | (In) W1 || R1 || int32_t || CoreMask0 | ||
|- | |- | ||
| (In) X2 || R2, R3 || | | (In) X2 || R2, R3 || uint64_t || CoreMask1 | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 619: | Line 612: | ||
| (In) None || || | | (In) None || || | ||
|- | |- | ||
| (Out) W0 | | (Out) W0 || uint32_t || CpuId | ||
|} | |} | ||
</div> | </div> | ||
| Line 633: | Line 626: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<WritableEvent> || | | (In) W0 || Handle<WritableEvent> || EventHandle | ||
|- | |- | ||
| (Out) X0 || [[#Result]] || Result | | (Out) X0 || [[#Result]] || Result | ||
| Line 656: | Line 649: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<WritableEvent> or Handle<ReadableEvent> || | | (In) W0 || Handle<WritableEvent> or Handle<ReadableEvent> || EventHandle | ||
|- | |- | ||
| (Out) X0 || [[#Result]] || Result | | (Out) X0 || [[#Result]] || Result | ||
| Line 662: | Line 655: | ||
</div> | </div> | ||
Takes the given event out of the signaled state. | Takes the given event out of the signaled state, if it is signaled. | ||
=== Result codes === | === Result codes === | ||
| Line 668: | Line 661: | ||
'''0xE401:''' Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent. | '''0xE401:''' Invalid handle. The handle either does not exist, or is not a ReadableEvent nor a WritableEvent. | ||
== MapSharedMemory == | == MapSharedMemory == | ||
| Line 677: | Line 668: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<SharedMemory> || | | (In) W0 || Handle<SharedMemory> || SharedMemoryHandle | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (In) W3 || [[# | | (In) W3 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 699: | Line 690: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<SharedMemory> || | | (In) W0 || Handle<SharedMemory> || SharedMemoryHandle | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 715: | Line 706: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (In) W3 || [[# | | (In) W3 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<TransferMemory> || | | (Out) W1 || Handle<TransferMemory> || TransferMemoryHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 757: | Line 748: | ||
</div> | </div> | ||
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 | 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 returns ResultInvalidState if the event is not signaled. | ||
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. | 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. | ||
| Line 776: | Line 767: | ||
| (In) X1 || R1 || Handle* || HandlesPtr | | (In) X1 || R1 || Handle* || HandlesPtr | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || int32_t || HandlesNum | ||
|- | |- | ||
| (In) X3 || R0, R3 || | | (In) X3 || R0, R3 || int64_t || Timeout | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint64_t || HandleIndex | ||
|} | |} | ||
</div> | </div> | ||
Works with | Works with HandlesNum <= 0x40. | ||
When zero handles are passed, this will wait forever until either timeout or cancellation occurs. | When zero handles are passed, this will wait forever until either timeout or cancellation occurs. | ||
| Line 799: | Line 790: | ||
'''KProcess:''' signals when the process undergoes a state change (retrievable via [[#GetProcessInfo]]). | '''KProcess:''' signals when the process undergoes a state change (retrievable via [[#GetProcessInfo]]). | ||
'''KReadableEvent:''' signals when the event's corresponding KWritableEvent has been signaled via SignalEvent. | '''KReadableEvent:''' signals when the event's corresponding KWritableEvent has been signaled via [[#SignalEvent]]. | ||
'''KServerPort:''' signals when there is an incoming connection waiting to be [[#AcceptSession|accepted]]. | '''KServerPort:''' signals when there is an incoming connection waiting to be [[#AcceptSession|accepted]]. | ||
| Line 828: | Line 819: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Thread> || | | (In) W0 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 850: | Line 841: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Thread> || | | (In) W0 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) W2 || | | (In) W2 || uint32_t || Tag | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 866: | Line 857: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 878: | Line 869: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || void* || | | (In) X0 || R0 || void* || KeyAddress | ||
|- | |- | ||
| (In) X1 || R1 || void* || | | (In) X1 || R1 || void* || TagAddress | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || Tag | ||
|- | |- | ||
| (In) X3 || R3, R4 || | | (In) X3 || R3, R4 || int64_t || Timeout | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 896: | Line 887: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) W1 || | | (In) W1 || int32_t || Value | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 910: | Line 901: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (Out) X0 || R0, R1 || | | (Out) X0 || R0, R1 || uint64_t || Ticks | ||
|} | |} | ||
</div> | </div> | ||
| Line 930: | Line 921: | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<Session> || | | (Out) W1 || Handle<Session> || SessionHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 940: | Line 931: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Session> || | | (In) W0 || Handle<Session> || SessionHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 952: | Line 943: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Session> || | | (In) W0 || Handle<Session> || SessionHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
[S2] All errors returned by the SendSyncRequest* SVCs will automatically close the session (unknown whether handled by kernel/sysmodule). | |||
== SendSyncRequestWithUserBuffer == | == SendSyncRequestWithUserBuffer == | ||
| Line 964: | Line 957: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || void* || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (In) W2 || Handle<Session> || | | (In) W2 || Handle<Session> || SessionHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 974: | Line 967: | ||
</div> | </div> | ||
Size and | Size and Address must be 0x1000-aligned. | ||
=== Result codes === | === Result codes === | ||
'''0x0:''' Success. | '''0x0:''' Success. | ||
'''0xcc01:''' | '''0xcc01:''' Address is not 0x1000-aligned. | ||
'''0xca01:''' Size is not 0x1000-aligned. | '''0xca01:''' Size is not 0x1000-aligned. | ||
| Line 993: | Line 986: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (In) W3 || Handle<Session> || | | (In) W3 || Handle<Session> || SessionHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<ReadableEvent> || | | (Out) W1 || Handle<ReadableEvent> || EventHandle | ||
|} | |} | ||
</div> | </div> | ||
Size and | Size and Address must be 0x1000-aligned. | ||
== GetProcessId == | == GetProcessId == | ||
| Line 1,017: | Line 1,006: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || uint64_t || ProcessId | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,031: | Line 1,020: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Thread> || | | (In) W1 || R1 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || uint64_t || ThreadId | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,045: | Line 1,034: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || [[#BreakReason]] || BreakReason | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Info | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || | | (Out) W0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
If the process is attached, report the Break event. Then, if ContinueDebugEvent didn't apply IgnoreException on the thread: if TPIDR_EL0 is 0, adjust ELR_EL1 to retry to svc instruction (and set TPIDR_EL0 to 1). | If the process is attached, report the Break event. Then, if [[#ContinueDebugEvent]] didn't apply IgnoreException on the thread: if TPIDR_EL0 is 0, adjust ELR_EL1 to retry to svc instruction (and set TPIDR_EL0 to 1). | ||
Otherwise, if bit31 in reason isn't set, perform crash reporting (see Exception Handling section below), if it doesn't terminate the process adjust ELR_EL1 as well. | Otherwise, if bit31 in reason isn't set, perform crash reporting (see Exception Handling section below), if it doesn't terminate the process adjust ELR_EL1 as well. | ||
| Line 1,069: | Line 1,058: | ||
| (In) X0 || char* || String | | (In) X0 || char* || String | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,081: | Line 1,070: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| ( | | (In) W0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,091: | Line 1,080: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || | | (In) W1 || R1 || [[#InfoType]] || InfoType | ||
|- | |- | ||
| (In) W2 || R2 || Handle || Handle | | (In) W2 || R2 || Handle || Handle | ||
|- | |- | ||
| (In) X3 || R0, R3 || | | (In) X3 || R0, R3 || uint64_t || InfoSubType | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || uint64_t || Info | ||
|} | |} | ||
</div> | </div> | ||
== FlushEntireDataCache == | |||
== FlushEntireDataCache == | |||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 1,177: | Line 1,110: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,191: | Line 1,124: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,202: | Line 1,135: | ||
Uses current process pool partition. | Uses current process pool partition. | ||
=== Result codes === | |||
'''0x0:''' Success. | |||
'''0xCA01:''' Invalid size passed. It's either zero or not 4k-aligned | |||
'''0xCC01:''' Invalid address. (not 4k-aligned) | |||
'''0xDC01:''' Invalid memory range. It's either causes overflow, or does not fall into "reserved" address range (aka Alias). See AliasRegionAddress at [[#InfoType]] | |||
'''0xFA01:''' Invalid state. (not enough SystemResource (see [[NPDM#SystemResourceSize]])) | |||
== UnmapPhysicalMemory == | == UnmapPhysicalMemory == | ||
| Line 1,209: | Line 1,153: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,217: | Line 1,161: | ||
</div> | </div> | ||
== | == GetDebugFutureThreadInfo == | ||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 1,223: | Line 1,167: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X3 || R0, R1 || | | (In) X3 || R0, R1 || uint64_t || Timeout | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || | | (Out) X1 || uint64_t || LastThreadContextParam0 | ||
|- | |- | ||
| (Out) X2 || | | (Out) X2 || uint64_t || LastThreadContextParam1 | ||
|- | |- | ||
| (Out) X3 || | | (Out) X3 || uint64_t || LastThreadContextParam2 | ||
|- | |- | ||
| (Out) X4 || | | (Out) X4 || uint64_t || LastThreadContextParam3 | ||
|- | |- | ||
| (Out) X5 || | | (Out) X5 || uint64_t || | ||
|- | |- | ||
| (Out) W6 || | | (Out) W6 || uint32_t || | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,251: | Line 1,195: | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || | | (Out) X1 || uint64_t || LastThreadContextParam0 | ||
|- | |- | ||
| (Out) X2 || | | (Out) X2 || uint64_t || LastThreadContextParam1 | ||
|- | |- | ||
| (Out) X3 || | | (Out) X3 || uint64_t || LastThreadContextParam2 | ||
|- | |- | ||
| (Out) X4 || | | (Out) X4 || uint64_t || LastThreadContextParam3 | ||
|- | |- | ||
| (Out) X5 || | | (Out) X5 || uint64_t || | ||
|- | |- | ||
| (Out) W6 || | | (Out) W6 || uint32_t || | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,271: | Line 1,215: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || Handle<ResourceLimit> || | | (In) W1 || R1 || Handle<ResourceLimit> || ResourceLimitHandle | ||
|- | |- | ||
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource | | (In) W2 || R2 || [[#LimitableResource]] || LimitableResource | ||
| Line 1,277: | Line 1,221: | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || int64_t || LimitValue | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,287: | Line 1,231: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || Handle<ResourceLimit> || | | (In) W1 || R1 || Handle<ResourceLimit> || ResourceLimitHandle | ||
|- | |- | ||
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource | | (In) W2 || R2 || [[#LimitableResource]] || LimitableResource | ||
| Line 1,293: | Line 1,237: | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || int64_t || CurrentValue | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,305: | Line 1,249: | ||
| (In) W0 || Handle<Thread> || ThreadHandle | | (In) W0 || Handle<Thread> || ThreadHandle | ||
|- | |- | ||
| (In) W1 || ThreadActivity || ThreadActivity | | (In) W1 || [[#ThreadActivity]] || ThreadActivity | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,331: | Line 1,275: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || | | (In) X0 || R0 || void* || Address | ||
|- | |- | ||
| (In) W1 || R1 || [[#ArbitrationType]] || ArbitrationType | | (In) W1 || R1 || [[#ArbitrationType]] || ArbitrationType | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || Value | ||
|- | |- | ||
| (In) X3 || R3, R4 || | | (In) X3 || R3, R4 || uint64_t || Timeout | ||
|- | |- | ||
| (Out) | | (Out) W0 || R0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,349: | Line 1,293: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || | | (In) X0 || R0 || void* || Address | ||
|- | |- | ||
| (In) W1 || R1 || [[#SignalType]] || SignalType | | (In) W1 || R1 || [[#SignalType]] || SignalType | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || Value | ||
|- | |- | ||
| (In) W3 || R3 || | | (In) W3 || R3 || uint32_t || NumToSignal | ||
|- | |- | ||
| (Out) | | (Out) W0 || R0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,369: | Line 1,313: | ||
| (In) None || || | | (In) None || || | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) None || || | ||
|} | |||
</div> | |||
== GetResourceLimitPeakValue == | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument64 || Argument32 || Type || Name | |||
|- | |||
| (In) W1 || R1 || Handle<ResourceLimit> || ResourceLimitHandle | |||
|- | |||
| (In) W2 || R2 || [[#LimitableResource]] || LimitableResource | |||
|- | |||
| (Out) W0 || R0 || [[#Result]] || Result | |||
|- | |||
| (Out) X1 || R1, R2 || int64_t || PeakValue | |||
|} | |} | ||
</div> | </div> | ||
| Line 1,379: | Line 1,339: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || DumpInfoType || DumpInfoType | | (In) X0 || [[#DumpInfoType]] || DumpInfoType | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || DumpInfoSubType | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,397: | Line 1,357: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || KernelDebugType || KernelDebugType | | (In) W0 || [[#KernelDebugType]] || KernelDebugType | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || uint64_t || | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,417: | Line 1,377: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || KernelTraceState || KernelTraceState | | (In) W0 || [[#KernelTraceState]] || KernelTraceState | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,433: | Line 1,393: | ||
| (In) W2 || bool || IsLight | | (In) W2 || bool || IsLight | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || uint64_t || Name | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<ServerSession> || | | (Out) W1 || Handle<ServerSession> || ServerSessionHandle | ||
|- | |- | ||
| (Out) W2 || Handle<ClientSession> || | | (Out) W2 || Handle<ClientSession> || ClientSessionHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,449: | Line 1,409: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W1 || Handle<Port> || | | (In) W1 || Handle<Port> || PortHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<ServerSession> || | | (Out) W1 || Handle<ServerSession> || ServerSessionHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,478: | Line 1,438: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) | | (In) X1 || R1 || Handle<Port>* or Handle<ServerSession>* || Handles | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || NumHandles | ||
|- | |- | ||
| (In) W3 || R3 || Handle<ServerSession> || | | (In) W3 || R3 || Handle<ServerSession> || ReplyTargetSessionHandle | ||
|- | |- | ||
| (In) X4 || R0, R4 || | | (In) X4 || R0, R4 || uint64_t || Timeout | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint32_t || HandleIndex | ||
|} | |} | ||
</div> | </div> | ||
If | If ReplyTargetSessionHandle is not zero, a reply from the TLS will be sent to that session. | ||
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. | 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. | ||
If there is an incoming message, it is copied to the TLS. | If there is an incoming message, it is copied to the TLS. | ||
If | 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. | ||
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. | 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. | ||
| Line 1,513: | Line 1,473: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R1 || | | (In) X1 || R1 || void* || Address | ||
|- | |- | ||
| (In) X2 || R2 || | | (In) X2 || R2 || uint64_t || Size | ||
|- | |- | ||
| (In) X3 || R3 || Handle<Port>* or Handle<ServerSession>* || Handles | | (In) X3 || R3 || Handle<Port>* or Handle<ServerSession>* || Handles | ||
|- | |- | ||
| (In) W4 || R0 || | | (In) W4 || R0 || uint32_t || NumHandles | ||
|- | |- | ||
| (In) W5 || R4 || Handle<ServerSession> || | | (In) W5 || R4 || Handle<ServerSession> || ReplyTargetSessionHandle | ||
|- | |- | ||
| (In) X6 || R5, R6 || | | (In) X6 || R5, R6 || uint64_t || Timeout | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint32_t || HandleIndex | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,541: | Line 1,501: | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<WritableEvent> || | | (Out) W1 || Handle<WritableEvent> || WritableEventHandle | ||
|- | |- | ||
| (Out) W2 || Handle<ReadableEvent> || | | (Out) W2 || Handle<ReadableEvent> || ReadableEventHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,553: | Line 1,513: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,569: | Line 1,529: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || Address | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,583: | Line 1,543: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || uint64_t || Limit | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,595: | Line 1,555: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<CodeMemory> || | | (Out) W1 || Handle<CodeMemory> || CodeMemoryHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,615: | Line 1,575: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || Handle<CodeMemory> || | | (In) W0 || R0 || Handle<CodeMemory> || CodeMemoryHandle | ||
|- | |- | ||
| (In) W1 || R1 || [[#CodeMemoryOperation]] || CodeMemoryOperation | | (In) W1 || R1 || [[#CodeMemoryOperation]] || CodeMemoryOperation | ||
|- | |- | ||
| (In) X2 || R2, R3 || | | (In) X2 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X3 || R4, R5 || | | (In) X3 || R4, R5 || uint64_t || Size | ||
|- | |- | ||
| (In) W4 || R6 || MemoryPermission || | | (In) W4 || R6 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 1,629: | Line 1,589: | ||
</div> | </div> | ||
Maps the backing memory for a | Maps the backing memory for a CodeMemory object into the current process. | ||
For [[#CodeMemoryOperation| | For [[#CodeMemoryOperation|MapOwner]], memory permission must be RW-. | ||
For [[#CodeMemoryOperation| | For [[#CodeMemoryOperation|MapSlave]], memory permission must be R-- or R-X. | ||
Operations [[#CodeMemoryOperation| | Operations [[#CodeMemoryOperation|UnmapOwner/UnmapSlave]] unmap memory that was previously mapped this way. | ||
This allows one "secure JIT" process to map the code memory as RW-, and the other "slave" process to map it R-X. | This allows one "secure JIT" process to map the code memory as RW-, and the other "slave" process to map it R-X. | ||
| Line 1,659: | Line 1,619: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || RegisterAddress | ||
|- | |- | ||
| (In) W2 || R0 || | | (In) W2 || R0 || uint32_t || RwMask | ||
|- | |- | ||
| (In) W3 || R1 || | | (In) W3 || R1 || uint32_t || InValue | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint32_t || OutValue | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,703: | Line 1,663: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || Handle<Process> || | | (In) W0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) W1 || ProcessActivity || ProcessActivity | | (In) W1 || [[#ProcessActivity]] || ProcessActivity | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,717: | Line 1,677: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W1 || | | (In) W1 || uint64_t || Size | ||
|- | |- | ||
| (In) W2 || MemoryPermission || | | (In) W2 || [[#MemoryPermission]] || LocalMemoryPermission | ||
|- | |- | ||
| (In) W3 || MemoryPermission || | | (In) W3 || [[#MemoryPermission]] || RemoteMemoryPermission | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || Handle<SharedMemory> || | | (Out) W1 || Handle<SharedMemory> || SharedMemoryHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,739: | Line 1,699: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || Handle<TransferMemory> || | | (In) X0 || Handle<TransferMemory> || TransferMemoryHandle | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (In) W3 || MemoryPermission || | | (In) W3 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error. | You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error. | ||
| Line 1,761: | Line 1,719: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || Handle<TransferMemory> || | | (In) X0 || Handle<TransferMemory> || TransferMemoryHandle | ||
|- | |- | ||
| (In) X1 || void* || | | (In) X1 || void* || Address | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,779: | Line 1,737: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || [[#Interrupt]] || Interrupt | ||
|- | |- | ||
| (In) W2 || | | (In) W2 || [[#InterruptType]] || InterruptType | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,789: | Line 1,747: | ||
</div> | </div> | ||
Creates an event handle for the given IRQ number. Waiting on this handle will wait until the IRQ is triggered. The | 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. | ||
=== Result codes === | === Result codes === | ||
| Line 1,810: | Line 1,768: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || void* || VirtualAddress | ||
|- | |- | ||
| (Out) W0 || [[#Result]]|| Result | | (Out) W0 || [[#Result]]|| Result | ||
|- | |- | ||
| (Out) X1 || | | (Out) X1 || uint64_t || PhysicalMemoryInfoAddress | ||
|- | |- | ||
| (Out) X2 || | | (Out) X2 || uint64_t || PhysicalMemoryInfoBaseAddress | ||
|- | |- | ||
| (Out) X3 || | | (Out) X3 || uint64_t || PhysicalMemoryInfoSize | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,824: | Line 1,782: | ||
Queries the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address. | Queries the physical address of a virtual address. Will always fetch the lowest page-aligned mapping that contains the provided physical address. | ||
The returned | 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. | ||
== QueryIoMapping == | == QueryIoMapping == | ||
| Line 1,832: | Line 1,790: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || IoAddress | ||
|- | |- | ||
| (In) X2 || R0 || | | (In) X2 || R0 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1 || void* || | | (Out) X1 || R1 || void* || VirtualAddress | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,850: | Line 1,808: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || DeviceAddressSpaceStartAddress | ||
|- | |- | ||
| (In) X2 || R0, R1 || | | (In) X2 || R0, R1 || uint64_t || DeviceAddressSpaceEndAddress | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || Handle<DeviceAddressSpace> || | | (Out) W1 || R1 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,870: | Line 1,828: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || [[#DeviceName]] || | | (In) W0 || [[#DeviceName]] || DeviceName | ||
|- | |- | ||
| (In) X1 || Handle<DeviceAddressSpace> || | | (In) X1 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,886: | Line 1,844: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) W0 || [[#DeviceName]] || | | (In) W0 || [[#DeviceName]] || DeviceName | ||
|- | |- | ||
| (In) X1 || Handle<DeviceAddressSpace> || | | (In) X1 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 1,902: | Line 1,860: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || Handle<DeviceAddressSpace> || | | (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || ProcessHandle | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || void* || | | (In) X2 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X3 || R4 || | | (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize | ||
|- | |- | ||
| (In) X4 || R5, R6 || | | (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | ||
|- | |- | ||
| (In) W5 || R7 || | | (In) W5 || R7 || uint32_t || Option | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 1,920: | Line 1,878: | ||
Maps an attached device address space to an userspace address. | Maps an attached device address space to an userspace address. | ||
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]). | |||
The userspace destination address must have the [[SVC#MemoryState| | The userspace destination address must have the [[SVC#MemoryState|FlagCanDeviceMap]] bit set. Bit [[SVC#MemoryAttribute|DeviceShared]] will be set after mapping. | ||
The Option encodes a [[#MemoryPermission]] in the low 16 bits, and an indicator of IO mapping in the high bits. | |||
== MapDeviceAddressSpaceAligned == | == MapDeviceAddressSpaceAligned == | ||
| Line 1,930: | Line 1,890: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || Handle<DeviceAddressSpace> || | | (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || ProcessHandle | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || void* || | | (In) X2 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X3 || R4 || | | (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize | ||
|- | |- | ||
| (In) X4 || R5, R6 || | | (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | ||
|- | |- | ||
| (In) W5 || R7 || | | (In) W5 || R7 || uint32_t || Option | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 1,948: | Line 1,908: | ||
Maps an attached device address space to an userspace address. | Maps an attached device address space to an userspace address. | ||
Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState| | Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState|FlagCanAlignedDeviceMap]] bit set instead. | ||
The Option encodes a [[#MemoryPermission]] in the low 16 bits, and an indicator of IO mapping in the high bits. | |||
== MapDeviceAddressSpace == | == MapDeviceAddressSpace == | ||
| Line 1,956: | Line 1,918: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W1 || R1 || Handle<DeviceAddressSpace> || | | (In) W1 || R1 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (In) W2 || R2 || Handle<Process> || ProcessHandle | | (In) W2 || R2 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X3 || R0, R3 || | | (In) X3 || R0, R3 || void* || Address | ||
|- | |- | ||
| (In) X4 || R4 || | | (In) X4 || R4 || uint64_t || DeviceAddressSpaceSize | ||
|- | |- | ||
| (In) X5 || R5, R6 || | | (In) X5 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | ||
|- | |- | ||
| (In) W6 || R7 || MemoryPermission || | | (In) W6 || R7 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1 || | | (Out) X1 || R1 || uint64_t || Size | ||
|} | |} | ||
</div> | </div> | ||
| Line 1,980: | Line 1,942: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || Handle<DeviceAddressSpace> || | | (In) W0 || R0 || Handle<DeviceAddressSpace> || DeviceAddressSpaceHandle | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || ProcessHandle | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || void* || | | (In) X2 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X3 || R4 || | | (In) X3 || R4 || uint64_t || DeviceAddressSpaceSize | ||
|- | |- | ||
| (In) X4 || R5, R6 || | | (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,004: | Line 1,966: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,020: | Line 1,982: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,036: | Line 1,998: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || Address | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,050: | Line 2,012: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || ProcessId | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,088: | Line 2,050: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || [[#DebugEventInfo]]* || | | (In) X0 || [[#DebugEventInfo]]* || DebugEventInfo | ||
|- | |- | ||
| (In) W1 || Handle<Debug> || DebugHandle | | (In) W1 || Handle<Debug> || DebugHandle | ||
| Line 2,104: | Line 2,066: | ||
| (In) W0 || R0 || Handle<Debug> || DebugHandle | | (In) W0 || R0 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) W1 || R1 || [[#ContinueDebugFlags]] ([1.0.0-2.3.0] [[#ContinueDebugFlagsOld]]) | | (In) W1 || R1 || uint32_t || [[#ContinueDebugFlags]] ([1.0.0-2.3.0] [[#ContinueDebugFlagsOld]]) | ||
|- | |- | ||
| (In) X2 || R2 ([1.0.0-2.3.0] R2, R3) || | | (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) | ||
|- | |- | ||
| (In) X3 || R3 || | | (In) X3 || R3 || uint64_t || [3.0.0+] NumThreadIds | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,114: | Line 2,076: | ||
</div> | </div> | ||
Maximum | Maximum NumThreadIds is 64. 0 means "all threads". | ||
=== Result codes === | === Result codes === | ||
| Line 2,129: | Line 2,091: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R1 || | | (In) X1 || R1 || uint64_t* || ProcessIdBuffer | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || ProcessIdBufferSize | ||
|- | |- | ||
| (Out) X0 || R0 || [[#Result]] || Result | | (Out) X0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint32_t || NumProcesses | ||
|} | |} | ||
</div> | </div> | ||
| Line 2,141: | Line 2,103: | ||
Fills the provided array with the pids of currently living processes. A process "lives" so long as it is currently running or a handle to it still exists. | Fills the provided array with the pids of currently living processes. A process "lives" so long as it is currently running or a handle to it still exists. | ||
It returns the total number of processes currently alive. If this number is bigger than the size of | It returns the total number of processes currently alive. If this number is bigger than the size of ProcessIdBuffer, the user won't have all the pids. | ||
=== Result codes === | === Result codes === | ||
| Line 2,158: | Line 2,120: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X1 || R1 || | | (In) X1 || R1 || uint64_t* || ThreadIdBuffer | ||
|- | |- | ||
| (In) W2 || R2 || | | (In) W2 || R2 || uint32_t || ThreadIdBufferSize | ||
|- | |- | ||
| (In) W3 || R3 || Handle<Debug> || DebugHandle | | (In) W3 || R3 || Handle<Debug> || DebugHandle | ||
| Line 2,166: | Line 2,128: | ||
| (Out) X0 || R0 || [[#Result]] || Result | | (Out) X0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || | | (Out) W1 || R1 || uint32_t || NumThreads | ||
|} | |} | ||
</div> | </div> | ||
| Line 2,176: | Line 2,138: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || ThreadContext* || | | (In) X0 || R0 || [[#ThreadContext]]* || ThreadContext | ||
|- | |- | ||
| (In) X1 || R1 || Handle<Debug> || DebugHandle | | (In) X1 || R1 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || | | (In) X2 || R2, R3 || uint64_t || ThreadId | ||
|- | |- | ||
| (In) W3 || R4 || | | (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]] | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,196: | Line 2,158: | ||
| (In) W0 || R0 || Handle<Debug> || DebugHandle | | (In) W0 || R0 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || ThreadId | ||
|- | |- | ||
| (In) X2 || R1 || ThreadContext* || | | (In) X2 || R1 || [[#ThreadContext]]* || ThreadContext | ||
|- | |- | ||
| (In) W3 || R4 || | | (In) W3 || R4 || uint32_t || [[#ThreadContextFlags]] | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,212: | Line 2,174: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || [[#MemoryInfo]]* || | | (In) X0 || [[#MemoryInfo]]* || MemoryInfo | ||
|- | |- | ||
| (In) W2 || Handle<Debug> || DebugHandle | | (In) W2 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || void* || Address | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || PageInfo || PageInfo | | (Out) W1 || [[#PageInfo]] || PageInfo | ||
|} | |} | ||
</div> | </div> | ||
| Line 2,230: | Line 2,192: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X0 || | | (In) X0 || void* || MemoryBufferAddress | ||
|- | |- | ||
| (In) W1 || Handle<Debug> || DebugHandle | | (In) W1 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || void* || SrcAddress | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 2,250: | Line 2,212: | ||
| (In) W0 || Handle<Debug> || DebugHandle | | (In) W0 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || void* || MemoryBufferAddress | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || void* || DstAddress | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 2,266: | Line 2,228: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || R0 || HardwareBreakPointRegisterName || Name | | (In) W0 || R0 || [[#HardwareBreakPointRegisterName]] || Name | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || uint64_t || Flags | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || uint64_t || Value | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,294: | Line 2,256: | ||
| (In) X2 || R2 || Handle<Debug> || DebugHandle | | (In) X2 || R2 || Handle<Debug> || DebugHandle | ||
|- | |- | ||
| (In) X3 || R0, R1 || | | (In) X3 || R0, R1 || uint64_t || ThreadId | ||
|- | |- | ||
| (In) W4 || R3 || [[#DebugThreadParam]] || | | (In) W4 || R3 || [[#DebugThreadParam]] || DebugThreadParam | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || R1, R2 || | | (Out) X1 || R1, R2 || uint64_t || Out0 | ||
|- | |- | ||
| (Out) W2 || R3 || | | (Out) W2 || R3 || uint32_t || Out1 | ||
|} | |} | ||
</div> | </div> | ||
| Line 2,312: | Line 2,274: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || | | (In) X1 || [[#SystemInfoType]] || SystemInfoType | ||
|- | |- | ||
| (In) W2 || Handle || Handle | | (In) W2 || Handle || Handle | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || uint64_t || SystemInfoSubType | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) X1 || | | (Out) X1 || uint64_t || SystemInfo | ||
|} | |} | ||
</div> | </div> | ||
{| class=wikitable | == CreatePort == | ||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| | | (In) W2 || R2 || int32_t || MaxSessions | ||
|- | |- | ||
| | | (In) W3 || R3 || bool || IsLight | ||
|- | |- | ||
| | | (In) X4 || R0 || uint64_t || Name | ||
|- | |- | ||
| | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| | | (Out) W1 || R1 || Handle<Port> || ServerPortHandle | ||
|- | |- | ||
| | | (Out) W2 || R2 || Handle<Port> || ClientPortHandle | ||
|} | |} | ||
</div> | |||
== SetProcessMemoryPermission == | == ManageNamedPort == | ||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument || Type || Name | |||
|- | |||
| (In) X1 || char* || Name | |||
|- | |||
| (In) W2 || int32_t || MaxSessions | |||
|- | |||
| (Out) W0 || [[#Result]] || Result | |||
|- | |||
| (Out) W1 || Handle<Port> || ServerPortHandle | |||
|} | |||
</div> | |||
== ConnectToPort == | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument || Type || Name | |||
|- | |||
| (In) W1 || Handle<Port> || ClientPortHandle | |||
|- | |||
| (Out) W0 || [[#Result]] || Result | |||
|- | |||
| (Out) W1 || Handle<Session> || SessionHandle | |||
|} | |||
</div> | |||
== SetProcessMemoryPermission == | |||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 2,356: | Line 2,344: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || Addr | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || uint64_t || Size | ||
|- | |- | ||
| (In) W3 || R5 || | | (In) W3 || R5 || [[#MemoryPermission]] || MemoryPermission | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,376: | Line 2,364: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || | | (In) X0 || R0 || void* || DstAddress | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || ProcessHandle | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || void* || | | (In) X2 || R2, R3 || void* || SrcAddress | ||
|- | |- | ||
| (In) X3 || R4 || | | (In) X3 || R4 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,398: | Line 2,386: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || void* || | | (In) X0 || R0 || void* || DstAddress | ||
|- | |- | ||
| (In) W1 || R1 || Handle<Process> || ProcessHandle | | (In) W1 || R1 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X2 || R2, R3 || | | (In) X2 || R2, R3 || void* || SrcAddress | ||
|- | |- | ||
| (In) X3 || R4 || | | (In) X3 || R4 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,418: | Line 2,406: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) X0 || R0 || [[#MemoryInfo]]* || | | (In) X0 || R0 || [[#MemoryInfo]]* || MemoryInfo | ||
|- | |- | ||
| (In) W2 || R2 || Handle<Process> || ProcessHandle | | (In) W2 || R2 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X3 || R1, R3 || | | (In) X3 || R1, R3 || void* || Address | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |- | ||
| (Out) W1 || R1 || PageInfo || PageInfo | | (Out) W1 || R1 || [[#PageInfo]] || PageInfo | ||
|} | |} | ||
</div> | </div> | ||
| Line 2,440: | Line 2,428: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || DstAddress | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || void* || SrcAddress | ||
|- | |- | ||
| (In) X3 || R5, R6 || | | (In) X3 || R5, R6 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,460: | Line 2,448: | ||
| (In) W0 || R0 || Handle<Process> || ProcessHandle | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| (In) X1 || R2, R3 || | | (In) X1 || R2, R3 || void* || DstAddress | ||
|- | |- | ||
| (In) X2 || R1, R4 || | | (In) X2 || R1, R4 || void* || SrcAddress | ||
|- | |- | ||
| (In) X3 || R5, R6 || | | (In) X3 || R5, R6 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
| Line 2,478: | Line 2,466: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) X1 || [[# | | (In) X1 || [[#CreateProcessParameter]]* || CreateProcessParameter | ||
|- | |- | ||
| (In) X2 || | | (In) X2 || uint32_t* || Capabilities | ||
|- | |- | ||
| (In) X3 || | | (In) X3 || int32_t || CapabilitiesNum | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
| Line 2,490: | Line 2,478: | ||
</div> | </div> | ||
Takes a [[# | Takes a [[#CreateProcessParameter]] as input. | ||
Capabilities points to an array of [[NPDM#Kernel_Access_Control|kernel capabilities]]. | |||
CapabilitiesNum is a number of capabilities in the | CapabilitiesNum is a number of capabilities in the Capabilities array (number of element, not number of bytes). | ||
=== Result codes === | === Result codes === | ||
| Line 2,509: | Line 2,497: | ||
'''0xF001:''' Unused bits are set in mmuflags. Unknown address space type used. | '''0xF001:''' Unused bits are set in mmuflags. Unknown address space type used. | ||
== | == StartProcess == | ||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 2,515: | Line 2,503: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) W0 || | | (In) W0 || R0 || Handle<Process> || ProcessHandle | ||
|- | |||
| (In) W1 || R1 || int32_t || MainThreadPriority | |||
|- | |||
| (In) W2 || R2 || int32_t || DefaultCpuId | |||
|- | |- | ||
| (In) | | (In) X3 || R3, R4 || uint64_t || MainThreadStackSize | ||
|- | |- | ||
| (Out) W0 || R0 || [[#Result]] || Result | | (Out) W0 || R0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
== TerminateProcess == | |||
== | |||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Argument || Type || Name | ||
|- | |- | ||
| (In) | | (In) W0 || Handle<Process> || ProcessHandle | ||
|- | |- | ||
| ( | | (Out) W0 || [[#Result]] || Result | ||
|} | |||
</div> | |||
== GetProcessInfo == | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument64 || Argument32 || Type || Name | |||
|- | |||
| (In) W0 || R1 || Handle<Process> || ProcessHandle | |||
|- | |- | ||
| ( | | (In) W1 || R2 || [[#ProcessInfoType]] || ProcessInfoType | ||
|- | |- | ||
| (Out) X1 | | (Out) W0 || R0 || [[#Result]] || Result | ||
|- | |||
| (Out) X1 || R1, R2 || uint64_t || [[#ProcessState]] | |||
|} | |} | ||
</div> | </div> | ||
Returns an enum with value 0-7. | |||
== CreateResourceLimit == | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument || Type || Name | |||
|- | |||
| (In) None || || | |||
|- | |||
| (Out) W0 || [[#Result]] || Result | |||
|- | |||
| (Out) W1 || Handle<ResourceLimit> || ResourceLimitHandle | |||
|} | |||
</div> | |||
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. | == SetResourceLimitLimitValue == | ||
<div style="display: inline-block;"> | |||
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). | {| class="wikitable" border="1" | ||
|- | |||
== Debugging == | ! Argument64 || Argument32 || Type || Name | ||
|- | |||
| (In) W0 || R0 || Handle<ResourceLimit> || ResourceLimitHandle | |||
|- | |||
| (In) W1 || R1 || [[#LimitableResource]] || LimitableResource | |||
|- | |||
| (In) X2 || R2, R3 || int64_t || LimitValue | |||
|- | |||
| (Out) W0 || R0 || [[#Result]] || Result | |||
|} | |||
</div> | |||
== CallSecureMonitor == | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! Argument64 || Argument32 || Type || Name | |||
|- | |||
| (In) X0 || R0 || uint64_t || [[SMC#Secure_Monitor_calls|FunctionId]] | |||
|- | |||
| (In) X1-X7 || R1-R7 || uint64_t || SMC arguments | |||
|- | |||
| (Out) X0 || R0 || [[SMC#Result|Result]] || SMC result | |||
|- | |||
| (Out) X1-X7 || R1-R7 || uint64_t || SMC output | |||
|} | |||
</div> | |||
Takes in a SMC function ID in X0, and arguments for that SMC function in X1-X7. | |||
Passing an invalid SMC function ID or calling from a core other than core 3 will result in a secure monitor panic. | |||
The kernel parses bits 9-15 in the passed SMC function ID (per the ARM SMC calling convention), and when set uses as an indicator to translate a pointer in the associated register (X1-X7) to a physical address. The kernel will translate any address mapped as R-W, other addresses (R--, R-X, or invalid pointers) will be translated as 0/NULL. | |||
Output is returned raw from the Secure Monitor; X0 will be the untranslated SMC result and X1-X7 will contain other SMC output (or be unchanged, depending on the SMC). | |||
== Debugging == | |||
[2.0.0+] Exactly 6 debug SVCs require that [[SPL_services#GetConfig|IsDebugMode]] is non-zero. Error 0x4201 is returned otherwise. | [2.0.0+] Exactly 6 debug SVCs require that [[SPL_services#GetConfig|IsDebugMode]] is non-zero. Error 0x4201 is returned otherwise. | ||
* BreakDebugProcess | * BreakDebugProcess | ||
| Line 2,563: | Line 2,611: | ||
= Enum/Structures = | = Enum/Structures = | ||
== | == InfoType == | ||
{| class=wikitable | {| class=wikitable | ||
! | ! Handle type || InfoType || InfoSubType || Description | ||
|- | |- | ||
| | | Process || 0 || 0 || CoreMask | ||
|- | |- | ||
| | | Process || 1 || 0 || PriorityMask | ||
|- | |- | ||
| | | Process || 2 || 0 || AliasRegionAddress | ||
|- | |- | ||
| | | Process || 3 || 0 || AliasRegionSize | ||
| | |||
|- | |- | ||
| 0 || | | Process || 4 || 0 || HeapRegionAddress | ||
|- | |- | ||
| | | Process || 5 || 0 || HeapRegionSize | ||
|- | |- | ||
| | | Process || 6 || 0 || TotalMemorySize. Total memory available(free+used). | ||
|- | |- | ||
| | | Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap. | ||
|- | |- | ||
| | | Zero || 8 || 0 || DebuggerAttached | ||
|- | |- | ||
| | | Zero || 9 || 0 || ResourceLimit | ||
|- | |- | ||
| | | Zero || 10 || -1, {current coreid} || IdleTickCount | ||
|- | |- | ||
| | | Zero || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs. | ||
|- | |- | ||
| | | Process || 12 || 0 || [2.0.0+] AslrRegionAddress | ||
|- | |- | ||
| | | Process || 13 || 0 || [2.0.0+] AslrRegionSize | ||
|- | |- | ||
| | | Process || 14 || 0 || [2.0.0+] StackRegionAddress | ||
|- | |- | ||
| | | Process || 15 || 0 || [2.0.0+] StackRegionSize | ||
|- | |- | ||
| | | Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal | ||
|- | |- | ||
| | | Process || 17 || 0 || [3.0.0+] SystemResourceSizeUsed | ||
|- | |- | ||
| | | Process || 18 || 0 || [3.0.0+] ProgramId | ||
|- | |- | ||
| | | Zero || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| | | Zero || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound | ||
|- | |- | ||
| | | Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress | ||
|- | |- | ||
| | | Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize | ||
|- | |- | ||
| | | Process || 22 || 0 || [6.0.0+] UsedNonSystemMemorySize | ||
|- | |- | ||
| | | Process || 23 || 0 || [9.0.0+] IsApplication | ||
|- | |- | ||
| | | Process || 24 || 0 || [11.0.0+] FreeThreadCount | ||
|- | |- | ||
| | | Thread || 25 ([1.0.0-12.1.0] 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. | ||
|- | |- | ||
| | | Process || 26 || 0 || [14.0.0+] IsSvcPermitted | ||
|- | |- | ||
| | | Process || 27 || 0 || [16.0.0+] IoRegionHint | ||
|- | |- | ||
| | | Process || 28 || 0 || [18.0.0+] AliasRegionExtraSize | ||
|- | |- | ||
| | | Process || 29 || 0 || [S2] RemoteRegionAddress | ||
|- | |- | ||
| | | Process || 30 || 0 || [S2] RemoteRegionSize | ||
|- | |- | ||
| | | Process || 31 || 0 || [S2] RemoteMemoryUsage | ||
|- | |- | ||
| | | Process || 32 || 0 || [S2] RemoteMemoryUsagePeak | ||
|- | |- | ||
| | | Process || 33 || 0 || [S2] ProcessPageSize | ||
|- | |- | ||
| | | TransferMemory || 34 || 0 || [19.0.0+] TransferMemoryHint | ||
|} | |||
== SystemInfoType == | |||
{| class=wikitable | |||
! Handle type || SystemInfoType || SystemInfoSubType || Description | |||
|- | |- | ||
| | | Zero || 0 || 0 || TotalPhysicalMemorySize_Application | ||
|- | |- | ||
| | | Zero || 0 || 1 || TotalPhysicalMemorySize_Applet | ||
|- | |- | ||
| | | Zero || 0 || 2 || TotalPhysicalMemorySize_System | ||
|- | |- | ||
| | | Zero || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| | | Zero || 1 || 0 || UsedPhysicalMemorySize_Application | ||
|- | |- | ||
| | | Zero || 1 || 1 || UsedPhysicalMemorySize_Applet | ||
|- | |- | ||
| | | Zero || 1 || 2 || UsedPhysicalMemorySize_System | ||
| | |||
|- | |- | ||
| | | Zero || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| | | Zero || 2 || 0 || InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| | | Zero || 2 || 1 || InitialProcessIdRange_UpperBound | ||
| | |||
| | |||
|} | |} | ||
== | == ThreadContextFlags == | ||
Bitfield of one of more of these: | |||
{| class=wikitable | {| class=wikitable | ||
! | ! Bit || Bitmask || Name || Description | ||
|- | |- | ||
| 0 || | | 0 || 1 || General-purpose registers || If in 64-bit mode, GPRs 0–28 will be read/written. If in 32-bit mode, GPRs 0–12 will be read/written. | ||
|- | |- | ||
| 1 || | | 1 || 2 || Control registers || Reads/writes the FP, LR, PC, SP, PSTATE, and TPIDR registers. | ||
|- | |- | ||
| 2 || | | 2 || 4 || Floating-point registers || Reads/writes the floating-point vector registers. | ||
|- | |- | ||
| 3 || | | 3 || 8 || Floating-point control registers || Reads/writes the FPCR and FPSR registers. | ||
|} | |} | ||
== | == DeviceName == | ||
{| class=wikitable | {| class=wikitable | ||
! Value || Name | ! Value || Name | ||
|- | |- | ||
| 0 || | | 0 || AFI | ||
|- | |- | ||
| | | 1 || AVPC | ||
|- | |- | ||
| | | 2 || DC | ||
|- | |- | ||
| | | 3 || DCB | ||
|- | |- | ||
| | | 4 || HC | ||
|- | |- | ||
| | | 5 || HDA | ||
|- | |- | ||
| | | 6 || ISP2 | ||
|- | |- | ||
| | | 7 || MSENCNVENC | ||
|- | |- | ||
| | | 8 || NV | ||
|- | |- | ||
| | | 9 || NV2 | ||
|- | |- | ||
| | | 10 || PPCS | ||
|- | |- | ||
| | | 11 || SATA | ||
|- | |- | ||
| | | 12 || VI | ||
|- | |- | ||
| | | 13 || VIC | ||
|- | |- | ||
| | | 14 || XUSB_HOST | ||
|- | |- | ||
| | | 15 || XUSB_DEV | ||
|- | |- | ||
| | | 16 || TSEC | ||
|- | |- | ||
| | | 17 || PPCS1 | ||
|- | |- | ||
| | | 18 || DC1 | ||
|- | |- | ||
| | | 19 || SDMMC1A | ||
|- | |- | ||
| || | | 20 || SDMMC2A | ||
|- | |- | ||
| || | | 21 || SDMMC3A | ||
|- | |- | ||
| || | | 22 || SDMMC4A | ||
|- | |- | ||
| || | | 23 || ISP2B | ||
|- | |- | ||
| || | | 24 || GPU | ||
|- | |- | ||
| || | | 25 || GPUB | ||
|- | |- | ||
| || | | 26 || PPCS2 | ||
|- | |- | ||
| || | | 27 || NVDEC | ||
|- | |- | ||
| | | 28 || APE | ||
|- | |- | ||
| | | 29 || SE | ||
|- | |- | ||
| | | 30 || NVJPG | ||
|- | |- | ||
| | | 31 || HC1 | ||
|- | |- | ||
| 32 || SE1 | |||
|- | |- | ||
| | | 33 || AXIAP | ||
|- | |- | ||
| | | 34 || ETR | ||
|- | |- | ||
| | | 35 || TSECB | ||
|- | |- | ||
| | | 36 || TSEC1 | ||
|- | |- | ||
| | | 37 || TSECB1 | ||
|- | |- | ||
| | | 38 || NVDEC1 | ||
|} | |} | ||
== | == CodeMemoryOperation == | ||
{| class=wikitable | {| class=wikitable | ||
! | ! Value || Name | ||
|- | |- | ||
| 0 || | | 0 || MapOwner | ||
|- | |- | ||
| 1 || | | 1 || MapSlave | ||
|- | |- | ||
| 2 || | | 2 || UnmapOwner | ||
|- | |- | ||
| 3 || | | 3 || UnmapSlave | ||
|} | |} | ||
== | == LimitableResource == | ||
{| class=wikitable | {| class=wikitable | ||
! | ! Value || Name || Description | ||
|- | |- | ||
| | | 0 || PhysicalMemoryMax || Bytes of memory a process may allocate. | ||
|- | |- | ||
| | | 1 || ThreadCountMax || Amount of threads a process can create. | ||
|- | |- | ||
| | | 2 || EventCountMax || Amount of events a process can create through [[#CreateEvent]] or [[#SendAsyncRequestWithUserBuffer]]. | ||
|- | |- | ||
| | | 3 || TransferMemoryCountMax || Amount of TransferMemory a process can create through [[#CreateTransferMemory]]. | ||
|- | |- | ||
| | | 4 || SessionCountMax || Amount of session a process can create through [[#CreateSession]], [[#ConnectToPort]] or [[#ConnectToNamedPort]]. | ||
|} | |||
= ThreadActivity = | |||
{| class=wikitable | |||
! Value || Name | |||
|- | |- | ||
| | | 0 || None | ||
|- | |- | ||
| 14 || [[#SetProcessMemoryPermission| | | 1 || Runnable | ||
|} | |||
== ProcessActivity == | |||
{| class=wikitable | |||
! Value || Name | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || Runnable | |||
|} | |||
== ProcessInfoType == | |||
{| class=wikitable | |||
! Value || Name | |||
|- | |||
| 0 || [[#ProcessState|ProcessState]] | |||
|} | |||
== ProcessState == | |||
{| class=wikitable | |||
! Value || Name || Notes | |||
|- | |||
| 0 || Created || | |||
|- | |||
| 1 || CreatedAttached || | |||
|- | |||
| 2 || Started || | |||
|- | |||
| 3 || Crashed || Processes will not enter this state unless they were created with [[#CreateProcessParameter|EnableDebug]]. | |||
|- | |||
| 4 || StartedAttached || | |||
|- | |||
| 5 || Exiting || | |||
|- | |||
| 6 || Exited || | |||
|- | |||
| 7 || DebugSuspended || | |||
|} | |||
== DebugThreadParam == | |||
{| class=wikitable | |||
! Value || Name | |||
|- | |||
| 0 || DynamicPriority | |||
|- | |||
| 1 || SchedulingStatus | |||
|- | |||
| 2 || PreferredCpuCore | |||
|- | |||
| 3 || CurrentCpuCore | |||
|- | |||
| 4 || AffinityMask | |||
|} | |||
Dynamic priority: output in out2 | |||
Scheduling status: out1 contains bit0: is debug-suspended, bit1: is user-suspended ([[#SetThreadActivity]] 1 or [[#SetProcessActivity]] 1). | |||
Out2 contains {suspended, idle, running, terminating} => {5, 0, 1, 4} | |||
PreferredCpuCore: output in out2 | |||
CurrentCpuCore: output in out2 | |||
AffinityMask: output in out1 | |||
== CreateProcessParameter == | |||
{| class=wikitable | |||
! Offset || Length || Bits || Description | |||
|- | |||
| 0 || 12 || || ProcessName (doesn't have to be null-terminated) | |||
|- | |||
| 0x0C || 4 || || ProcessCategory (0: regular title, 1: kernel built-in) | |||
|- | |||
| 0x10 || 8 || || TitleId | |||
|- | |||
| 0x18 || 8 || || CodeAddr | |||
|- | |||
| 0x20 || 4 || || CodeNumPages | |||
|- | |||
| 0x24 || 4 || || Flags | |||
|- | |||
| || || Bit0 || Is64BitInstruction | |||
|- | |||
| || || Bit3-1 || [[#AddressSpaceType]] | |||
|- | |||
| || || Bit4 || [2.0.0+] EnableDebug | |||
|- | |||
| || || Bit5 || EnableAslr | |||
|- | |||
| || || Bit6 || IsApplication | |||
|- | |||
| || || Bit7 || [4.0.0] UseSecureMemory | |||
|- | |||
| || || Bit10-7 || [5.0.0+] MemoryRegion (0 = Application, 1 = Applet, 2 = SecureSystem, 3 = NonSecureSystem) | |||
|- | |||
| || || Bit11 || [7.0.0+] OptimizeMemoryAllocation (only allowed in combination with IsApplication) | |||
|- | |||
| 0x28 || 4 || || ResourceLimitHandle (can be zero) | |||
|- | |||
| 0x2C || 4 || || [3.0.0+] SystemResourceNumPages | |||
|} | |||
On [1.0.0] there's only one MemoryRegion. | |||
On [2.0.0-4.0.0] MemoryRegion is 1 for built-ins and 0 for rest. | |||
On [5.0.0] MemoryRegion is specified in CreateProcessArgs. There are now 4 pool partitions. | |||
On [5.0.0] (maybe lower?) a zero ResourceLimitHandle defaults to sysmodule limits and 0x12300000 bytes of memory. | |||
The PersonalMmHeap are allocated as follows: | |||
* For the application, normal insecure pool is used. Carveout 5 is used to provide protection. | |||
* For the applet, a pre-allocated secure pool segment of size 0x400000 is used. | |||
* For sysmodules, secure pool is allocated. | |||
=== AddressSpaceType === | |||
{| class=wikitable | |||
! Type || Name || Width || Description | |||
|- | |||
| 0 || AddressSpace32Bit || 32 || | |||
|- | |||
| 1 || AddressSpace64BitOld || 36 || | |||
|- | |||
| 2 || AddressSpace32BitNoReserved || 32 || Appears to be missing map region [?] | |||
|- | |||
| 3 || [2.0.0+] AddressSpace64Bit || 39 || | |||
|} | |||
== MemoryInfo == | |||
{| class=wikitable | |||
! Offset || Length || Description | |||
|- | |||
| 0 || 8 || BaseAddress | |||
|- | |||
| 8 || 8 || Size | |||
|- | |||
| 0x10 || 4 || [[#MemoryType]] | |||
|- | |||
| 0x14 || 4 || [[#MemoryAttribute]] | |||
|- | |||
| 0x18 || 4 || [[#MemoryPermission]] | |||
|- | |||
| 0x1C || 4 || IpcRefCount | |||
|- | |||
| 0x20 || 4 || DeviceRefCount | |||
|- | |||
| 0x24 || 4 || Padding: always zero | |||
|} | |||
== MemoryPermission == | |||
{| class=wikitable | |||
! Bits || Name || Description | |||
|- | |||
| 0 || Read || Can be set by [[#SetMemoryPermission]]. | |||
|- | |||
| 1 || Write || Can be set by [[#SetMemoryPermission]]. | |||
|- | |||
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]]. | |||
|- | |||
| 28 || DontCare || | |||
|} | |||
== MemoryAttribute == | |||
{| class=wikitable | |||
! Bits || Name || Description | |||
|- | |||
| 0 || Locked || Used by MapMemory, as an async IPC user buffer. | |||
|- | |||
| 1 || IpcLocked || True when IpcRefCount > 0. | |||
|- | |||
| 2 || DeviceShared || True when DeviceRefCount > 0. | |||
|- | |||
| 3 || Uncached || | |||
|- | |||
| 4 || PermissionLocked || | |||
|- | |||
| 5 || [S2] GpuSharable || | |||
|- | |||
| 6 || [S2] GpuShared || | |||
|- | |||
|} | |||
== MemoryState == | |||
{| class=wikitable | |||
! Bits || Description || Meaning | |||
|- | |||
| 7-0 || [[#MemoryType]] || | |||
|- | |||
| 8 || [[#SetMemoryPermission|FlagCanReprotect]] || | |||
|- | |||
| 9 || FlagCanDebug || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only. | |||
|- | |||
| 10 || FlagCanUseIpc || Allows sending this region as an IPC A/B/W buffer with flags=0. | |||
|- | |||
| 11 || FlagCanUseNonDeviceIpc || Allows sending this region as an IPC A/B/W buffer with flags=1. | |||
|- | |||
| 12 || FlagCanUseNonSecureIpc || Allows sending this region as an IPC A/B/W buffer with flags=3. | |||
|- | |||
| 13 || FlagMapped || | |||
|- | |||
| 14 || [[#SetProcessMemoryPermission|FlagCode]] || | |||
|- | |||
| 15 || [[#MapMemory|FlagCanAlias]] || | |||
|- | |||
| 16 || [[#MapProcessCodeMemory|FlagCanCodeAlias]] || | |||
|- | |||
| 17 || [[#CreateTransferMemory|FlagCanTransfer]] || | |||
|- | |||
| 18 || [[#QueryPhysicalAddress|FlagCanQueryPhysical]] || | |||
|- | |||
| 19 || [[#MapDeviceAddressSpace|FlagCanDeviceMap]] || | |||
|- | |||
| 20 || [[#MapDeviceAddressSpaceAligned|FlagCanAlignedDeviceMap]] || | |||
|- | |||
| 21 || [[#SendSyncRequestWithUserBuffer|FlagCanIpcUserBuffer]] || | |||
|- | |||
| 22 || FlagReferenceCounted || The physical memory blocks backing this region are refcounted. | |||
|- | |||
| 23 || [[#MapProcessMemory|FlagCanMapProcess]] || | |||
|- | |||
| 24 || [[#SetMemoryAttribute|FlagCanChangeAttribute]] || | |||
|- | |||
| 25 || [4.0.0+] [[#CreateCodeMemory|FlagCanCodeMemory]] || | |||
|- | |||
| 26 || [15.0.0+] FlagLinearMapped || | |||
|- | |||
| 27 || [17.0.0+] FlagCanPermissionLock || | |||
|} | |||
=== MemoryType === | |||
{| class=wikitable | |||
! Value || Type || Meaning | |||
|- | |||
| 0x00000000 || Free || | |||
|- | |||
| 0x00002001 || Io || Mapped by kernel capability parsing in [[#CreateProcess]]. | |||
|- | |||
| 0x00042002 || Static || Mapped by kernel capability parsing in [[#CreateProcess]]. | |||
|- | |||
| 0x00DC7E03 || Code || Mapped during [[#CreateProcess]]. | |||
|- | |||
| [1.0.0+] | |||
0x01FEBD04 | |||
[4.0.0+] | |||
0x03FEBD04 | |||
|| CodeData || Transition from 0xDC7E03 performed by [[#SetProcessMemoryPermission]]. | |||
|- | |||
| [1.0.0+] | |||
0x017EBD05 | |||
[4.0.0+] | |||
0x037EBD05 | |||
|| Normal || Mapped using [[#SetHeapSize]]. | |||
|- | |||
| 0x00402006 || Shared || Mapped using [[#MapSharedMemory]]. | |||
|- | |||
| 0x00482907 || [1.0.0] Alias || Mapped using [[#MapMemory]]. | |||
|- | |||
| 0x00DD7E08 || AliasCode || Mapped using [[#MapProcessCodeMemory]]. | |||
|- | |||
| [1.0.0+] | |||
0x01FFBD09 | |||
[4.0.0+] | |||
0x03FFBD09 | |||
|| AliasCodeData || Transition from 0xDD7E08 performed by [[#SetProcessMemoryPermission]]. | |||
|- | |||
| 0x005C3C0A || [[IPC_Marshalling|Ipc]] || IPC buffers with descriptor flags=0. | |||
|- | |||
| 0x005C3C0B || Stack || Mapped using [[#MapMemory]]. | |||
|- | |||
| 0x0040200C || [[Thread Local Storage|ThreadLocal]] || Mapped during [[#CreateThread]]. | |||
|- | |||
| 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0. | |||
|- | |||
| 0x005C380E || SharedTransfered || Mapped using [[#MapTransferMemory]] when the owning process has perm!=0. | |||
|- | |||
| 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]]. | |||
|- | |||
| 0x00000010 || Inaccessible || | |||
|- | |||
| 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1. | |||
|- | |||
| 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3. | |||
|- | |||
| 0x00002013 || Kernel || Mapped in kernel during [[#CreateThread]]. | |||
|- | |||
| 0x00402214 || [4.0.0+] GeneratedCode || Mapped in kernel during [[#ControlCodeMemory]]. | |||
|- | |||
| 0x00402015 || [4.0.0+] CodeOut || Mapped in kernel during [[#ControlCodeMemory]]. | |||
|- | |||
| 0x00002016 || [13.0.0+] Coverage || | |||
|- | |||
| 0x05583817 || [15.0.0+] Insecure || | |||
|} | |||
== ArbitrationType == | |||
{| class=wikitable | |||
! Value || Type | |||
|- | |- | ||
| | | 0x0 || WaitIfLessThan | ||
|- | |- | ||
| | | 0x1 || DecrementAndWaitIfLessThan | ||
|- | |- | ||
| | | 0x2 || WaitIfEqual | ||
|} | |||
== SignalType == | |||
{| class=wikitable | |||
! Value || Type | |||
|- | |- | ||
| | | 0x0 || Signal | ||
|- | |- | ||
| | | 0x1 || SignalAndIncrementIfEqual | ||
|- | |- | ||
| | | 0x2 || SignalAndModifyBasedOnWaitingThreadCountIfEqual | ||
|} | |||
== ContinueDebugFlagsOld == | |||
[1.0.0-2.3.0] | |||
{| class=wikitable | |||
! Bit || Bitmask || Description | |||
|- | |- | ||
| | | 0 || 1 || IgnoreException (note: ResumeAllThreads or debug-suspended-thread-id needed) | ||
|- | |- | ||
| | | 1 || 2 || SwallowException | ||
|- | |- | ||
| | | 2 || 4 || ResumeAllThreads | ||
|} | |} | ||
== | == ContinueDebugFlags == | ||
[3.0.0+] | |||
{| class=wikitable | {| class=wikitable | ||
! | ! Bit || Bitmask || Description | ||
|- | |- | ||
| | | 0 || 1 || HandleException (note: doesn't need to be set in the same call than Resume) | ||
|- | |- | ||
| | | 1 || 2 || EnableExceptionEvent | ||
|- | |- | ||
| | | 2 || 4 || ContinueAll | ||
|- | |- | ||
| | | 3 || 8 || ContinueOthers | ||
| | |} | ||
ContinueOthers is like ContinueAll but acts on all threads that aren't in the input list. The affected threads are resumed. | |||
Only one of of HandleException and EnableExceptionEvent can be set at a time. | |||
If the input number of threads is 0, this means "all threads". | |||
== DebugEventInfo == | |||
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). | |||
Size: 0x40 | |||
{| class=wikitable | |||
|| | ! Offset || Length || Description | ||
|- | |- | ||
| | | 0 || u32 || EventType | ||
|- | |- | ||
| | | 4 || u32 || Flags (bit0: NeedsContinue) | ||
|- | |- | ||
| | | 8 || u64 || ThreadId | ||
|- | |- | ||
| | | 0x10 || || PerTypeSpecifics | ||
|} | |||
AttachProcess specific: | |||
{| class=wikitable | |||
! Offset || Length || Description | |||
|| | |||
|- | |- | ||
| | | 0x10 || u64 || TitleId | ||
|- | |- | ||
| | | 0x18 || u64 || ProcessId | ||
|- | |- | ||
| | | 0x20 || char[12] || ProcessName | ||
|- | |- | ||
| | | 0x2C || u32 || MmuFlags | ||
|- | |- | ||
| | | 0x30 || u64 || [5.0.0+] UserExceptionContextAddr | ||
|} | |||
AttachThread specific: | |||
{| class=wikitable | |||
! Offset || Length || Description | |||
|- | |- | ||
| | | 0x10 || u64 || ThreadId | ||
|- | |- | ||
| | | 0x18 || u64 || TlsPtr | ||
|- | |- | ||
| | | 0x20 || u64 || Entrypoint | ||
|} | |||
Exit specific: | |||
{| class=wikitable | |||
! Offset || Length || Description | |||
|- | |- | ||
| | | 0x10 || u32|| Type (0=PausedThread, 1=RunningThread, 2=ExitedProcess, 3=TerminatedProcess) | ||
|} | |} | ||
Exception specific: | |||
{| class=wikitable | {| class=wikitable | ||
! | ! Offset || Length || Description | ||
|- | |- | ||
| | | 0x10 || u32 || ExceptionType | ||
|- | |- | ||
| | | 0x18 || u64 || FaultRegister | ||
|- | |- | ||
| | | 0x20 || || PerExceptionSpecifics | ||
|} | |} | ||
== | === DebugEventType === | ||
{| class=wikitable | {| class=wikitable | ||
! Value || | ! Value || Name | ||
|- | |- | ||
| | | 0 || AttachProcess | ||
|- | |||
| 1 || AttachThread | |||
|- | |||
| 2 || ExitProcess | |||
|- | |- | ||
| | | 3 || ExitThread | ||
|- | |- | ||
| | | 4 || Exception | ||
|} | |} | ||
== | === DebugExceptionType === | ||
{| class=wikitable | {| class=wikitable | ||
! | ! Value || Name | ||
|- | |||
| 0 || Trap (*) | |||
|- | |- | ||
| 1 || InstructionAbort | |||
|- | |- | ||
| 2 || DataAbortMisc (**) | |||
|- | |- | ||
| | | 3 || PcSpAlignmentFault | ||
|- | |- | ||
| | | 4 || DebuggerAttached | ||
|- | |- | ||
| | | 5 || BreakPoint | ||
|- | |- | ||
| | | 6 || UserBreak | ||
|- | |- | ||
| | | 7 || DebuggerBreak | ||
| | |- | ||
| 8 || BadSvcId | |||
|- | |||
| 9 || [2.0.0+] SError | |||
|} | |||
<nowiki>*</nowiki> Undefined instructions, software breakpoints, some other traps. | |||
<nowiki>**</nowiki> Data aborts, FP traps, and everything else that doesn't belong to any of the above. | |||
= | Trap specifics: | ||
{| class=wikitable | |||
! Offset || Length || Description | |||
|- | |||
| 0x20 || u32 || Opcode | |||
|} | |||
BreakPoint specifics: | |||
{| class=wikitable | |||
! Offset || Length || Description | |||
|- | |||
| 0x20 || u32 || IsWatchpoint | |||
|} | |||
UserBreak specifics: | |||
{| class=wikitable | {| class=wikitable | ||
! Offset || Length || Description | ! Offset || Length || Description | ||
|- | |- | ||
| | | 0x20 || u32 || Info0 | ||
|- | |- | ||
| | | 0x28 || u64 || Info1 | ||
|- | |- | ||
| | | 0x30 || u64 || Info2 | ||
|} | |} | ||
BadSvcId specifics: | |||
{| class=wikitable | {| class=wikitable | ||
! Offset || Length || Description | ! Offset || Length || Description | ||
|- | |- | ||
| 0x20 || u32 || SvcId | |||
| 0x20 | |||
|} | |} | ||
= Exception handling = | |||
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. | |||
The dispatcher has two mutually exclusive exception reporting methods: | |||
* by storing information at the start of the process's TLS memregion (TPIDRRO_EL0) and jumping back to the crt0 | |||
* by using KDebug | |||
KDebug dispatching is used when at least one of the following conditions are met: | |||
* SMC ConfigItem KernelMemConfig bit 1 is NOT set (it isn'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) | |||
* FAR doesn'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't include FP exceptions occurring in CodeStatic memory): | |||
** Uncategorized | |||
** IllegalState | |||
** SupervisorCallA32 | |||
** SupervisorCallA64 | |||
** PCAlignment | |||
** SPAlignment | |||
** SError | |||
** BreakpointLowerEl | |||
** SoftwareStepLowerEl (note: no way set single-step flag; not parsed) | |||
** WatchpointLowerEl | |||
** SoftwareBreakpointA32 (note: not parsed) | |||
** SoftwareBreakpointA64 (note: not parsed) | |||
In all other cases the userland-handled exception path is taken. | |||
KDebug path: | |||
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. | |||
If the latter is not the case, or if the process isn't attached, proceed to [2.0.0+] crash reporting (or in [1.0.0] just terminate the process): | |||
if EnableDebug is set, and depending on the process state (more than one crash per process isn'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. | |||
Userland reporting path and [[#ReturnFromException]]: | |||
TLS region start (UserExceptionContext): | |||
{| class=wikitable | {| class=wikitable | ||
! Offset || Length || Description | ! Offset || Length || Description | ||
|- | |- | ||
| | | 0x0 || 0x148 || Exception stack | ||
|- | |- | ||
| | | 0x148 || 0x78 (A64) or 0x44 (A32) || ExceptionFrameA64 or ExceptionFrameA32 | ||
|- | |- | ||
| | | 0x1C0 || 0x8 || DyingMessage address (unused by kernel) | ||
|- | |- | ||
| | | 0x1C8 || 0x8 || DyingMessage size (unused by kernel) | ||
|} | |} | ||
| Line 3,205: | Line 3,407: | ||
|- | |- | ||
| 0x70 || 0x8 || far | | 0x70 || 0x8 || far | ||
|} | |} | ||