Kernel ABI

Kernel ABI

Inputs are read from registers starting from r0 and outputs are written back to the same registers (also starting with r0).

IDNameInputsOutputs
0x01ControlMemoryr0: MemoryOperation operation
r1: u32/void* addr0
r2: u32/void* addr1
r3: u32 size
r4: MemoryPermission permissions
r0: Result
r1: u32/void* addr_out
0x02QueryMemoryr2?: u32/void* addrr0: Result
r1: u32 base_process_virtual_address
r2: u32 size
r3: MemoryPermission permission
r4: MemoryState state
r5: PageFlags page_flags
0x03ExitProcessNoneNone, doesn't return
0x04GetProcessAffinityMaskr0: [out] u8* affinitymask
r1: Handle<KProcess> process
r2: s32 processorcount
r0: Result
0x05SetProcessAffinityMaskr0: Handle<KProcess> process
r1: [in] const u8* affinitymask
r2: s32 processorcount
r0: Result
0x06GetProcessIdealProcessorr1?: Handle<KProcess> processr0: Result
r1: s32 processorid
r2: Clobbered?
0x07SetProcessIdealProcessorr0: Handle<KProcess> process
r1: s32 processorid
r0: Result
0x08CreateThreadr0: s32 thread_priority
r1: ThreadFunc entrypoint
r2: u32 arg
r3: u32/void* stack_top
r4: s32 processor_id
r0: Result
r1: Handle<KThread> thread_handle
0x09ExitThreadNoneNone, doesn't return
0x0ASleepThreadr0-r1: s64 nanosecondsNone
0x0BGetThreadPriorityr0: Ignored?
r1: Handle thread_handle
r0: Result
r1: s32 thread_priority
r2: Clobbered?
0x0CSetThreadPriorityr0: Handle<KThread> thread_handle
r1: s32 thread_priority
r0: Result
0x0DGetThreadAffinityMaskr0: [out] u8* affinitymask
r1: Handle<KThread> thread_handle
r2: s32 processorcount
r0: Result
0x0ESetThreadAffinityMaskr0: Handle<KThread> thread_handle
r1: [in] const u8* affinitymask
r2: s32 processorcount
r0: Result
0x0FGetThreadIdealProcessorr0: Ignored?
r1: Handle<KThread> thread_handle
r0: Result
r1: s32 processorid
0x10SetThreadIdealProcessorr0: Handle<KThread> thread_handle
r1: s32 processorid
r0: Result
0x11GetProcessorIDNoner0: s32 processorid
0x24WaitSynchronization1r0: Handle<KSynchronizationObject> handle
r2-r3: s64 timeout
r0: Result
0x1BSetTimerTimer handle, initial_low, interval_low, initial_high, interval_highResult
0x28GetSystemTickNoner0: Low 32 bits of the tick count
r1: High 32 bits of the tick count
0x2DConnectToPort??
r1: pointer to port name
r0: Result
r1: handle to KClientSession
0x32SendSyncRequestr0: handle to KClientSessionr0: Result