libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Typedefs | Enumerations | Functions
svc.h File Reference

Supervisor Calls. More...

#include <libtransistor/types.h>
#include <assert.h>
Include dependency graph for svc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PACKED
 
struct  PACKED
 
struct  debug_event_info_t
 
struct  thread_context_t
 

Macros

#define CURRENT_PROCESS   0xffff8001
 
#define CURRENT_THREAD   0xffff8000
 

Typedefs

typedef struct PACKED memory_info_t
 
typedef struct PACKED physical_memory_info_t
 

Enumerations

enum  { DEBUG_EVENT_EXIT_TYPE_PAUSED_THREAD = 0, DEBUG_EVENT_EXIT_TYPE_RUNNING_THREAD = 1, DEBUG_EVENT_EXIT_TYPE_TERMINATED_PROCESS = 2 }
 
enum  {
  DEBUG_EVENT_ATTACH_PROCESS = 0, DEBUG_EVENT_ATTACH_THREAD = 1, DEBUG_EVENT_UNKNOWN = 2, DEBUG_EVENT_EXIT = 3,
  DEBUG_EVENT_EXCEPTION = 4
}
 
enum  {
  DEBUG_EXCEPTION_UNDEFINED_INSTRUCTION = 0, DEBUG_EXCEPTION_INSTRUCTION_ABORT = 1, DEBUG_EXCEPTION_DATA_ABORT_MISC = 2, DEBUG_EXCEPTION_PC_SP_ALIGNMENT_FAULT = 3,
  DEBUG_EXCEPTION_DEBUGGER_ATTACHED = 4, DEBUG_EXCEPTION_BREAKPOINT = 5, DEBUG_EXCEPTION_USER_BREAK = 6, DEBUG_EXCEPTION_DEBUGGER_BREAK = 7,
  DEBUG_EXCEPTION_BAD_SVC_ID = 8
}
 
enum  {
  SVC_ID_SET_HEAP_SIZE = 0x01, SVC_ID_SET_MEMORY_PERMISSION = 0x02, SVC_ID_SET_MEMORY_ATTRIBUTE = 0x03, SVC_ID_MAP_MEMORY = 0x04,
  SVC_ID_UNMAP_MEMORY = 0x05, SVC_ID_QUERY_MEMORY = 0x06, SVC_ID_EXIT_PROCESS = 0x07, SVC_ID_CREATE_THREAD = 0x08,
  SVC_ID_START_THREAD = 0x09, SVC_ID_EXIT_THREAD = 0x0A, SVC_ID_SLEEP_THREAD = 0x0B, SVC_ID_GET_THREAD_PRIORITY = 0x0C,
  SVC_ID_SET_THREAD_PRIORITY = 0x0D, SVC_ID_GET_THREAD_CORE_MASK = 0x0E, SVC_ID_SET_THREAD_CORE_MASK = 0x0F, SVC_ID_GET_CURRENT_PROCESSOR_NUMBER = 0x10,
  SVC_ID_SIGNAL_EVENT = 0x11, SVC_ID_CLEAR_EVENT = 0x12, SVC_ID_MAP_SHARED_MEMORY = 0x13, SVC_ID_UNMAP_SHARED_MEMORY = 0x14,
  SVC_ID_CREATE_TRANSFER_MEMORY = 0x15, SVC_ID_CLOSE_HANDLE = 0x16, SVC_ID_RESET_SIGNAL = 0x17, SVC_ID_WAIT_SYNCHRONIZATION = 0x18,
  SVC_ID_CANCEL_SYNCHRONIZATION = 0x19, SVC_ID_ARBITRATE_LOCK = 0x1A, SVC_ID_ARBITRATE_UNLOCK = 0x1B, SVC_ID_WAIT_PROCESS_WIDE_KEY_ATOMIC = 0x1C,
  SVC_ID_SIGNAL_PROCESS_WIDE_KEY = 0x1D, SVC_ID_GET_SYSTEM_TICK = 0x1E, SVC_ID_CONNECT_TO_NAMED_PORT = 0x1F, SVC_ID_SEND_SYNC_REQUEST_LIGHT = 0x20,
  SVC_ID_SEND_SYNC_REQUEST = 0x21, SVC_ID_SEND_SYNC_REQUEST_WITH_USER_BUFFER = 0x22, SVC_ID_SEND_ASYNC_REQUEST_WITH_USER_BUFFER = 0x23, SVC_ID_GET_PROCESS_ID = 0x24,
  SVC_ID_GET_THREAD_ID = 0x25, SVC_ID_BREAK = 0x26, SVC_ID_OUTPUT_DEBUG_STRING = 0x27, SVC_ID_RETURN_FROM_EXCEPTION = 0x28,
  SVC_ID_GET_INFO = 0x29, SVC_ID_FLUSH_ENTIRE_DATA_CACHE = 0x2A, SVC_ID_FLUSH_DATA_CACHE = 0x2B, SVC_ID_GET_LAST_THREAD_INFO = 0x2C,
  SVC_ID_GET_RESOURCE_LIMIT_LIMIT_VALUE = 0x30, SVC_ID_GET_RESOURCE_LIMIT_CURRENT_VALUE = 0x31, SVC_ID_SET_THREAD_ACTIVITY = 0x32, SVC_ID_GET_THREAD_CONTEXT3 = 0x33,
  SVC_ID_DUMP_INFO = 0x3C, SVC_ID_CREATE_SESSION = 0x40, SVC_ID_ACCEPT_SESSION = 0x41, SVC_ID_REPLY_AND_RECEIVE_LIGHT = 0x42,
  SVC_ID_REPLY_AND_RECEIVE = 0x43, SVC_ID_REPLY_AND_RECEIVE_WITH_USER_BUFFER = 0x44, SVC_ID_CREATE_EVENT = 0x4E, SVC_ID_SLEEP_SYSTEM = 0x4D,
  SVC_ID_READ_WRITE_REGISTER = 0x4E, SVC_ID_SET_PROCESS_ACTIVITY = 0x4F, SVC_ID_CREATE_SHARED_MEMORY = 0x50, SVC_ID_MAP_TRANSFER_MEMORY = 0x51,
  SVC_ID_UNMAP_TRANSFER_MEMORY = 0x52, SVC_ID_CREATE_INTERRUPT_EVENT = 0x53, SVC_ID_QUERY_PHYSICAL_ADDRESS = 0x54, SVC_ID_QUERY_IO_MAPPING = 0x55,
  SVC_ID_CREATE_DEVICE_ADDRESS_SPACE = 0x56, SVC_ID_ATTACH_DEVICE_ADDRESS_SPACE = 0x57, SVC_ID_DETACH_DEVICE_ADDRESS_SPACE = 0x58, SVC_ID_MAP_DEVICE_ADDRESS_SPACE_BY_FORCE = 0x59,
  SVC_ID_MAP_DEVICE_ADDRESS_SPACE_ALIGNED = 0x5A, SVC_ID_MAP_DEVICE_ADDRESS_SPACE = 0x5B, SVC_ID_UNMAP_DEVICE_ADDRESS_SPACE = 0x5C, SVC_ID_INVALIDATE_PROCESS_DATA_CACHE = 0x5D,
  SVC_ID_STORE_PROCESS_DATA_CACHE = 0x5E, SVC_ID_FLUSH_PROCESS_DATA_CACHE = 0x5F, SVC_ID_DEBUG_ACTIVE_PROCESS = 0x60, SVC_ID_BREAK_DEBUG_PROCESS = 0x61,
  SVC_ID_TERMINATE_DEBUG_PROCESS = 0x62, SVC_ID_GET_DEBUG_EVENT = 0x63, SVC_ID_CONTINUE_DEBUG_EVENT = 0x64, SVC_ID_GET_PROCESS_LIST = 0x65,
  SVC_ID_GET_THREAD_LIST = 0x66, SVC_ID_GET_DEBUG_THREAD_CONTEXT = 0x67, SVC_ID_SET_DEBUG_THREAD_CONTEXT = 0x68, SVC_ID_QUERY_DEBUG_PROCESS_MEMORY = 0x69,
  SVC_ID_READ_DEBUG_PROCESS_MEMORY = 0x6A, SVC_ID_WRITE_DEBUG_PROCESS_MEMORY = 0x6B, SVC_ID_SET_HARDWARE_BREAK_POINT = 0x6C, SVC_ID_GET_DEBUG_THREAD_PARAM = 0x6D,
  SVC_ID_CREATE_PORT = 0x70, SVC_ID_MANAGE_NAMED_PORT = 0x71, SVC_ID_CONNECT_TO_PORT = 0x72, SVC_ID_SET_PROCESS_MEMORY_PERMISSION = 0x73,
  SVC_ID_MAP_PROCESS_MEMORY = 0x74, SVC_ID_UNMAP_PROCESS_MEMORY = 0x75, SVC_ID_QUERY_PROCESS_MEMORY = 0x76, SVC_ID_MAP_PROCESS_CODE_MEMORY = 0x77,
  SVC_ID_UNMAP_PROCESS_CODE_MEMORY = 0x78, SVC_ID_CREATE_PROCESS = 0x79, SVC_ID_START_PROCESS = 0x7A, SVC_ID_TERMINATE_PROCESS = 0x7B,
  SVC_ID_GET_PROCESS_INFO = 0x7C, SVC_ID_CREATE_RESOURCE_LIMIT = 0x7D, SVC_ID_SET_RESOURCE_LIMIT_LIMIT_VALUE = 0x7E, SVC_ID_CALL_SECURE_MONITOR = 0x7F
}
 

Functions

result_t svcSetHeapSize (void **outAddr, uint32_t size)
 Sets the size of the heap. More...
 
result_t svcSetMemoryPermission (void *addr, uint64_t size, uint32_t permission)
 Sets memory permissions. More...
 
result_t svcSetMemoryAttribute (void *addr, uint64_t size, uint32_t state0, uint32_t state1)
 Sets memory attributes. More...
 
result_t svcMapMemory (void *dest, void *src, uint64_t size)
 Map memory. More...
 
result_t svcUnmapMemory (void *dest, void *src, uint64_t size)
 Unmap memory. More...
 
result_t svcQueryMemory (memory_info_t *memory_info, uint32_t *page_info, void *addr)
 Query memory. More...
 
void __attribute__ ((__noreturn__)) svcExitProcess()
 Exit the process. More...
 
result_t svcCreateThread (thread_h *out, thread_entry entry, void *arg, void *stacktop, int32_t priority, int32_t processor_id)
 Create a new thread. More...
 
result_t svcStartThread (thread_h thread)
 Start a thread. More...
 
result_t svcSleepThread (uint64_t nanos)
 Sleep thread for specified time. More...
 
result_t svcGetThreadPriority (uint32_t *priority, thread_h thread)
 Get the thread priority. More...
 
result_t svcSetThreadPriority (thread_h thread, uint32_t priority)
 Set a thread's priority. More...
 
result_t svcSetThreadCoreMask (thread_h thread, uint32_t in, uint64_t in2)
 Set thread core mask. More...
 
uint32_t svcGetCurrentProcessorNumber ()
 Get the current processor number.
 
result_t svcSignalEvent (wevent_h event)
 Signal an event. More...
 
result_t svcClearEvent (event_h event)
 Clear an event. More...
 
result_t svcMapSharedMemory (shared_memory_h block, void *addr, uint64_t size, uint32_t permission)
 Map shared memory. More...
 
result_t svcUnmapSharedMemory (shared_memory_h block, void *addr, uint64_t size)
 Unmap shared memory. More...
 
result_t svcCreateTransferMemory (transfer_memory_h *out, void *addr, uint64_t size, uint32_t permission)
 Create transfer memory. More...
 
result_t svcCloseHandle (handle_t handle)
 Closes the specified handle. More...
 
result_t svcResetSignal (handle_t signal)
 Resets a signal. More...
 
result_t svcWaitSynchronization (uint32_t *handle_index, handle_t *handles, uint32_t num_handles, uint64_t timeout)
 Wait synchronization. More...
 
result_t svcCancelSynchronization (handle_t handle)
 Cancel synchronization. More...
 
void svcArbitrateLock (thread_h current_thread, void *lock, thread_h requesting_thread)
 Arbitrate lock. More...
 
void svcArbitrateUnlock (void *lock)
 Arbitrate unlock. More...
 
result_t svcWaitProcessWideKeyAtomic (void *ptr0, void *ptr1, thread_h thread, uint64_t timeout)
 Wait process wide key atomic. More...
 
result_t svcSignalProcessWideKey (void *ptr, uint32_t value)
 Wait process wide key atomic. More...
 
uint64_t svcGetSystemTick ()
 Get the system time tick.
 
result_t svcConnectToNamedPort (session_h *out, char name[8])
 Connect to a named port. More...
 
result_t svcSendSyncRequestLight (handle_t handle)
 
result_t svcSendSyncRequest (session_h session)
 Send sync request. More...
 
result_t svcSendSyncRequestWithUserBuffer (void *buffer, uint64_t size, session_h session)
 Send sync request with user buffer. More...
 
result_t svcSendAsyncRequestWithUserBuffer (revent_h *event_handle, void *buffer, uint64_t size, session_h session)
 Send an IPC request asynchronously. More...
 
result_t svcGetProcessId (uint64_t *pid, handle_t thread_or_process_handle)
 Get a process's ID. More...
 
result_t svcGetThreadId (thread_h *handle_out, thread_h handle_in)
 Get a thread ID. More...
 
result_t svcBreak (uint64_t reason, uint64_t unknown, uint64_t info)
 Break to debugger.
 
void svcOutputDebugString (char *str, uint64_t size)
 Output a debug string. More...
 
void svcReturnFromException (uint64_t result)
 Return from exception. More...
 
result_t svcGetInfo (void *info, uint64_t info_id, handle_t handle, uint64_t info_sub_id)
 Get info. More...
 
void svcFlushEntireDataCache ()
 Flushes the entire data cache.
 
result_t svcFlushDataCache (void *addr, size_t size)
 Flushes data cache for a certain memory region.
 
result_t svcMapPhysicalMemory (void *addr, size_t size)
 Maps size bytes of type-5 memory at addr. More...
 
result_t svcUnmapPhysicalMemory (void *addr, size_t size)
 Unmaps memory mapped by svcMapPhysicalMemory. More...
 
result_t svcGetLastThreadInfo (void *last_thread_context, uint64_t *unknown1, uint64_t *unknown2)
 
result_t svcGetResourceLimitLimitValue (uint64_t *value, handle_t limit_handle, uint32_t limitable_resource)
 Gets the limit value for a resource limit. More...
 
result_t svcGetResourceLimitCurrentValue (uint64_t *value, handle_t limit_handle, uint32_t limitable_resource)
 Gets the current value for a resource limit. More...
 
result_t svcSetThreadActivity (thread_h thread_handle, bool active)
 Allows or disallows scheduling of a thread.
 
result_t svcGetThreadContext3 (thread_context_t *thread_context, thread_h thread_handle)
 
result_t svcCreateSession (session_h *server, session_h *client, bool is_light, uint32_t unknown)
 Creates an IPC session. More...
 
result_t svcAcceptSession (session_h *out, port_h port)
 Accepts an IPC session on the given port. More...
 
result_t svcReplyAndReceive (uint32_t *handle_idx, session_h *handles, uint32_t num_handles, session_h reply_session, uint64_t timeout)
 Sends a reply to the given session, then receives a request. More...
 
result_t svcReplyAndReceiveWithUserBuffer (uint32_t *handle_idx, void *buffer, uint64_t size, session_h *handles, uint32_t num_handles, session_h reply_session, uint64_t timeout)
 See svcReplyAndReceive. More...
 
result_t svcCreateEvent (wevent_h *wevent, revent_h *revent)
 Creates an event object. More...
 
void svcSleepSystem ()
 
result_t svcReadWriteRegister (uint32_t *out_value, uint64_t addr, uint32_t rw_mask, uint32_t in_value)
 Read/Write register. More...
 
result_t svcSetProcessActivity (process_h process, bool active)
 
result_t svcCreateSharedMemory (shared_memory_h *out, uint64_t size, uint32_t self_permissions, uint32_t foreign_permissions)
 Create a block of shared memory. More...
 
result_t svcMapTransferMemory (transfer_memory_h handle, void *addr, uint64_t size, uint32_t perm)
 Map transfer memory. More...
 
result_t svcUnmapTransferMemory (transfer_memory_h handle, void *addr, uint64_t size)
 Unmap transfer memory. More...
 
result_t svcCreateInterruptEvent (revent_h *event, uint64_t interrupt, uint32_t interrupt_type)
 
result_t svcQueryPhysicalAddress (physical_memory_info_t *info, void *addr)
 
result_t svcQueryIoMapping (void *virt_addr, uint64_t phys_addr, uint64_t size)
 Query IO mapping. More...
 
result_t svcCreateDeviceAddressSpace (dev_addr_space_h *out, uint64_t start_addr, uint64_t end_addr)
 
result_t svcAttachDeviceAddressSpace (uint32_t device_name, dev_addr_space_h space)
 Attach device address space. More...
 
result_t svcDetachDeviceAddressSpace (uint32_t device_name, dev_addr_space_h space)
 Detach device address space. More...
 
result_t svcMapDeviceAddressSpaceByForce (dev_addr_space_h space, process_h process, uint64_t dev_addr, uint64_t dev_size, uint64_t map_addr, uint32_t perm)
 Map device address space by force. More...
 
result_t svcMapDeviceAddressSpaceAligned (dev_addr_space_h space, process_h process, uint64_t dev_addr, uint64_t dev_size, uint64_t map_addr, uint32_t perm)
 Map device address space aligned. More...
 
result_t svcMapDeviceAddressSpace (uint64_t *unknown1, handle_t unknown2, handle_t unknown3, uint64_t dev_addr, uint64_t dev_size, uint64_t map_addr, uint32_t perm)
 
result_t svcUnmapDeviceAddressSpace (dev_addr_space_h space, process_h process, uint64_t map_addr, uint64_t map_size, uint32_t perm)
 Unmap device address space. More...
 
result_t svcInvalidateProcessDataCache (process_h process, uint64_t addr, size_t size)
 
result_t svcStoreProcessDataCache (process_h process, uint64_t addr, size_t size)
 
result_t svcFlushProcessDataCache (process_h process, uint64_t addr, size_t size)
 
result_t svcDebugActiveProcess (debug_h *out, uint64_t process_id)
 Debug active process. More...
 
result_t svcBreakDebugProcess (debug_h debug)
 
result_t svcTerminateDebugProcess (debug_h debug)
 
result_t svcGetDebugEvent (debug_event_info_t *info, debug_h debug)
 
result_t svcContinueDebugEventOld (debug_h debug, uint32_t continue_debug_flags_old, uint64_t thread_id)
 
result_t svcContinueDebugEvent (debug_h debug, uint32_t continue_debug_flags, uint64_t *thread_id_list, uint32_t num_threads)
 
result_t svcGetProcessList (uint32_t *num_out, uint64_t *pids_out, uint32_t max_out)
 
result_t svcGetThreadList (uint32_t *num_out, uint64_t *tids_out, uint32_t max_out, debug_h debug)
 
result_t svcGetDebugThreadContext (thread_context_t *context, debug_h handle, uint64_t thread_id, uint32_t thread_context_flags)
 
result_t svcSetDebugThreadContext (debug_h handle, uint64_t thread_id, thread_context_t *context, uint32_t thread_context_flags)
 
result_t svcQueryDebugProcessMemory (memory_info_t *memory_info, uint32_t *page_info, debug_h debug, uint64_t addr)
 Query debug process memory. More...
 
result_t svcReadDebugProcessMemory (void *buffer, debug_h debug, uint64_t addr, uint64_t size)
 Read debug process memory. More...
 
result_t svcWriteDebugProcessMemory (debug_h debug, void *buffer, uint64_t addr, uint64_t size)
 Write debug process memory. More...
 
result_t svcSetHardwareBreakPoint (uint32_t hw_bkpt_id, uint64_t flags, uint64_t value_or_debug_handle)
 
result_t svcGetDebugThreadParam (uint64_t *param1, uint32_t *param2, debug_h handle, uint64_t thread_id, uint32_t debug_thread_param)
 
result_t svcCreatePort (handle_t *client, handle_t *server, uint32_t max_sessions, uint32_t is_light, const char *name_ptr)
 
result_t svcConnectToPort (handle_t *session, handle_t port)
 
result_t svcSetProcessMemoryPermission (process_h process, uint64_t addr, uint64_t size, uint32_t prot)
 Reprotect memory in the given process. More...
 
result_t svcMapProcessMemory (void *src, process_h process, uint64_t dst, uint64_t size)
 Map memory in the given process.
 
result_t svcUnmapProcessMemory (void *src, process_h process, uint64_t dst, uint64_t size)
 Unmap memory mapped via svcMapProcessMemory.
 
result_t svcQueryProcessMemory (memory_info_t *memory_info, uint32_t *page_info, process_h proc, uint64_t addr)
 
result_t svcMapProcessCodeMemory (process_h process, void *dst, void *src, uint64_t size)
 Map process code memory.
 
result_t svcUnmapProcessCodeMemory (process_h process, void *dst, void *src, uint64_t size)
 Unmap process code memory.
 
result_t svcCreateProcess (process_h *process, void *procinfo, void *caps, uint32_t cap_num)
 Creates a new process.
 
result_t svcStartProcess (process_h process, uint32_t main_thread_prio, uint32_t default_cpuid, uint32_t main_thread_stack_size)
 Starts the given process.
 
result_t svcTerminateProcess (process_h process)
 
result_t svcGetProcessInfo (uint64_t *info, process_h process, uint32_t type)
 
result_t svcCreateResourceLimit (resource_limit_h *limit)
 
result_t svcSetResourceLimitLimitValue (resource_limit_h limit, uint32_t resource, uint64_t value)
 

Detailed Description

Supervisor Calls.

Function Documentation

void __attribute__ ( (__noreturn__)  )

Exit the process.

Exit thread.

result_t svcAcceptSession ( session_h out,
port_h  port 
)

Accepts an IPC session on the given port.

Parameters
outServer side of new connection
portPort to accept connection on
void svcArbitrateLock ( thread_h  current_thread,
void *  lock,
thread_h  requesting_thread 
)

Arbitrate lock.

Parameters
current_threadDescription
lockDescription
requesting_threadDescription
void svcArbitrateUnlock ( void *  lock)

Arbitrate unlock.

Parameters
lockDescription
result_t svcAttachDeviceAddressSpace ( uint32_t  device_name,
dev_addr_space_h  space 
)

Attach device address space.

Parameters
deviceDevice to attach address space to
spaceAddress space to attach
result_t svcCancelSynchronization ( handle_t  handle)

Cancel synchronization.

Parameters
handleDescription
result_t svcClearEvent ( event_h  event)

Clear an event.

Parameters
eventDescription
result_t svcCloseHandle ( handle_t  handle)

Closes the specified handle.

Parameters
handleDescription
result_t svcConnectToNamedPort ( session_h out,
char  name[8] 
)

Connect to a named port.

Parameters
outDescription
nameDescription
result_t svcCreateEvent ( wevent_h wevent,
revent_h revent 
)

Creates an event object.

Parameters
weventOutput for write end of event
reventOutput for read end of event
result_t svcCreateSession ( session_h server,
session_h client,
bool  is_light,
uint32_t  unknown 
)

Creates an IPC session.

Parameters
serverServer side of pipe
clientClient side of pipe
is_lightWhether to make a light session or not
result_t svcCreateSharedMemory ( shared_memory_h out,
uint64_t  size,
uint32_t  self_permissions,
uint32_t  foreign_permissions 
)

Create a block of shared memory.

Parameters
outDescription
sizeDescription
self_permissionsDescription
foreign_permissionsDescription
result_t svcCreateThread ( thread_h out,
thread_entry  entry,
void *  arg,
void *  stacktop,
int32_t  priority,
int32_t  processor_id 
)

Create a new thread.

Parameters
outDescription
entryDescription
argDescription
stacktopDescription
priorityDescription
processor_idDescription
result_t svcCreateTransferMemory ( transfer_memory_h out,
void *  addr,
uint64_t  size,
uint32_t  permission 
)

Create transfer memory.

Parameters
outDescription
addrDescription
sizeDescription
permissionDescription
result_t svcDebugActiveProcess ( debug_h out,
uint64_t  process_id 
)

Debug active process.

Parameters
outDescription
process_idDescription
result_t svcDetachDeviceAddressSpace ( uint32_t  device_name,
dev_addr_space_h  space 
)

Detach device address space.

Parameters
deviceDescription
spaceDescription
result_t svcGetInfo ( void *  info,
uint64_t  info_id,
handle_t  handle,
uint64_t  info_sub_id 
)

Get info.

Parameters
infoDescription
info_idDescription
handleDescription
info_sub_idDescription
result_t svcGetProcessId ( uint64_t *  pid,
handle_t  thread_or_process_handle 
)

Get a process's ID.

Parameters
pidOutput PID
thread_or_process_handleThread or process to query PID of
result_t svcGetResourceLimitCurrentValue ( uint64_t *  value,
handle_t  limit_handle,
uint32_t  limitable_resource 
)

Gets the current value for a resource limit.

Parameters
valueOutput
limit_handleHandle for the resource limit object
limitable_resourceType of resource to query
result_t svcGetResourceLimitLimitValue ( uint64_t *  value,
handle_t  limit_handle,
uint32_t  limitable_resource 
)

Gets the limit value for a resource limit.

Parameters
valueOutput
limit_handleHandle for the resource limit object
limitable_resourceType of resource to query
result_t svcGetThreadId ( thread_h handle_out,
thread_h  handle_in 
)

Get a thread ID.

Parameters
handle_outDescription
handle_inDescription
result_t svcGetThreadPriority ( uint32_t *  priority,
thread_h  thread 
)

Get the thread priority.

Parameters
priorityDescription
threadDescription
result_t svcMapDeviceAddressSpaceAligned ( dev_addr_space_h  space,
process_h  process,
uint64_t  dev_addr,
uint64_t  dev_size,
uint64_t  map_addr,
uint32_t  perm 
)

Map device address space aligned.

Parameters
spaceDescription
processDescription
dev_addrDescription
dev_sizeDescription
map_addrDescription
permDescription
result_t svcMapDeviceAddressSpaceByForce ( dev_addr_space_h  space,
process_h  process,
uint64_t  dev_addr,
uint64_t  dev_size,
uint64_t  map_addr,
uint32_t  perm 
)

Map device address space by force.

Parameters
spaceDescription
processDescription
dev_addrDescription
dev_sizeDescription
map_addrDescription
permDescription
result_t svcMapMemory ( void *  dest,
void *  src,
uint64_t  size 
)

Map memory.

Parameters
destDescription
srcDescription
sizeDescription
result_t svcMapPhysicalMemory ( void *  addr,
size_t  size 
)

Maps size bytes of type-5 memory at addr.

Parameters
addrAddress to map memory at
sizeAmount of memory to map
result_t svcMapSharedMemory ( shared_memory_h  block,
void *  addr,
uint64_t  size,
uint32_t  permission 
)

Map shared memory.

Parameters
blockDescription
addrDescription
sizeDescription
permissionDescription
result_t svcMapTransferMemory ( transfer_memory_h  handle,
void *  addr,
uint64_t  size,
uint32_t  perm 
)

Map transfer memory.

Parameters
handleDescription
addrDescription
sizeDescription
permDescription
void svcOutputDebugString ( char *  str,
uint64_t  size 
)

Output a debug string.

Parameters
strDescription
sizeDescription
result_t svcQueryDebugProcessMemory ( memory_info_t memory_info,
uint32_t *  page_info,
debug_h  debug,
uint64_t  addr 
)

Query debug process memory.

Parameters
memory_infoDescription
page_infoDescription
debugDescription
addrDescription
result_t svcQueryIoMapping ( void *  virt_addr,
uint64_t  phys_addr,
uint64_t  size 
)

Query IO mapping.

Parameters
virt_addrDescription
phys_addrDescription
sizeDescription
result_t svcQueryMemory ( memory_info_t memory_info,
uint32_t *  page_info,
void *  addr 
)

Query memory.

Parameters
memory_infoDescription
page_infoDescription
addrDescription
result_t svcReadDebugProcessMemory ( void *  buffer,
debug_h  debug,
uint64_t  addr,
uint64_t  size 
)

Read debug process memory.

Parameters
bufferDescription
debugDescription
addrDescription
sizeDescription
result_t svcReadWriteRegister ( uint32_t *  out_value,
uint64_t  addr,
uint32_t  rw_mask,
uint32_t  in_value 
)

Read/Write register.

Parameters
out_valueDescription
addrDescription
rw_maskDescription
in_valueDescription
result_t svcReplyAndReceive ( uint32_t *  handle_idx,
session_h handles,
uint32_t  num_handles,
session_h  reply_session,
uint64_t  timeout 
)

Sends a reply to the given session, then receives a request.

Parameters
handle_idxOutput for index of signalled handle
handlesHandles to try to receive from
num_handlesNumber of handles to try to receive from
reply_sessionSession to reply to
timeoutHow long to wait for an incoming message
result_t svcReplyAndReceiveWithUserBuffer ( uint32_t *  handle_idx,
void *  buffer,
uint64_t  size,
session_h handles,
uint32_t  num_handles,
session_h  reply_session,
uint64_t  timeout 
)

See svcReplyAndReceive.

Parameters
handle_idxOutput for index of signalled handle
bufferCommand buffer
sizeSize of command buffer
handlesHandles to try to receive from
num_handlesNumber of handles to try to receive from
reply_sessionSession to reply to
timeoutHow long to wait for an incoming message
result_t svcResetSignal ( handle_t  signal)

Resets a signal.

revent or process

Parameters
signalDescription
void svcReturnFromException ( uint64_t  result)

Return from exception.

Parameters
resultDescription
result_t svcSendAsyncRequestWithUserBuffer ( revent_h event_handle,
void *  buffer,
uint64_t  size,
session_h  session 
)

Send an IPC request asynchronously.

Parameters
event_handleOutput for event handle
bufferCommand buffer
sizeSize of command buffer
sessionSession to send request to
result_t svcSendSyncRequest ( session_h  session)

Send sync request.

Parameters
sessionDescription
result_t svcSendSyncRequestWithUserBuffer ( void *  buffer,
uint64_t  size,
session_h  session 
)

Send sync request with user buffer.

Parameters
bufferDescription
sizeDescription
sessionDescription
result_t svcSetHeapSize ( void **  outAddr,
uint32_t  size 
)

Sets the size of the heap.

Parameters
outAddrOutput for address of the heap
sizeSize of the heap
result_t svcSetMemoryAttribute ( void *  addr,
uint64_t  size,
uint32_t  state0,
uint32_t  state1 
)

Sets memory attributes.

Parameters
addrDescription
sizeDescription
state0Description
state1Description
result_t svcSetMemoryPermission ( void *  addr,
uint64_t  size,
uint32_t  permission 
)

Sets memory permissions.

Parameters
addrAdress of region to reprotect
sizeSize of region to reprotect
permissionPermissions

addr and size must be page-aligned, and execute bit is not allowed.

result_t svcSetProcessMemoryPermission ( process_h  process,
uint64_t  addr,
uint64_t  size,
uint32_t  prot 
)

Reprotect memory in the given process.

Parameters
processProcess to reprotect memory in
addrAddress in given process
sizeSize of region to reprotect
protProtections
result_t svcSetThreadCoreMask ( thread_h  thread,
uint32_t  in,
uint64_t  in2 
)

Set thread core mask.

Parameters
threadDescription
inDescription
in2Description
result_t svcSetThreadPriority ( thread_h  thread,
uint32_t  priority 
)

Set a thread's priority.

Parameters
priorityDescription
threadDescription
result_t svcSignalEvent ( wevent_h  event)

Signal an event.

Parameters
eventDescription
result_t svcSignalProcessWideKey ( void *  ptr,
uint32_t  value 
)

Wait process wide key atomic.

Parameters
ptrDescription
valueDescription
result_t svcSleepThread ( uint64_t  nanos)

Sleep thread for specified time.

Parameters
nanosAmount of time in nanoseconds
result_t svcStartThread ( thread_h  thread)

Start a thread.

Parameters
threadThe handle to the thread to be started
result_t svcUnmapDeviceAddressSpace ( dev_addr_space_h  space,
process_h  process,
uint64_t  map_addr,
uint64_t  map_size,
uint32_t  perm 
)

Unmap device address space.

Parameters
spaceDescription
processDescription
map_addrDescription
map_sizeDescription
permDescription
result_t svcUnmapMemory ( void *  dest,
void *  src,
uint64_t  size 
)

Unmap memory.

Parameters
destDescription
srcDescription
sizeDescription
result_t svcUnmapPhysicalMemory ( void *  addr,
size_t  size 
)

Unmaps memory mapped by svcMapPhysicalMemory.

Parameters
addrAddress of memory to unmap
sizeAmount of memory to unmap
result_t svcUnmapSharedMemory ( shared_memory_h  block,
void *  addr,
uint64_t  size 
)

Unmap shared memory.

Parameters
blockDescription
addrDescription
sizeDescription
result_t svcUnmapTransferMemory ( transfer_memory_h  handle,
void *  addr,
uint64_t  size 
)

Unmap transfer memory.

Parameters
handleDescription
addrDescription
sizeDescription
result_t svcWaitProcessWideKeyAtomic ( void *  ptr0,
void *  ptr1,
thread_h  thread,
uint64_t  timeout 
)

Wait process wide key atomic.

Parameters
ptr0Description
ptr1Description
threadDescription
timeoutDescription
result_t svcWaitSynchronization ( uint32_t *  handle_index,
handle_t handles,
uint32_t  num_handles,
uint64_t  timeout 
)

Wait synchronization.

Parameters
handle_indexDescription
handlesDescription
num_handlesDescription
timeoutDescription
result_t svcWriteDebugProcessMemory ( debug_h  debug,
void *  buffer,
uint64_t  addr,
uint64_t  size 
)

Write debug process memory.

Parameters
bufferDescription
debugDescription
addrDescription
sizeDescription