libctru
v2.4.1
|
Syscall wrappers. More...
#include "types.h"
Go to the source code of this file.
Data Structures | |
struct | MemInfo |
Memory information. More... | |
struct | PageInfo |
Memory page information. More... | |
struct | DmaDeviceConfig |
Device configuration structure, part of DmaConfig. More... | |
struct | DmaConfig |
Configuration stucture for svcStartInterProcessDma. More... | |
struct | AttachProcessEvent |
Event relating to the attachment of a process. More... | |
struct | ExitProcessEvent |
Event relating to the exiting of a process. More... | |
struct | AttachThreadEvent |
Event relating to the attachment of a thread. More... | |
struct | ExitThreadEvent |
Event relating to the exiting of a thread. More... | |
struct | FaultExceptionEvent |
Event relating to fault exceptions (CPU exceptions other than stop points and undefined syscalls). More... | |
struct | StopPointExceptionEvent |
Event relating to stop points. More... | |
struct | UserBreakExceptionEvent |
Event relating to svcBreak. More... | |
struct | DebuggerBreakExceptionEvent |
Event relating to svcBreakDebugProcess. More... | |
struct | ExceptionEvent |
Event relating to exceptions. More... | |
struct | ScheduleInOutEvent |
Event relating to the scheduler. More... | |
struct | SyscallInOutEvent |
Event relating to syscalls. More... | |
struct | OutputStringEvent |
Event relating to debug output. More... | |
struct | MapEvent |
Event relating to the mapping of memory. More... | |
struct | DebugEventInfo |
Information about a debug event. More... | |
struct | ThreadContext |
struct | CodeSetHeader |
Information on address space for process. All sizes are in pages (0x1000 bytes) More... | |
struct | StartupInfo |
Information for the main thread of a process. More... | |
Macros | |
#define | CUR_PROCESS_HANDLE 0xFFFF8001 |
Pseudo handle for the current process. | |
#define | SVC_STOP_POINT __asm__ volatile("svc 0xFF"); |
Stop point, does nothing if the process is not attached (as opposed to 'bkpt' instructions) | |
Functions | |
static void * | getThreadLocalStorage (void) |
Gets the thread local storage buffer. More... | |
static u32 * | getThreadCommandBuffer (void) |
Gets the thread command buffer. More... | |
static u32 * | getThreadStaticBuffers (void) |
Gets the thread static buffer. More... | |
Result | svcBackdoor (s32(*callback)(void)) |
Executes a function in supervisor mode. More... | |
Process management | |
Result | svcOpenProcess (Handle *process, u32 processId) |
Gets the handle of a process. More... | |
void | svcExitProcess (void) __attribute__((noreturn)) |
Exits the current process. | |
Result | svcTerminateProcess (Handle process) |
Terminates a process. More... | |
Result | svcGetProcessInfo (s64 *out, Handle process, u32 type) |
Gets information about a process. More... | |
Result | svcGetProcessId (u32 *out, Handle handle) |
Gets the ID of a process. More... | |
Result | svcGetProcessList (s32 *processCount, u32 *processIds, s32 processIdMaxCount) |
Gets a list of running processes. More... | |
Result | svcGetThreadList (s32 *threadCount, u32 *threadIds, s32 threadIdMaxCount, Handle process) |
Gets a list of the threads of a process. More... | |
Result | svcCreatePort (Handle *portServer, Handle *portClient, const char *name, s32 maxSessions) |
Creates a port. More... | |
Result | svcConnectToPort (volatile Handle *out, const char *portName) |
Connects to a port. More... | |
Result | svcCreateCodeSet (Handle *out, const CodeSetHeader *info, u32 textSegmentLma, u32 roSegmentLma, u32 dataSegmentLma) |
Sets up virtual address space for a new process. More... | |
Result | svcCreateProcess (Handle *out, Handle codeset, const u32 *arm11KernelCaps, s32 numArm11KernelCaps) |
Create a new process. More... | |
Result | svcGetProcessAffinityMask (u8 *affinitymask, Handle process, s32 processorcount) |
Gets a process's affinity mask. More... | |
Result | svcSetProcessAffinityMask (Handle process, const u8 *affinitymask, s32 processorcount) |
Sets a process's affinity mask. More... | |
Result | svcGetProcessIdealProcessor (s32 *processorid, Handle process) |
Gets a process's ideal processor. More... | |
Result | svcSetProcessIdealProcessor (Handle process, s32 processorid) |
Sets a process's ideal processor. More... | |
Result | svcRun (Handle process, const StartupInfo *info) |
Launches the main thread of the process. More... | |
Synchronization | |
Result | svcCreateMutex (Handle *mutex, bool initially_locked) |
Creates a mutex. More... | |
Result | svcReleaseMutex (Handle handle) |
Releases a mutex. More... | |
Result | svcCreateSemaphore (Handle *semaphore, s32 initial_count, s32 max_count) |
Creates a semaphore. More... | |
Result | svcReleaseSemaphore (s32 *count, Handle semaphore, s32 release_count) |
Releases a semaphore. More... | |
Result | svcCreateEvent (Handle *event, ResetType reset_type) |
Creates an event handle. More... | |
Result | svcSignalEvent (Handle handle) |
Signals an event. More... | |
Result | svcClearEvent (Handle handle) |
Clears an event. More... | |
Result | svcWaitSynchronization (Handle handle, s64 nanoseconds) |
Waits for synchronization on a handle. More... | |
Result | svcWaitSynchronizationN (s32 *out, const Handle *handles, s32 handles_num, bool wait_all, s64 nanoseconds) |
Waits for synchronization on multiple handles. More... | |
Result | svcCreateAddressArbiter (Handle *arbiter) |
Creates an address arbiter. More... | |
Result | svcArbitrateAddress (Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 timeout_ns) |
Arbitrate an address, can be used for synchronization. More... | |
Result | svcArbitrateAddressNoTimeout (Handle arbiter, u32 addr, ArbitrationType type, s32 value) |
Same as svcArbitrateAddress but with the timeout_ns parameter undefined. More... | |
Result | svcSendSyncRequest (Handle session) |
Sends a synchronized request to a session handle. More... | |
Result | svcCreateSessionToPort (Handle *clientSession, Handle clientPort) |
Connects to a port via a handle. More... | |
Result | svcCreateSession (Handle *serverSession, Handle *clientSession) |
Creates a linked pair of session endpoints. More... | |
Result | svcAcceptSession (Handle *session, Handle port) |
Accepts a session. More... | |
Result | svcReplyAndReceive (s32 *index, const Handle *handles, s32 handleCount, Handle replyTarget) |
Replies to and receives a new request. More... | |
Time | |
Result | svcCreateTimer (Handle *timer, ResetType reset_type) |
Creates a timer. More... | |
Result | svcSetTimer (Handle timer, s64 initial, s64 interval) |
Sets a timer. More... | |
Result | svcCancelTimer (Handle timer) |
Cancels a timer. More... | |
Result | svcClearTimer (Handle timer) |
Clears a timer. More... | |
u64 | svcGetSystemTick (void) |
Gets the current system tick. More... | |
System | |
Result | svcCloseHandle (Handle handle) |
Closes a handle. More... | |
Result | svcDuplicateHandle (Handle *out, Handle original) |
Duplicates a handle. More... | |
Result | svcGetHandleInfo (s64 *out, Handle handle, u32 param) |
Gets a handle info. More... | |
Result | svcGetSystemInfo (s64 *out, u32 type, s32 param) |
Gets the system info. More... | |
Result | svcKernelSetState (u32 type,...) |
Sets the current kernel state. More... | |
Memory management | |
#define | ARBITRATION_SIGNAL_ALL (-1) |
Special value to signal all the threads. | |
enum | MemOp { MEMOP_FREE = 1 , MEMOP_RESERVE = 2 , MEMOP_ALLOC = 3 , MEMOP_MAP = 4 , MEMOP_UNMAP = 5 , MEMOP_PROT = 6 , MEMOP_REGION_APP = 0x100 , MEMOP_REGION_SYSTEM = 0x200 , MEMOP_REGION_BASE = 0x300 , MEMOP_OP_MASK = 0xFF , MEMOP_REGION_MASK = 0xF00 , MEMOP_LINEAR_FLAG = 0x10000 , MEMOP_ALLOC_LINEAR = MEMOP_LINEAR_FLAG | MEMOP_ALLOC } |
svcControlMemory operation flags More... | |
enum | MemState { MEMSTATE_FREE = 0 , MEMSTATE_RESERVED = 1 , MEMSTATE_IO = 2 , MEMSTATE_STATIC = 3 , MEMSTATE_CODE = 4 , MEMSTATE_PRIVATE = 5 , MEMSTATE_SHARED = 6 , MEMSTATE_CONTINUOUS = 7 , MEMSTATE_ALIASED = 8 , MEMSTATE_ALIAS = 9 , MEMSTATE_ALIASCODE = 10 , MEMSTATE_LOCKED = 11 } |
The state of a memory block. More... | |
enum | MemPerm { MEMPERM_READ = 1 , MEMPERM_WRITE = 2 , MEMPERM_EXECUTE = 4 , MEMPERM_READWRITE = MEMPERM_READ | MEMPERM_WRITE , MEMPERM_READEXECUTE = MEMPERM_READ | MEMPERM_EXECUTE , MEMPERM_DONTCARE = 0x10000000 } |
Memory permission flags. More... | |
enum | MemRegion { MEMREGION_ALL = 0 , MEMREGION_APPLICATION = 1 , MEMREGION_SYSTEM = 2 , MEMREGION_BASE = 3 } |
Memory regions. More... | |
enum | ArbitrationType { ARBITRATION_SIGNAL = 0 , ARBITRATION_WAIT_IF_LESS_THAN = 1 , ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN = 2 , ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT = 3 , ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT = 4 } |
Arbitration modes. More... | |
Result | svcControlMemory (u32 *addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm) |
Controls memory mapping. More... | |
Result | svcControlProcessMemory (Handle process, u32 addr0, u32 addr1, u32 size, u32 type, u32 perm) |
Controls the memory mapping of a process. More... | |
Result | svcCreateMemoryBlock (Handle *memblock, u32 addr, u32 size, MemPerm my_perm, MemPerm other_perm) |
Creates a block of shared memory. More... | |
Result | svcMapMemoryBlock (Handle memblock, u32 addr, MemPerm my_perm, MemPerm other_perm) |
Maps a block of shared memory. More... | |
Result | svcMapProcessMemory (Handle process, u32 destAddress, u32 size) |
Maps a block of process memory, starting from address 0x00100000. More... | |
Result | svcUnmapProcessMemory (Handle process, u32 destAddress, u32 size) |
Unmaps a block of process memory, starting from address 0x00100000. More... | |
Result | svcUnmapMemoryBlock (Handle memblock, u32 addr) |
Unmaps a block of shared memory. More... | |
Result | svcQueryMemory (MemInfo *info, PageInfo *out, u32 addr) |
Queries memory information. More... | |
Result | svcQueryProcessMemory (MemInfo *info, PageInfo *out, Handle process, u32 addr) |
Queries process memory information. More... | |
Multithreading | |
#define | CUR_THREAD_HANDLE 0xFFFF8000 |
Pseudo handle for the current thread. | |
enum | ResetType { RESET_ONESHOT = 0 , RESET_STICKY = 1 , RESET_PULSE = 2 } |
Reset types (for use with events and timers) More... | |
enum | ThreadInfoType { THREADINFO_TYPE_UNKNOWN } |
Types of thread info. More... | |
enum | ResourceLimitType { RESLIMIT_PRIORITY = 0 , RESLIMIT_COMMIT = 1 , RESLIMIT_THREAD = 2 , RESLIMIT_EVENT = 3 , RESLIMIT_MUTEX = 4 , RESLIMIT_SEMAPHORE = 5 , RESLIMIT_TIMER = 6 , RESLIMIT_SHAREDMEMORY = 7 , RESLIMIT_ADDRESSARBITER = 8 , RESLIMIT_CPUTIME = 9 , RESLIMIT_BIT = BIT(31) } |
Types of resource limit. More... | |
Result | svcCreateThread (Handle *thread, ThreadFunc entrypoint, u32 arg, u32 *stack_top, s32 thread_priority, s32 processor_id) |
Creates a new thread. More... | |
Result | svcOpenThread (Handle *thread, Handle process, u32 threadId) |
Gets the handle of a thread. More... | |
void | svcExitThread (void) __attribute__((noreturn)) |
Exits the current thread. More... | |
void | svcSleepThread (s64 ns) |
Puts the current thread to sleep. More... | |
Result | svcGetThreadPriority (s32 *out, Handle handle) |
Retrieves the priority of a thread. | |
Result | svcSetThreadPriority (Handle thread, s32 prio) |
Changes the priority of a thread. More... | |
Result | svcGetThreadAffinityMask (u8 *affinitymask, Handle thread, s32 processorcount) |
Gets a thread's affinity mask. More... | |
Result | svcSetThreadAffinityMask (Handle thread, const u8 *affinitymask, s32 processorcount) |
Sets a thread's affinity mask. More... | |
Result | svcGetThreadIdealProcessor (s32 *processorid, Handle thread) |
Gets a thread's ideal processor. More... | |
Result | svcSetThreadIdealProcessor (Handle thread, s32 processorid) |
Sets a thread's ideal processor. More... | |
s32 | svcGetProcessorID (void) |
Returns the ID of the processor the current thread is running on. More... | |
Result | svcGetThreadId (u32 *out, Handle handle) |
Gets the ID of a thread. More... | |
Result | svcGetResourceLimit (Handle *resourceLimit, Handle process) |
Gets the resource limit set of a process. More... | |
Result | svcGetResourceLimitLimitValues (s64 *values, Handle resourceLimit, ResourceLimitType *names, s32 nameCount) |
Gets the value limits of a resource limit set. More... | |
Result | svcGetResourceLimitCurrentValues (s64 *values, Handle resourceLimit, ResourceLimitType *names, s32 nameCount) |
Gets the values of a resource limit set. More... | |
Result | svcSetProcessResourceLimits (Handle process, Handle resourceLimit) |
Sets the resource limit set of a process. More... | |
Result | svcCreateResourceLimit (Handle *resourceLimit) |
Creates a resource limit set. More... | |
Result | svcSetResourceLimitValues (Handle resourceLimit, const ResourceLimitType *names, const s64 *values, s32 nameCount) |
Sets the value limits of a resource limit set. More... | |
Result | svcGetProcessIdOfThread (u32 *out, Handle handle) |
Gets the process ID of a thread. More... | |
Result | svcGetThreadInfo (s64 *out, Handle thread, ThreadInfoType type) |
Checks if a thread handle is valid. More... | |
Device drivers | |
enum | DmaState { DMASTATE_STARTING = 0 , DMASTATE_WFP_DST = 1 , DMASTATE_WFP_SRC = 2 , DMASTATE_RUNNING = 3 , DMASTATE_DONE = 4 } |
DMA transfer state. More... | |
enum | { DMACFG_SRC_IS_DEVICE = BIT(0) , DMACFG_DST_IS_DEVICE = BIT(1) , DMACFG_WAIT_AVAILABLE = BIT(2) , DMACFG_KEEP_LOCKED = BIT(3) , DMACFG_USE_SRC_CONFIG = BIT(6) , DMACFG_USE_DST_CONFIG = BIT(7) } |
Configuration flags for DmaConfig. More... | |
enum | { DMARST_UNLOCK = BIT(0) , DMARST_RESUME_DEVICE = BIT(1) } |
Configuration flags for svcRestartDma. More... | |
static void | dmaDeviceConfigInitDefault (DmaDeviceConfig *cfg) |
Writes the default DMA device config that the kernel uses when DMACFG_*_IS_DEVICE and DMACFG_*_USE_CFG are not set. | |
static void | dmaConfigInitDefault (DmaConfig *cfg) |
Initializes a DmaConfig instance with sane defaults for RAM<>RAM tranfers. | |
Result | svcBindInterrupt (u32 interruptId, Handle eventOrSemaphore, s32 priority, bool isManualClear) |
Binds an event or semaphore handle to an ARM11 interrupt. More... | |
Result | svcUnbindInterrupt (u32 interruptId, Handle eventOrSemaphore) |
Unbinds an event or semaphore handle from an ARM11 interrupt. More... | |
Result | svcInvalidateProcessDataCache (Handle process, u32 addr, u32 size) |
Invalidates a process's data cache. More... | |
Result | svcStoreProcessDataCache (Handle process, u32 addr, u32 size) |
Cleans a process's data cache. More... | |
Result | svcFlushProcessDataCache (Handle process, u32 addr, u32 size) |
Flushes (cleans and invalidates) a process's data cache. More... | |
Result | svcStartInterProcessDma (Handle *dma, Handle dstProcess, u32 dstAddr, Handle srcProcess, u32 srcAddr, u32 size, const DmaConfig *cfg) |
Begins an inter-process DMA transfer. More... | |
Result | svcStopDma (Handle dma) |
Stops an inter-process DMA transfer. More... | |
Result | svcGetDmaState (DmaState *state, Handle dma) |
Gets the state of an inter-process DMA transfer. More... | |
Result | svcRestartDma (Handle dma, u32 dstAddr, u32 srcAddr, u32 size, s8 flags) |
Restarts a DMA transfer, using the same configuration as before. More... | |
Result | svcSetGpuProt (bool useApplicationRestriction) |
Sets the GPU protection register to restrict the range of the GPU DMA. More... | |
Result | svcSetWifiEnabled (bool enabled) |
Enables or disables Wi-Fi. More... | |
Debugging | |
enum | PerfCounterOperation { PERFCOUNTEROP_ENABLE = 0 , PERFCOUNTEROP_DISABLE = 1 , PERFCOUNTEROP_GET_VALUE = 2 , PERFCOUNTEROP_SET_VALUE = 3 , PERFCOUNTEROP_GET_OVERFLOW_FLAGS = 4 , PERFCOUNTEROP_RESET = 5 , PERFCOUNTEROP_GET_EVENT = 6 , PERFCOUNTEROP_SET_EVENT = 7 , PERFCOUNTEROP_SET_VIRTUAL_COUNTER_ENABLED = 8 } |
Operations for svcControlPerformanceCounter. More... | |
enum | PerfCounterRegister { PERFCOUNTERREG_CORE_BASE = 0 , PERFCOUNTERREG_CORE_COUNT_REG_0 = PERFCOUNTERREG_CORE_BASE , PERFCOUNTERREG_CORE_COUNT_REG_1 , PERFCOUNTERREG_CORE_CYCLE_COUNTER , PERFCOUNTERREG_SCU_BASE = 0x10 , PERFCOUNTERREG_SCU_0 = PERFCOUNTERREG_SCU_BASE , PERFCOUNTERREG_SCU_1 , PERFCOUNTERREG_SCU_2 , PERFCOUNTERREG_SCU_3 , PERFCOUNTERREG_SCU_4 , PERFCOUNTERREG_SCU_5 , PERFCOUNTERREG_SCU_6 , PERFCOUNTERREG_SCU_7 } |
Performance counter register IDs (CP15 and SCU). More... | |
enum | PerfCounterEvent { PERFCOUNTEREVT_CORE_BASE = 0x0 , PERFCOUNTEREVT_CORE_INST_CACHE_MISS = PERFCOUNTEREVT_CORE_BASE , PERFCOUNTEREVT_CORE_STALL_BY_LACK_OF_INST , PERFCOUNTEREVT_CORE_STALL_BY_DATA_HAZARD , PERFCOUNTEREVT_CORE_INST_MICRO_TLB_MISS , PERFCOUNTEREVT_CORE_DATA_MICRO_TLB_MISS , PERFCOUNTEREVT_CORE_BRANCH_INST , PERFCOUNTEREVT_CORE_BRANCH_NOT_PREDICTED , PERFCOUNTEREVT_CORE_BRANCH_MISS_PREDICTED , PERFCOUNTEREVT_CORE_INST_EXECUTED , PERFCOUNTEREVT_CORE_FOLDED_INST_EXECUTED , PERFCOUNTEREVT_CORE_DATA_CACHE_READ , PERFCOUNTEREVT_CORE_DATA_CACHE_READ_MISS , PERFCOUNTEREVT_CORE_DATA_CACHE_WRITE , PERFCOUNTEREVT_CORE_DATA_CACHE_WRITE_MISS , PERFCOUNTEREVT_CORE_DATA_CACHE_LINE_EVICTION , PERFCOUNTEREVT_CORE_PC_CHANGED , PERFCOUNTEREVT_CORE_MAIN_TLB_MISS , PERFCOUNTEREVT_CORE_EXTERNAL_REQUEST , PERFCOUNTEREVT_CORE_STALL_BY_LSU_FULL , PERFCOUNTEREVT_CORE_STORE_BUFFER_DRAIN , PERFCOUNTEREVT_CORE_MERGE_IN_STORE_BUFFER , PERFCOUNTEREVT_CORE_CYCLE_COUNT = PERFCOUNTEREVT_CORE_BASE + 0xFF , PERFCOUNTEREVT_CORE_CYCLE_COUNT_64 = PERFCOUNTEREVT_CORE_BASE + 0xFFF , PERFCOUNTEREVT_SCU_BASE = 0x1000 , PERFCOUNTEREVT_SCU_DISABLED = PERFCOUNTEREVT_SCU_BASE , PERFCOUNTEREVT_SCU_LINEFILL_MISS_FROM_CORE0 , PERFCOUNTEREVT_SCU_LINEFILL_MISS_FROM_CORE1 , PERFCOUNTEREVT_SCU_LINEFILL_MISS_FROM_CORE2 , PERFCOUNTEREVT_SCU_LINEFILL_MISS_FROM_CORE3 , PERFCOUNTEREVT_SCU_LINEFILL_HIT_FROM_CORE0 , PERFCOUNTEREVT_SCU_LINEFILL_HIT_FROM_CORE1 , PERFCOUNTEREVT_SCU_LINEFILL_HIT_FROM_CORE2 , PERFCOUNTEREVT_SCU_LINEFILL_HIT_FROM_CORE3 , PERFCOUNTEREVT_SCU_LINE_MISSING_FROM_CORE0 , PERFCOUNTEREVT_SCU_LINE_MISSING_FROM_CORE1 , PERFCOUNTEREVT_SCU_LINE_MISSING_FROM_CORE2 , PERFCOUNTEREVT_SCU_LINE_MISSING_FROM_CORE3 , PERFCOUNTEREVT_SCU_LINE_MIGRATION , PERFCOUNTEREVT_SCU_READ_BUSY_PORT0 , PERFCOUNTEREVT_SCU_READ_BUSY_PORT1 , PERFCOUNTEREVT_SCU_WRITE_BUSY_PORT0 , PERFCOUNTEREVT_SCU_WRITE_BUSY_PORT1 , PERFCOUNTEREVT_SCU_EXTERNAL_READ , PERFCOUNTEREVT_SCU_EXTERNAL_WRITE , PERFCOUNTEREVT_SCU_CYCLE_COUNT = PERFCOUNTEREVT_SCU_BASE + 0x1F } |
Performance counter event IDs (CP15 or SCU). More... | |
enum | ExitProcessEventReason { EXITPROCESS_EVENT_EXIT = 0 , EXITPROCESS_EVENT_TERMINATE = 1 , EXITPROCESS_EVENT_DEBUG_TERMINATE = 2 } |
Reasons for an exit process event. More... | |
enum | ExitThreadEventReason { EXITTHREAD_EVENT_EXIT = 0 , EXITTHREAD_EVENT_TERMINATE = 1 , EXITTHREAD_EVENT_EXIT_PROCESS = 2 , EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 } |
Reasons for an exit thread event. More... | |
enum | UserBreakType { USERBREAK_PANIC = 0 , USERBREAK_ASSERT = 1 , USERBREAK_USER = 2 , USERBREAK_LOAD_RO = 3 , USERBREAK_UNLOAD_RO = 4 } |
Reasons for a user break. More... | |
enum | ExceptionEventType { EXCEVENT_UNDEFINED_INSTRUCTION = 0 , EXCEVENT_PREFETCH_ABORT = 1 , EXCEVENT_DATA_ABORT = 2 , EXCEVENT_UNALIGNED_DATA_ACCESS = 3 , EXCEVENT_ATTACH_BREAK = 4 , EXCEVENT_STOP_POINT = 5 , EXCEVENT_USER_BREAK = 6 , EXCEVENT_DEBUGGER_BREAK = 7 , EXCEVENT_UNDEFINED_SYSCALL = 8 } |
Reasons for an exception event. More... | |
enum | StopPointType { STOPPOINT_SVC_FF = 0 , STOPPOINT_BREAKPOINT = 1 , STOPPOINT_WATCHPOINT = 2 } |
Stop point types. More... | |
enum | DebugEventType { DBGEVENT_ATTACH_PROCESS = 0 , DBGEVENT_ATTACH_THREAD = 1 , DBGEVENT_EXIT_THREAD = 2 , DBGEVENT_EXIT_PROCESS = 3 , DBGEVENT_EXCEPTION = 4 , DBGEVENT_DLL_LOAD = 5 , DBGEVENT_DLL_UNLOAD = 6 , DBGEVENT_SCHEDULE_IN = 7 , DBGEVENT_SCHEDULE_OUT = 8 , DBGEVENT_SYSCALL_IN = 9 , DBGEVENT_SYSCALL_OUT = 10 , DBGEVENT_OUTPUT_STRING = 11 , DBGEVENT_MAP = 12 } |
Debug event type. More... | |
enum | DebugFlags { DBG_INHIBIT_USER_CPU_EXCEPTION_HANDLERS = BIT(0) , DBG_SIGNAL_FAULT_EXCEPTION_EVENTS = BIT(1) , DBG_SIGNAL_SCHEDULE_EVENTS = BIT(2) , DBG_SIGNAL_SYSCALL_EVENTS = BIT(3) , DBG_SIGNAL_MAP_EVENTS = BIT(4) } |
Debug flags for an attached process, set by svcContinueDebugEvent. More... | |
enum | ThreadContextControlFlags { THREADCONTEXT_CONTROL_CPU_GPRS = BIT(0) , THREADCONTEXT_CONTROL_CPU_SPRS = BIT(1) , THREADCONTEXT_CONTROL_FPU_GPRS = BIT(2) , THREADCONTEXT_CONTROL_FPU_SPRS = BIT(3) , THREADCONTEXT_CONTROL_CPU_REGS = BIT(0) | BIT(1) , THREADCONTEXT_CONTROL_FPU_REGS = BIT(2) | BIT(3) , THREADCONTEXT_CONTROL_ALL = BIT(0) | BIT(1) | BIT(2) | BIT(3) } |
Control flags for svcGetDebugThreadContext and svcSetDebugThreadContext. More... | |
enum | DebugThreadParameter { DBGTHREAD_PARAMETER_PRIORITY = 0 , DBGTHREAD_PARAMETER_SCHEDULING_MASK_LOW = 1 , DBGTHREAD_PARAMETER_CPU_IDEAL = 2 , DBGTHREAD_PARAMETER_CPU_CREATOR = 3 } |
Thread parameter field for svcGetDebugThreadParameter. More... | |
void | svcBreak (UserBreakType breakReason) |
Breaks execution. More... | |
void | svcBreakRO (UserBreakType breakReason, const void *croInfo, u32 croInfoSize) __asm__("svcBreak") |
Breaks execution (LOAD_RO and UNLOAD_RO). More... | |
Result | svcOutputDebugString (const char *str, s32 length) |
Outputs a debug string. More... | |
Result | svcControlPerformanceCounter (u64 *out, PerfCounterOperation op, u32 param1, u64 param2) |
Controls performance monitoring on the CP15 interface and the SCU. More... | |
Result | svcDebugActiveProcess (Handle *debug, u32 processId) |
Creates a debug handle for an active process. More... | |
Result | svcBreakDebugProcess (Handle debug) |
Breaks a debugged process. More... | |
Result | svcTerminateDebugProcess (Handle debug) |
Terminates a debugged process. More... | |
Result | svcGetProcessDebugEvent (DebugEventInfo *info, Handle debug) |
Gets the current debug event of a debugged process. More... | |
Result | svcContinueDebugEvent (Handle debug, DebugFlags flags) |
Continues the current debug event of a debugged process (not necessarily the same as svcGetProcessDebugEvent). More... | |
Result | svcGetDebugThreadContext (ThreadContext *context, Handle debug, u32 threadId, ThreadContextControlFlags controlFlags) |
Fetches the saved registers of a thread, either inactive or awaiting svcContinueDebugEvent, belonging to a debugged process. More... | |
Result | svcSetDebugThreadContext (Handle debug, u32 threadId, ThreadContext *context, ThreadContextControlFlags controlFlags) |
Updates the saved registers of a thread, either inactive or awaiting svcContinueDebugEvent, belonging to a debugged process. More... | |
Result | svcQueryDebugProcessMemory (MemInfo *info, PageInfo *out, Handle debug, u32 addr) |
Queries memory information of a debugged process. More... | |
Result | svcReadProcessMemory (void *buffer, Handle debug, u32 addr, u32 size) |
Reads from a debugged process's memory. More... | |
Result | svcWriteProcessMemory (Handle debug, const void *buffer, u32 addr, u32 size) |
Writes to a debugged process's memory. More... | |
Result | svcSetHardwareBreakPoint (s32 registerId, u32 control, u32 value) |
Sets an hardware breakpoint or watchpoint. More... | |
Result | svcGetDebugThreadParam (s64 *unused, u32 *out, Handle debug, u32 threadId, DebugThreadParameter parameter) |
Gets a debugged thread's parameter. More... | |
Syscall wrappers.
anonymous enum |
Configuration flags for DmaConfig.
Enumerator | |
---|---|
DMACFG_SRC_IS_DEVICE | DMA source is a device/peripheral. Address will not auto-increment. |
DMACFG_DST_IS_DEVICE | DMA destination is a device/peripheral. Address will not auto-increment. |
DMACFG_WAIT_AVAILABLE | Make svcStartInterProcessDma wait for the channel to be unlocked. |
DMACFG_KEEP_LOCKED | Keep the channel locked after the transfer. Required for svcRestartDma. |
DMACFG_USE_SRC_CONFIG | Use the provided source device configuration even if the DMA source is not a device. |
DMACFG_USE_DST_CONFIG | Use the provided destination device configuration even if the DMA destination is not a device. |
anonymous enum |
Configuration flags for svcRestartDma.
Enumerator | |
---|---|
DMARST_UNLOCK | Unlock the channel after transfer. |
DMARST_RESUME_DEVICE | Replace DMAFLUSHP instructions by NOP (they may not be regenerated even if this flag is not set). |
enum ArbitrationType |
Arbitration modes.
enum DebugEventType |
Debug event type.
enum DebugFlags |
Debug flags for an attached process, set by svcContinueDebugEvent.
Enumerator | |
---|---|
DBG_INHIBIT_USER_CPU_EXCEPTION_HANDLERS | Inhibit user-defined CPU exception handlers (including watchpoints and breakpoints, regardless of any svcKernelSetState call). |
DBG_SIGNAL_FAULT_EXCEPTION_EVENTS | Signal fault exception events. See FaultExceptionEvent. |
DBG_SIGNAL_SCHEDULE_EVENTS | Signal schedule in/out events. See ScheduleInOutEvent. |
DBG_SIGNAL_SYSCALL_EVENTS | Signal syscall in/out events. See SyscallInOutEvent. |
DBG_SIGNAL_MAP_EVENTS | Signal map events. See MapEvent. |
enum DebugThreadParameter |
enum DmaState |
DMA transfer state.
enum ExceptionEventType |
Reasons for an exception event.
Reasons for an exit process event.
Enumerator | |
---|---|
EXITPROCESS_EVENT_EXIT | Process exited either normally or due to an uncaught exception. |
EXITPROCESS_EVENT_TERMINATE | Process has been terminated by svcTerminateProcess. |
EXITPROCESS_EVENT_DEBUG_TERMINATE | Process has been terminated by svcTerminateDebugProcess. |
Reasons for an exit thread event.
Enumerator | |
---|---|
EXITTHREAD_EVENT_EXIT | Thread exited. |
EXITTHREAD_EVENT_TERMINATE | Thread terminated. |
EXITTHREAD_EVENT_EXIT_PROCESS | Process exited either normally or due to an uncaught exception. |
EXITTHREAD_EVENT_TERMINATE_PROCESS | Process has been terminated by svcTerminateProcess. |
enum MemOp |
svcControlMemory operation flags
The lowest 8 bits are the operation
enum MemPerm |
enum MemRegion |
enum MemState |
The state of a memory block.
enum PerfCounterEvent |
Performance counter event IDs (CP15 or SCU).
Enumerator | |
---|---|
PERFCOUNTEREVT_CORE_CYCLE_COUNT | One cycle elapsed. |
PERFCOUNTEREVT_CORE_CYCLE_COUNT_64 | 64 cycles elapsed. |
enum PerfCounterOperation |
Operations for svcControlPerformanceCounter.
enum PerfCounterRegister |
Performance counter register IDs (CP15 and SCU).
enum ResetType |
Reset types (for use with events and timers)
enum ResourceLimitType |
Types of resource limit.
Enumerator | |
---|---|
RESLIMIT_PRIORITY | Thread priority. |
RESLIMIT_COMMIT | Quantity of allocatable memory. |
RESLIMIT_THREAD | Number of threads. |
RESLIMIT_EVENT | Number of events. |
RESLIMIT_MUTEX | Number of mutexes. |
RESLIMIT_SEMAPHORE | Number of semaphores. |
RESLIMIT_TIMER | Number of timers. |
RESLIMIT_SHAREDMEMORY | Number of shared memory objects, see svcCreateMemoryBlock. |
RESLIMIT_ADDRESSARBITER | Number of address arbiters. |
RESLIMIT_CPUTIME | CPU time. Value expressed in percentage regular until it reaches 90. |
RESLIMIT_BIT | Forces enum size to be 32 bits. |
enum StopPointType |
Stop point types.
Enumerator | |
---|---|
STOPPOINT_SVC_FF | See SVC_STOP_POINT. |
STOPPOINT_BREAKPOINT | Breakpoint. |
STOPPOINT_WATCHPOINT | Watchpoint. |
Control flags for svcGetDebugThreadContext and svcSetDebugThreadContext.
enum ThreadInfoType |
enum UserBreakType |
|
inlinestatic |
Gets the thread command buffer.
|
inlinestatic |
Gets the thread local storage buffer.
|
inlinestatic |
Gets the thread static buffer.
Accepts a session.
[out] | session | Pointer to output the created session handle to. |
port | Handle of the port to accept a session from. |
Result svcArbitrateAddress | ( | Handle | arbiter, |
u32 | addr, | ||
ArbitrationType | type, | ||
s32 | value, | ||
s64 | timeout_ns | ||
) |
Arbitrate an address, can be used for synchronization.
arbiter | Handle of the arbiter |
addr | A pointer to a s32 value. |
type | Type of action to be performed by the arbiter |
value | Number of threads to signal if using ARBITRATION_SIGNAL, or the value used for comparison. |
timeout_ns | Optional timeout in nanoseconds when using TIMEOUT actions, ignored otherwise. If not needed, use svcArbitrateAddressNoTimeout instead. |
Result svcArbitrateAddressNoTimeout | ( | Handle | arbiter, |
u32 | addr, | ||
ArbitrationType | type, | ||
s32 | value | ||
) |
Same as svcArbitrateAddress but with the timeout_ns parameter undefined.
arbiter | Handle of the arbiter |
addr | A pointer to a s32 value. |
type | Type of action to be performed by the arbiter |
value | Number of threads to signal if using ARBITRATION_SIGNAL, or the value used for comparison. |
Executes a function in supervisor mode.
callback | Function to execute. |
Result svcBindInterrupt | ( | u32 | interruptId, |
Handle | eventOrSemaphore, | ||
s32 | priority, | ||
bool | isManualClear | ||
) |
Binds an event or semaphore handle to an ARM11 interrupt.
interruptId | Interrupt identfier (see https://www.3dbrew.org/wiki/ARM11_Interrupts). |
eventOrSemaphore | Event or semaphore handle to bind to the given interrupt. |
priority | Priority of the interrupt for the current process. |
isManualClear | Indicates whether the interrupt has to be manually cleared or not (= level-high active). |
void svcBreak | ( | UserBreakType | breakReason | ) |
Breaks execution.
breakReason | Reason for breaking. |
Breaks a debugged process.
debug | Debug handle of the process. |
void svcBreakRO | ( | UserBreakType | breakReason, |
const void * | croInfo, | ||
u32 | croInfoSize | ||
) |
Breaks execution (LOAD_RO and UNLOAD_RO).
breakReason | Debug reason for breaking. |
croInfo | Library information. |
croInfoSize | Size of the above structure. |
Cancels a timer.
timer | Handle of the timer to cancel. |
Clears an event.
handle | Handle of the event to clear. |
Closes a handle.
handle | Handle to close. |
Connects to a port.
[out] | out | Pointer to output the port handle to. |
portName | Name of the port. |
Result svcContinueDebugEvent | ( | Handle | debug, |
DebugFlags | flags | ||
) |
Continues the current debug event of a debugged process (not necessarily the same as svcGetProcessDebugEvent).
debug | Debug handle of the process. |
flags | Flags to continue with, see DebugFlags. |
Controls memory mapping.
[out] | addr_out | The virtual address resulting from the operation. Usually the same as addr0. |
addr0 | The virtual address to be used for the operation. | |
addr1 | The virtual address to be (un)mirrored by addr0 when using MEMOP_MAP or MEMOP_UNMAP. It has to be pointing to a RW memory. Use NULL if the operation is MEMOP_FREE or MEMOP_ALLOC. | |
size | The requested size for MEMOP_ALLOC and MEMOP_ALLOC_LINEAR. | |
op | Operation flags. See MemOp. | |
perm | A combination of MEMPERM_READ and MEMPERM_WRITE. Using MEMPERM_EXECUTE will return an error. Value 0 is used when unmapping memory. |
If a memory is mapped for two or more addresses, you have to use MEMOP_UNMAP before being able to MEMOP_FREE it. MEMOP_MAP will fail if addr1
was already mapped to another address.
More information is available at http://3dbrew.org/wiki/SVC#Memory_Mapping.
Result svcControlPerformanceCounter | ( | u64 * | out, |
PerfCounterOperation | op, | ||
u32 | param1, | ||
u64 | param2 | ||
) |
Controls performance monitoring on the CP15 interface and the SCU.
The meaning of the parameters depend on the operation.
[out] | out | Output. |
op | Operation, see details. | |
param1 | First parameter. | |
param2 | Second parameter. |
The operations are the following:
Result svcControlProcessMemory | ( | Handle | process, |
u32 | addr0, | ||
u32 | addr1, | ||
u32 | size, | ||
u32 | type, | ||
u32 | perm | ||
) |
Controls the memory mapping of a process.
addr0 | The virtual address to map |
addr1 | The virtual address to be mapped by addr0 |
type | Only operations MEMOP_MAP, MEMOP_UNMAP and MEMOP_PROT are allowed. |
This is the only SVC which allows mapping executable memory. Using MEMOP_PROT will change the memory permissions of an already mapped memory.
Creates an address arbiter.
[out] | mutex | Pointer to output the handle of the created address arbiter to. |
Result svcCreateCodeSet | ( | Handle * | out, |
const CodeSetHeader * | info, | ||
u32 | textSegmentLma, | ||
u32 | roSegmentLma, | ||
u32 | dataSegmentLma | ||
) |
Sets up virtual address space for a new process.
[out] | out | Pointer to output the codeset handle to. |
info | Codeset header, contains process name, titleId and segment info. | |
textSegmentLma | Address of executable segment in caller's address space. | |
roSegmentLma | Address of read-only segment in caller's address space. | |
dataSegmentLma | Address of read-write segment in caller's address space. |
Creates an event handle.
[out] | event | Pointer to output the created event handle to. |
reset_type | Type of reset the event uses (RESET_ONESHOT/RESET_STICKY). |
Result svcCreateMemoryBlock | ( | Handle * | memblock, |
u32 | addr, | ||
u32 | size, | ||
MemPerm | my_perm, | ||
MemPerm | other_perm | ||
) |
Creates a block of shared memory.
[out] | memblock | Pointer to store the handle of the block |
addr | Address of the memory to map, page-aligned. So its alignment must be 0x1000. | |
size | Size of the memory to map, a multiple of 0x1000. | |
my_perm | Memory permissions for the current process | |
other_perm | Memory permissions for the other processes |
Creates a mutex.
[out] | mutex | Pointer to output the handle of the created mutex to. |
initially_locked | Whether the mutex should be initially locked. |
Result svcCreatePort | ( | Handle * | portServer, |
Handle * | portClient, | ||
const char * | name, | ||
s32 | maxSessions | ||
) |
Creates a port.
[out] | portServer | Pointer to output the port server handle to. |
[out] | portClient | Pointer to output the port client handle to. |
name | Name of the port. | |
maxSessions | Maximum number of sessions that can connect to the port. |
Result svcCreateProcess | ( | Handle * | out, |
Handle | codeset, | ||
const u32 * | arm11KernelCaps, | ||
s32 | numArm11KernelCaps | ||
) |
Create a new process.
[out] | out | Pointer to output the process handle to. |
codeset | Codeset created for this process. | |
arm11KernelCaps | Arm11 Kernel Capabilities from exheader. | |
numArm11KernelCaps | Number of kernel capabilities. |
Creates a resource limit set.
[out] | resourceLimit | Pointer to output the resource limit set handle to. |
Creates a semaphore.
[out] | semaphore | Pointer to output the handle of the created semaphore to. |
initial_count | Initial count of the semaphore. | |
max_count | Maximum count of the semaphore. |
Creates a linked pair of session endpoints.
[out] | serverSession | Pointer to output the created server endpoint handle to. |
[out] | clientSession | Pointer to output the created client endpoint handle to. |
Connects to a port via a handle.
[out] | clientSession | Pointer to output the client session handle to. |
clientPort | Port client endpoint to connect to. |
Result svcCreateThread | ( | Handle * | thread, |
ThreadFunc | entrypoint, | ||
u32 | arg, | ||
u32 * | stack_top, | ||
s32 | thread_priority, | ||
s32 | processor_id | ||
) |
Creates a new thread.
[out] | thread | The thread handle |
entrypoint | The function that will be called first upon thread creation | |
arg | The argument passed to entrypoint | |
stack_top | The top of the thread's stack. Must be 0x8 bytes mem-aligned. | |
thread_priority | Low values gives the thread higher priority. For userland apps, this has to be within the range [0x18;0x3F] | |
processor_id | The id of the processor the thread should be ran on. Those are labelled starting from 0. For old 3ds it has to be <2, and for new 3DS <4. Value -1 means all CPUs and -2 read from the Exheader. |
The processor with ID 1 is the system processor. To enable multi-threading on this core you need to call APT_SetAppCpuTimeLimit at least once with a non-zero value.
Since a thread is considered as a waitable object, you can use svcWaitSynchronization and svcWaitSynchronizationN to join with it.
stack_top's
address low 3 bits to make sure it is 0x8-bytes aligned. Creates a timer.
[out] | timer | Pointer to output the handle of the created timer to. |
reset_type | Type of reset to perform on the timer. |
Creates a debug handle for an active process.
[out] | debug | Pointer to output the created debug handle to. |
processId | ID of the process to debug. |
Duplicates a handle.
[out] | out | Pointer to output the duplicated handle to. |
original | Handle to duplicate. |
void svcExitThread | ( | void | ) |
Exits the current thread.
This will trigger a state change and hence release all svcWaitSynchronization operations. It means that you can join a thread by calling
Flushes (cleans and invalidates) a process's data cache.
process | Handle of the process. |
addr | Address to flush. |
size | Size of the memory to flush. |
Result svcGetDebugThreadContext | ( | ThreadContext * | context, |
Handle | debug, | ||
u32 | threadId, | ||
ThreadContextControlFlags | controlFlags | ||
) |
Fetches the saved registers of a thread, either inactive or awaiting svcContinueDebugEvent, belonging to a debugged process.
[out] | context | Values of the registers to fetch, see ThreadContext. |
debug | Debug handle of the parent process. | |
threadId | ID of the thread to fetch the saved registers of. | |
controlFlags | Which registers to fetch, see ThreadContextControlFlags. |
Result svcGetDebugThreadParam | ( | s64 * | unused, |
u32 * | out, | ||
Handle | debug, | ||
u32 | threadId, | ||
DebugThreadParameter | parameter | ||
) |
Gets a debugged thread's parameter.
[out] | unused | Unused. |
[out] | out | Output value. |
debug | Debug handle of the process. | |
threadId | ID of the thread | |
parameter | Parameter to fetch, see DebugThreadParameter. |
Gets the state of an inter-process DMA transfer.
[out] | state | Pointer to output the state of the DMA transfer to. |
dma | Handle of the DMA channel object. |
Gets a handle info.
[out] | out | Pointer to output the handle info to. |
handle | Handle to get the info for. | |
param | Parameter clarifying the handle info type. |
Gets a process's affinity mask.
[out] | affinitymask | Pointer to store the affinity masks. |
process | Handle of the process. | |
processorcount | Number of processors. |
Result svcGetProcessDebugEvent | ( | DebugEventInfo * | info, |
Handle | debug | ||
) |
Gets the current debug event of a debugged process.
[out] | info | Pointer to output the debug event information to. |
debug | Debug handle of the process. |
Gets the ID of a process.
[out] | out | Pointer to output the process ID to. |
handle | Handle of the process to get the ID of. |
Gets a process's ideal processor.
[out] | processorid | Pointer to store the ID of the process's ideal processor. |
process | Handle of the process. |
Gets the process ID of a thread.
[out] | out | Pointer to output the process ID of the thread handle to. |
handle | Handle of the thread. |
Gets information about a process.
[out] | out | Pointer to output process info to. |
process | Handle of the process to get information about. | |
type | Type of information to retreieve. |
Gets a list of running processes.
[out] | processCount | Pointer to output the process count to. |
[out] | processIds | Pointer to output the process IDs to. |
processIdMaxCount | Maximum number of process IDs. |
s32 svcGetProcessorID | ( | void | ) |
Returns the ID of the processor the current thread is running on.
Gets the resource limit set of a process.
[out] | resourceLimit | Pointer to output the resource limit set handle to. |
process | Process to get the resource limits of. |
Result svcGetResourceLimitCurrentValues | ( | s64 * | values, |
Handle | resourceLimit, | ||
ResourceLimitType * | names, | ||
s32 | nameCount | ||
) |
Gets the values of a resource limit set.
[out] | values | Pointer to output the values to. |
resourceLimit | Resource limit set to use. | |
names | Resource limit names to get the values of. | |
nameCount | Number of resource limit names. |
Result svcGetResourceLimitLimitValues | ( | s64 * | values, |
Handle | resourceLimit, | ||
ResourceLimitType * | names, | ||
s32 | nameCount | ||
) |
Gets the value limits of a resource limit set.
[out] | values | Pointer to output the value limits to. |
resourceLimit | Resource limit set to use. | |
names | Resource limit names to get the limits of. | |
nameCount | Number of resource limit names. |
Gets the system info.
[out] | out | Pointer to output the system info to. |
type | Type of system info to retrieve. | |
param | Parameter clarifying the system info type. |
u64 svcGetSystemTick | ( | void | ) |
Gets the current system tick.
Gets a thread's affinity mask.
[out] | affinitymask | Pointer to output the affinity masks to. |
thread | Handle of the thread. | |
processorcount | Number of processors. |
Gets the ID of a thread.
[out] | out | Pointer to output the thread ID of the thread handle to. |
handle | Handle of the thread. |
Gets a thread's ideal processor.
[out] | processorid | Pointer to output the ID of the thread's ideal processor to. |
thread | Handle of the thread. |
Result svcGetThreadInfo | ( | s64 * | out, |
Handle | thread, | ||
ThreadInfoType | type | ||
) |
Checks if a thread handle is valid.
This requests always return an error when called, it only checks if the handle is a thread or not.
Result svcGetThreadList | ( | s32 * | threadCount, |
u32 * | threadIds, | ||
s32 | threadIdMaxCount, | ||
Handle | process | ||
) |
Gets a list of the threads of a process.
[out] | threadCount | Pointer to output the thread count to. |
[out] | threadIds | Pointer to output the thread IDs to. |
threadIdMaxCount | Maximum number of thread IDs. | |
process | Process handle to list the threads of. |
Invalidates a process's data cache.
process | Handle of the process. |
addr | Address to invalidate. |
size | Size of the memory to invalidate. |
Sets the current kernel state.
type | Type of state to set (the other parameters depend on it). |
Maps a block of shared memory.
memblock | Handle of the block |
addr | Address of the memory to map, page-aligned. So its alignment must be 0x1000. |
my_perm | Memory permissions for the current process |
other_perm | Memory permissions for the other processes |
Maps a block of process memory, starting from address 0x00100000.
process | Handle of the process. |
destAddress | Address of the block of memory to map, in the current (destination) process. |
size | Size of the block of memory to map (truncated to a multiple of 0x1000 bytes). |
Gets the handle of a process.
[out] | process | The handle of the process |
processId | The ID of the process to open |
Gets the handle of a thread.
[out] | thread | The handle of the thread |
process | The ID of the process linked to the thread |
Outputs a debug string.
str | String to output. |
length | Length of the string to output, needs to be positive. |
Queries memory information of a debugged process.
[out] | info | Pointer to output memory info to. |
[out] | out | Pointer to output page info to. |
debug | Debug handle of the process to query memory from. | |
addr | Virtual memory address to query. |
Queries memory information.
[out] | info | Pointer to output memory info to. |
out | Pointer to output page info to. | |
addr | Virtual memory address to query. |
Queries process memory information.
[out] | info | Pointer to output memory info to. |
[out] | out | Pointer to output page info to. |
process | Process to query memory from. | |
addr | Virtual memory address to query. |
Reads from a debugged process's memory.
buffer | Buffer to read data to. |
debug | Debug handle of the process. |
addr | Address to read from. |
size | Size of the memory to read. |
Releases a semaphore.
[out] | count | Pointer to output the current count of the semaphore to. |
semaphore | Handle of the semaphore. | |
release_count | Number to increase the semaphore count by. |
Result svcReplyAndReceive | ( | s32 * | index, |
const Handle * | handles, | ||
s32 | handleCount, | ||
Handle | replyTarget | ||
) |
Replies to and receives a new request.
index | Pointer to the index of the request. |
handles | Session handles to receive requests from. |
handleCount | Number of handles. |
replyTarget | Handle of the session to reply to. |
Restarts a DMA transfer, using the same configuration as before.
[out] | state | Pointer to output the state of the DMA transfer to. |
dma | Handle of the DMA channel object. | |
dstAddr | Address in the destination process to write data to. | |
srcAddr | Address in the source to read data from. | |
size | Size of the data to transfer. | |
flags | Restart flags, DMARST_UNLOCK and/or DMARST_RESUME_DEVICE. |
Result svcRun | ( | Handle | process, |
const StartupInfo * | info | ||
) |
Launches the main thread of the process.
process | Handle of the process. |
info | Pointer to a StartupInfo structure describing information for the main thread. |
Sends a synchronized request to a session handle.
session | Handle of the session. |
Result svcSetDebugThreadContext | ( | Handle | debug, |
u32 | threadId, | ||
ThreadContext * | context, | ||
ThreadContextControlFlags | controlFlags | ||
) |
Updates the saved registers of a thread, either inactive or awaiting svcContinueDebugEvent, belonging to a debugged process.
debug | Debug handle of the parent process. |
threadId | ID of the thread to update the saved registers of. |
context | Values of the registers to update, see ThreadContext. |
controlFlags | Which registers to update, see ThreadContextControlFlags. |
Result svcSetGpuProt | ( | bool | useApplicationRestriction | ) |
Sets the GPU protection register to restrict the range of the GPU DMA.
11.3+ only.
useApplicationRestriction | Whether to use the register value used for APPLICATION titles. |
Sets an hardware breakpoint or watchpoint.
This is an interface to the BRP/WRP registers, see http://infocenter.arm.com/help/topic/com.arm.doc.ddi0360f/CEGEBGFC.html .
registerId | range 0..5 = breakpoints (BRP0-5), 0x100..0x101 = watchpoints (WRP0-1). The previous stop point for the register is disabled. |
control | Value of the control regiser. |
value | Value of the value register: either and address (if bit21 of control is clear) or the debug handle of a process to fetch the context ID of. |
Sets a process's affinity mask.
process | Handle of the process. |
affinitymask | Pointer to retrieve the affinity masks from. |
processorcount | Number of processors. |
Sets a process's ideal processor.
process | Handle of the process. |
processorid | ID of the process's ideal processor. |
Sets the resource limit set of a process.
process | Process to set the resource limit set to. |
resourceLimit | Resource limit set handle. |
Result svcSetResourceLimitValues | ( | Handle | resourceLimit, |
const ResourceLimitType * | names, | ||
const s64 * | values, | ||
s32 | nameCount | ||
) |
Sets the value limits of a resource limit set.
resourceLimit | Resource limit set to use. |
names | Resource limit names to set the limits of. |
values | Value limits to set. The high 32 bits of RESLIMIT_COMMIT are used to set APPMEMALLOC in configuration memory, otherwise those bits are unused. |
nameCount | Number of resource limit names. |
Sets a thread's affinity mask.
thread | Handle of the thread. |
affinitymask | Pointer to retrieve the affinity masks from. |
processorcount | Number of processors. |
Sets a thread's ideal processor.
thread | Handle of the thread. |
processorid | ID of the thread's ideal processor. |
Changes the priority of a thread.
prio | For userland apps, this has to be within the range [0x18;0x3F] |
Low values gives the thread higher priority.
Sets a timer.
timer | Handle of the timer to set. |
initial | Initial value of the timer. |
interval | Interval of the timer. |
Result svcSetWifiEnabled | ( | bool | enabled | ) |
Enables or disables Wi-Fi.
11.4+ only.
enabled | Whether to enable or disable Wi-Fi. |
Signals an event.
handle | Handle of the event to signal. |
void svcSleepThread | ( | s64 | ns | ) |
Puts the current thread to sleep.
ns | The minimum number of nanoseconds to sleep for. |
Result svcStartInterProcessDma | ( | Handle * | dma, |
Handle | dstProcess, | ||
u32 | dstAddr, | ||
Handle | srcProcess, | ||
u32 | srcAddr, | ||
u32 | size, | ||
const DmaConfig * | cfg | ||
) |
Begins an inter-process DMA transfer.
[out] | dma | Pointer to output the handle of the DMA channel object to. |
dstProcess | Destination process handle. | |
dstAddr | Address in the destination process to write data to. | |
srcProcess | Source process handle. | |
srcAddr | Address in the source to read data from. | |
size | Size of the data to transfer. | |
cfg | Configuration structure. |
Stops an inter-process DMA transfer.
dma | Handle of the DMA channel object. |
Cleans a process's data cache.
process | Handle of the process. |
addr | Address to clean. |
size | Size of the memory to clean. |
Terminates a debugged process.
debug | Debug handle of the process. |
Terminates a process.
process | Handle of the process to terminate. |
Unbinds an event or semaphore handle from an ARM11 interrupt.
interruptId | Interrupt identfier, see (see https://www.3dbrew.org/wiki/ARM11_Interrupts). |
eventOrSemaphore | Event or semaphore handle to unbind from the given interrupt. |
Unmaps a block of shared memory.
memblock | Handle of the block |
addr | Address of the memory to unmap, page-aligned. So its alignment must be 0x1000. |
Unmaps a block of process memory, starting from address 0x00100000.
process | Handle of the process. |
destAddress | Address of the block of memory to unmap, in the current (destination) process. |
size | Size of the block of memory to unmap (truncated to a multiple of 0x1000 bytes). |
Waits for synchronization on a handle.
handle | Handle to wait on. |
nanoseconds | Maximum nanoseconds to wait for. |
Result svcWaitSynchronizationN | ( | s32 * | out, |
const Handle * | handles, | ||
s32 | handles_num, | ||
bool | wait_all, | ||
s64 | nanoseconds | ||
) |
Waits for synchronization on multiple handles.
[out] | out | Pointer to output the index of the synchronized handle to. |
handles | Handles to wait on. | |
handles_num | Number of handles. | |
wait_all | Whether to wait for synchronization on all handles. | |
nanoseconds | Maximum nanoseconds to wait for. |