Kernel ABI

Revision as of 21:40, 6 July 2018 by ElementW (talk | contribs) ([in] & [out] qualifiers on some pointers)

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

ID Name Inputs Outputs
0x01 ControlMemory

r0: MemoryOperation operation
r1: u32/void* addr0
r2: u32/void* addr1
r3: u32 size
r4: MemoryPermission permissions

r0: Result
r1: u32/void* addr_out

0x02 QueryMemory

r2?: u32/void* addr

r0: Result
r1: u32 base_process_virtual_address
r2: u32 size
r3: MemoryPermission permission
r4: MemoryState state
r5: PageFlags page_flags

0x03 ExitProcess None None, doesn't return
0x04 GetProcessAffinityMask

r0: [out] u8* affinitymask
r1: Handle process
r2: s32 processorcount

r0: Result

0x05 SetProcessAffinityMask

r0: Handle process
r1: [in] const u8* affinitymask
r2: s32 processorcount

r0: Result

0x06 GetProcessIdealProcessor

r1?: Handle process

r0: Result
r1: s32 processorid
r2: Clobbered?

0x07 SetProcessIdealProcessor

r0: Handle process
r1: s32 processorid

r0: Result

0x08 CreateThread

r0: s32 thread_priority
r1: ThreadFunc entrypoint
r2: u32 arg
r3: u32/void* stack_top
r4: s32 processor_id

r0: Result
r1: Handle thread_handle

0x09 ExitThread None None, doesn't return
0x0A SleepThread

r0-r1: s64 nanoseconds

None
0x0B GetThreadPriority

r0: Ignored?
r1: Handle thread_handle

r0: Result
r1: s32 thread_priority
r2: Clobbered?

0x0C SetThreadPriority

r0: Handle thread_handle
r1: s32 thread_priority

r0: Result

0x0D GetThreadAffinityMask

r0: [out] u8* affinitymask
r1: Handle thread_handle
r2: s32 processorcount

r0: Result

0x0E SetThreadAffinityMask

r0: Handle thread_handle
r1: [in] const u8* affinitymask
r2: s32 processorcount

r0: Result

0x24 WaitSynchronization1

r0: Handle handle
r2-r3: s64 timeout

r0: Result

0x1B SetTimer Timer handle, initial_low, interval_low, initial_high, interval_high Result
0x2D ConnectToPort ??, pointer to port name Result, handle to KClientSession
0x32 SendSyncRequest handle to KClientSession Result