Difference between revisions of "Kernel ABI"
(Starting the page, just throwing content in there for now.) |
(Specify GetSystemTick ABI) |
||
(10 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
− | ! | + | ! ID |
! Name | ! Name | ||
! Inputs | ! Inputs | ||
! Outputs | ! Outputs | ||
+ | |- | ||
+ | | 0x01 | ||
+ | | ControlMemory | ||
+ | | | ||
+ | <code>r0</code>: <code>[[Memory Management#enum_MemoryOperation|MemoryOperation]] operation</code><br> | ||
+ | <code>r1</code>: <code>u32/void* addr0</code><br> | ||
+ | <code>r2</code>: <code>u32/void* addr1</code><br> | ||
+ | <code>r3</code>: <code>u32 size</code><br> | ||
+ | <code>r4</code>: <code>[[Memory Management#enum_MemoryPermission|MemoryPermission]] permissions</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>u32/void* addr_out</code> | ||
+ | |- | ||
+ | | 0x02 | ||
+ | | QueryMemory | ||
+ | | | ||
+ | <code>r2</code>?: <code>u32/void* addr</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>u32 base_process_virtual_address</code><br> | ||
+ | <code>r2</code>: <code>u32 size</code><br> | ||
+ | <code>r3</code>: <code>[[Memory Management#enum_MemoryPermission|MemoryPermission]] permission</code><br> | ||
+ | <code>r4</code>: <code>[[Memory_Management#enum_MemoryState|MemoryState]] state</code><br> | ||
+ | <code>r5</code>: <code>[[Memory_Management#enum_PageFlags|PageFlags]] page_flags</code> | ||
+ | |- | ||
+ | | 0x03 | ||
+ | | ExitProcess | ||
+ | | None | ||
+ | | None, doesn't return | ||
+ | |- | ||
+ | | 0x04 | ||
+ | | GetProcessAffinityMask | ||
+ | | | ||
+ | <code>r0</code>: <code>[out] u8* affinitymask</code><br> | ||
+ | <code>r1</code>: <code>Handle<[[KProcess]]> process</code><br> | ||
+ | <code>r2</code>: <code>s32 processorcount</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x05 | ||
+ | | SetProcessAffinityMask | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KProcess]]> process</code><br> | ||
+ | <code>r1</code>: <code>[in] const u8* affinitymask</code><br> | ||
+ | <code>r2</code>: <code>s32 processorcount</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x06 | ||
+ | | GetProcessIdealProcessor | ||
+ | | | ||
+ | <code>r1</code>?: <code>Handle<[[KProcess]]> process</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>s32 processorid</code><br> | ||
+ | <code>r2</code>: Clobbered? | ||
+ | |- | ||
+ | | 0x07 | ||
+ | | SetProcessIdealProcessor | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KProcess]]> process</code><br> | ||
+ | <code>r1</code>: <code>s32 processorid</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | |- | ||
+ | | 0x08 | ||
+ | | CreateThread | ||
+ | | | ||
+ | <code>r0</code>: <code>s32 thread_priority</code><br> | ||
+ | <code>r1</code>: <code>ThreadFunc entrypoint</code><br> | ||
+ | <code>r2</code>: <code>u32 arg</code><br> | ||
+ | <code>r3</code>: <code>u32/void* stack_top</code><br> | ||
+ | <code>r4</code>: <code>s32 processor_id</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>Handle<[[KThread]]> thread_handle</code> | ||
+ | |- | ||
+ | | 0x09 | ||
+ | | ExitThread | ||
+ | | None | ||
+ | | None, doesn't return | ||
+ | |- | ||
+ | | 0x0A | ||
+ | | SleepThread | ||
+ | | | ||
+ | <code>r0-r1</code>: <code>s64 nanoseconds</code> | ||
+ | | None | ||
+ | |- | ||
+ | | 0x0B | ||
+ | | GetThreadPriority | ||
+ | | | ||
+ | <code>r0</code>: Ignored?<br> | ||
+ | <code>r1</code>: <code>Handle thread_handle</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>s32 thread_priority</code><br> | ||
+ | <code>r2</code>: Clobbered? | ||
+ | |- | ||
+ | | 0x0C | ||
+ | | SetThreadPriority | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KThread]]> thread_handle</code><br> | ||
+ | <code>r1</code>: <code>s32 thread_priority</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x0D | ||
+ | | GetThreadAffinityMask | ||
+ | | | ||
+ | <code>r0</code>: <code>[out] u8* affinitymask</code><br> | ||
+ | <code>r1</code>: <code>Handle<[[KThread]]> thread_handle</code><br> | ||
+ | <code>r2</code>: <code>s32 processorcount</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x0E | ||
+ | | SetThreadAffinityMask | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KThread]]> thread_handle</code><br> | ||
+ | <code>r1</code>: <code>[in] const u8* affinitymask</code><br> | ||
+ | <code>r2</code>: <code>s32 processorcount</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x0F | ||
+ | | GetThreadIdealProcessor | ||
+ | | | ||
+ | <code>r0</code>: Ignored?<br> | ||
+ | <code>r1</code>: <code>Handle<[[KThread]]> thread_handle</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code><br> | ||
+ | <code>r1</code>: <code>s32 processorid</code> | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | SetThreadIdealProcessor | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KThread]]> thread_handle</code><br> | ||
+ | <code>r1</code>: <code>s32 processorid</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x11 | ||
+ | | GetProcessorID | ||
+ | | | ||
+ | None | ||
+ | | | ||
+ | <code>r0</code>: <code>s32 processorid</code> | ||
+ | |- | ||
+ | | 0x24 | ||
+ | | WaitSynchronization1 | ||
+ | | | ||
+ | <code>r0</code>: <code>Handle<[[KSynchronizationObject]]> handle</code><br> | ||
+ | <code>r2-r3</code>: <code>s64 timeout</code> | ||
+ | | | ||
+ | <code>r0</code>: <code>Result</code> | ||
+ | |- | ||
+ | | 0x1B | ||
+ | | SetTimer | ||
+ | | Timer handle, initial_low, interval_low, initial_high, interval_high | ||
+ | | Result | ||
+ | |- | ||
+ | | 0x28 | ||
+ | | GetSystemTick | ||
+ | | None | ||
+ | | | ||
+ | <code>r0</code>: <code>Low 32 bits of the tick count</code> | ||
+ | <br><code>r1</code>: <code>High 32 bits of the tick count</code> | ||
|- | |- | ||
| 0x2D | | 0x2D | ||
| ConnectToPort | | ConnectToPort | ||
− | | ?? | + | | ??<br><code>r1</code>: <code>pointer to port name</code> |
− | | Result | + | | <code>r0</code>: <code>Result</code><br><code>r1</code>: <code>handle to [[KClientSession]]</code> |
|- | |- | ||
| 0x32 | | 0x32 | ||
| SendSyncRequest | | SendSyncRequest | ||
− | | handle to [[KClientSession]] | + | | <code>r0</code>: <code>handle to [[KClientSession]]</code> |
− | | Result | + | | <code>r0</code>: <code>Result<code> |
|} | |} |
Latest revision as of 11:35, 12 August 2023
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 |
|
|
0x02 | QueryMemory |
|
|
0x03 | ExitProcess | None | None, doesn't return |
0x04 | GetProcessAffinityMask |
|
|
0x05 | SetProcessAffinityMask |
|
|
0x06 | GetProcessIdealProcessor |
|
|
0x07 | SetProcessIdealProcessor |
|
|
0x08 | CreateThread |
|
|
0x09 | ExitThread | None | None, doesn't return |
0x0A | SleepThread |
|
None |
0x0B | GetThreadPriority |
|
|
0x0C | SetThreadPriority |
|
|
0x0D | GetThreadAffinityMask |
|
|
0x0E | SetThreadAffinityMask |
|
|
0x0F | GetThreadIdealProcessor |
|
|
0x10 | SetThreadIdealProcessor |
|
|
0x11 | GetProcessorID |
None |
|
0x24 | WaitSynchronization1 |
|
|
0x1B | SetTimer | Timer handle, initial_low, interval_low, initial_high, interval_high | Result |
0x28 | GetSystemTick | None |
|
0x2D | ConnectToPort | ??r1 : pointer to port name
|
r0 : Result r1 : handle to KClientSession
|
0x32 | SendSyncRequest | r0 : handle to KClientSession
|
r0 : Result |