Kernel ABI: Difference between revisions

m guess i should do this one too
m typo
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Inputs are read from registers starting from r0 and outputs are written back to the same registers (also starting with r0).
= Calling Convention =
Seems to be [https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#the-base-procedure-call-standard AAPCS]-based (with modifications)


== Overview ==
=== Inputs ===
* <code>r0–r3</code> : Argument / Scratch registers (caller-saved), inherited from AAPCS. ''If an input is to be placed on the stack, it will instead use the next free register starting from <code>r0</code>.''
=== Outputs ===
* <code>r0-r1</code> : Result, inherited from AAPCS. ''If multiple outputs are returned (e.g., <code>ControlMemory</code>), they are placed in consecutive registers starting from <code>r0</code>.''
== Example ==
<code>Result ControlMemory(uintptr_t* out, uintptr_t addr0, uintptr_t addr1, size_t size, MemoryOperation operation, MemoryPermission permissions)</code>
=== Inputs ===
Following standard [https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#the-base-procedure-call-standard AAPCS] register selection:
; <code>r1</code> -> addr0
; <code>r2</code> -> addr1
; <code>r3</code> -> size
As there are still more arguments, the next free registers are selected starting from <code>r0</code>
; <code>r0</code> -> operation
; <code>r4</code> -> permissions
=== Outputs ===
; <code>r0</code> -> Result
; <code>r1</code> -> uintptr_t out
== System calls ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 167: Line 194:
| Timer handle, initial_low, interval_low, initial_high, interval_high
| Timer handle, initial_low, interval_low, initial_high, interval_high
| Result
| 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