SVC: Difference between revisions
→MemoryAttribute: memory attribute names |
Fixups for query/insecure |
||
(22 intermediate revisions by 5 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" | |||
| [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" | ||
| | | [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" | |- style="border-top: double" | ||
| 0x40 || [[#CreateSession]] | | 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 || Result || [[#CreatePort|CreatePort]] || Handle *out_server_handle, Handle *out_client_handle, int32_t max_sessions, bool is_light, uintptr_t name | |||
|- | |||
| 0x71 || Result || [[#ManageNamedPort|ManageNamedPort]] || Handle *out_server_handle, const char *name, int32_t max_sessions | |||
|- | |- | ||
| | | 0x72 || Result || [[#ConnectToPort|ConnectToPort]] || Handle *out_handle, Handle port | ||
|- | |- | ||
| | | 0x73 || Result || [[#SetProcessMemoryPermission|SetProcessMemoryPermission]] || Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm | ||
|- | |- | ||
| | | 0x74 || Result || [[#MapProcessMemory|MapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size | ||
|- | |- | ||
| | | 0x75 || Result || [[#UnmapProcessMemory|UnmapProcessMemory]] || uintptr_t dst_address, Handle process_handle, uint64_t src_address, size_t size | ||
|- | |- | ||
| | | 0x76 || Result || [[#QueryProcessMemory|QueryProcessMemory]] || arch::MemoryInfo *out_memory_info, PageInfo *out_page_info, Handle process_handle, uint64_t address | ||
|- | |- | ||
| | | 0x77 || Result || [[#MapProcessCodeMemory|MapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size | ||
|- | |- | ||
| | | 0x78 || Result || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemory]] || Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size | ||
|- | |- | ||
| | | 0x79 || Result || [[#CreateProcess|CreateProcess]] || Handle *out_handle, const arch::CreateProcessParameter *parameters, const uint32_t *caps, int32_t num_caps | ||
|- | |- | ||
| | | 0x7A || Result || [[#StartProcess|StartProcess]] || Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size | ||
|- | |- | ||
| | | 0x7B || Result || [[#TerminateProcess|TerminateProcess]] || Handle process_handle | ||
|- | |- | ||
| | | 0x7C || Result || [[#GetProcessInfo|GetProcessInfo]] || int64_t *out_info, Handle process_handle, ProcessInfoType info_type | ||
|- | |- | ||
| | | 0x7D || Result || [[#CreateResourceLimit|CreateResourceLimit]] || Handle *out_handle | ||
|- | |- | ||
| | | 0x7E || Result || [[#SetResourceLimitLimitValue|SetResourceLimitLimitValue]] || Handle resource_limit_handle, LimitableResource which, int64_t limit_value | ||
|- | |- | ||
| | | 0x7F || void || [[#CallSecureMonitor|CallSecureMonitor]] || SecureMonitorArguments *args | ||
|- 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 246: | Line 267: | ||
! Argument || Type || Name | ! Argument || Type || Name | ||
|- | |- | ||
| (In) | | (In) X1 || uint64_t || Size | ||
|- | |- | ||
| (Out) W0 || [[#Result]] || Result | | (Out) W0 || [[#Result]] || Result | ||
Line 310: | Line 331: | ||
'''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 628: | Line 649: | ||
</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 634: | Line 655: | ||
'''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 723: | Line 742: | ||
</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 1,108: | Line 1,127: | ||
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,123: | Line 1,153: | ||
</div> | </div> | ||
== | == GetDebugFutureThreadInfo == | ||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,245: | Line 1,275: | ||
| (In) X3 || R3, R4 || uint64_t || Timeout | | (In) X3 || R3, R4 || uint64_t || Timeout | ||
|- | |- | ||
| (Out) | | (Out) W0 || R0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
Line 1,263: | Line 1,293: | ||
| (In) W3 || R3 || uint32_t || NumToSignal | | (In) W3 || R3 || uint32_t || NumToSignal | ||
|- | |- | ||
| (Out) | | (Out) W0 || R0 || [[#Result]] || Result | ||
|} | |} | ||
</div> | </div> | ||
Line 1,276: | Line 1,306: | ||
|- | |- | ||
| (Out) None || || | | (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,384: | Line 1,430: | ||
! Argument64 || Argument32 || Type || Name | ! Argument64 || Argument32 || Type || Name | ||
|- | |- | ||
| (In) | | (In) X1 || R1 || Handle<Port>* or Handle<ServerSession>* || Handles | ||
|- | |- | ||
| (In) W2 || R2 || uint32_t || NumHandles | | (In) W2 || R2 || uint32_t || NumHandles | ||
Line 1,656: | Line 1,702: | ||
|} | |} | ||
</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,818: | Line 1,862: | ||
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | | (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,828: | Line 1,872: | ||
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]). | 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,846: | Line 1,892: | ||
| (In) X4 || R5, R6 || uint64_t || DeviceAddressSpaceAddress | | (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,854: | Line 1,900: | ||
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 2,559: | Line 2,607: | ||
! Handle type || InfoType || InfoSubType || Description | ! Handle type || InfoType || InfoSubType || Description | ||
|- | |- | ||
| Process || 0 || 0 || | | Process || 0 || 0 || CoreMask | ||
|- | |- | ||
| Process || 1 || 0 || | | Process || 1 || 0 || PriorityMask | ||
|- | |- | ||
| Process || 2 || 0 || | | Process || 2 || 0 || AliasRegionAddress | ||
|- | |- | ||
| Process || 3 || 0 || AliasRegionSize | | Process || 3 || 0 || AliasRegionSize | ||
|- | |- | ||
| Process || 4 || 0 || | | Process || 4 || 0 || HeapRegionAddress | ||
|- | |- | ||
| Process || 5 || 0 || HeapRegionSize | | Process || 5 || 0 || HeapRegionSize | ||
|- | |- | ||
| Process || 6 || 0 || | | Process || 6 || 0 || TotalMemorySize. Total memory available(free+used). | ||
|- | |- | ||
| Process || 7 || 0 || | | Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap. | ||
|- | |- | ||
| Zero || 8 || 0 || | | Zero || 8 || 0 || DebuggerAttached | ||
|- | |- | ||
| Zero || 9 || 0 || | | Zero || 9 || 0 || ResourceLimit | ||
|- | |- | ||
| Zero || 10 || -1, {current coreid} || IdleTickCount | | Zero || 10 || -1, {current coreid} || IdleTickCount | ||
|- | |- | ||
| Zero || 11 || 0-3 || RandomEntropy | | Zero || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs. | ||
|- | |- | ||
| Process || 12 || 0 || [2.0.0+] | | Process || 12 || 0 || [2.0.0+] AslrRegionAddress | ||
|- | |- | ||
| Process || 13 || 0 || [2.0.0+] | | Process || 13 || 0 || [2.0.0+] AslrRegionSize | ||
|- | |- | ||
| Process || 14 || 0 || [2.0.0+] | | Process || 14 || 0 || [2.0.0+] StackRegionAddress | ||
|- | |- | ||
| Process || 15 || 0 || [2.0.0+] StackRegionSize | | Process || 15 || 0 || [2.0.0+] StackRegionSize | ||
|- | |- | ||
| Process || 16 || 0 || [3.0.0+] | | Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal | ||
|- | |- | ||
| Process || 17 || 0 || [3.0.0+] | | Process || 17 || 0 || [3.0.0+] SystemResourceSizeUsed | ||
|- | |- | ||
| Process || 18 || 0 || [3.0.0+] ProgramId | | Process || 18 || 0 || [3.0.0+] ProgramId | ||
|- | |- | ||
| Zero || 19 || 0 || [4.0.0-4.1.0] | | Zero || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| Zero || 19 || 1 || [4.0.0-4.1.0] | | Zero || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound | ||
|- | |- | ||
| Process || 20 || 0 || [5.0.0+] | | Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress | ||
|- | |- | ||
| Process || 21 || 0 || [6.0.0+] | | Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize | ||
|- | |- | ||
| Process || 22 || 0 || [6.0.0+] | | Process || 22 || 0 || [6.0.0+] UsedNonSystemMemorySize | ||
|- | |- | ||
| Process || 23 || 0 || [9.0.0+] IsApplication | | Process || 23 || 0 || [9.0.0+] IsApplication | ||
|- | |- | ||
| Thread || 0xF0000002 || 0-3, -1 || | | 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 | |||
|} | |} | ||
== SystemInfoType == | == SystemInfoType == | ||
{| class=wikitable | {| class=wikitable | ||
! Handle type || SystemInfoType || SystemInfoSubType|| Description | ! Handle type || SystemInfoType || SystemInfoSubType || Description | ||
|- | |- | ||
| Zero || 0 || 0 || | | Zero || 0 || 0 || TotalPhysicalMemorySize_Application | ||
|- | |- | ||
| Zero || 0 || 1 || | | Zero || 0 || 1 || TotalPhysicalMemorySize_Applet | ||
|- | |- | ||
| Zero || 0 || 2 || | | Zero || 0 || 2 || TotalPhysicalMemorySize_System | ||
|- | |- | ||
| Zero || 0 || 3 || | | Zero || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| Zero || 1 || 0 || | | Zero || 1 || 0 || UsedPhysicalMemorySize_Application | ||
|- | |- | ||
| Zero || 1 || 1 || | | Zero || 1 || 1 || UsedPhysicalMemorySize_Applet | ||
|- | |- | ||
| Zero || 1 || 2 || | | Zero || 1 || 2 || UsedPhysicalMemorySize_System | ||
|- | |- | ||
| Zero || 1 || 3 || | | Zero || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| Zero || 2 || 0 || | | Zero || 2 || 0 || InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| Zero || 2 || 1 || | | Zero || 2 || 1 || InitialProcessIdRange_UpperBound | ||
|} | |} | ||
Line 2,928: | Line 2,982: | ||
|- | |- | ||
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]]. | | 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]]. | ||
|- | |||
| 28 || DontCare || | |||
|} | |} | ||
Line 2,949: | Line 3,005: | ||
| 7-0 || [[#MemoryType]] || | | 7-0 || [[#MemoryType]] || | ||
|- | |- | ||
| 8 || [[#SetMemoryPermission| | | 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 || | ||
|} | |} | ||
Line 3,036: | Line 3,096: | ||
| 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0. | | 0x015C3C0D || Transfered || Mapped using [[#MapTransferMemory]] when the owning process has perm=0. | ||
|- | |- | ||
| 0x005C380E || | | 0x005C380E || SharedTransfered || Mapped using [[#MapTransferMemory]] when the owning process has perm!=0. | ||
|- | |- | ||
| 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]]. | | 0x0040380F || SharedCode || Mapped using [[#MapProcessMemory]]. | ||
|- | |- | ||
| 0x00000010 || | | 0x00000010 || Inaccessible || | ||
|- | |- | ||
| 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1. | | 0x005C3811 || [[IPC_Marshalling|NonSecureIpc]] || IPC buffers with descriptor flags=1. | ||
Line 3,046: | Line 3,106: | ||
| 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3. | | 0x004C2812 || [[IPC_Marshalling|NonDeviceIpc]] || IPC buffers with descriptor flags=3. | ||
|- | |- | ||
| 0x00002013 || | | 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 || | ||
|} | |} | ||