Syscall Table — AeroOS 26R1
U-mode user programs trap to S-mode via the ecall instruction. trap.S's trap_ecall handler dispatches based on register a7.
Full Syscall Table
| a7 | Name | a0 | a1 | a2 | Backend | 26R1 Status |
|---|---|---|---|---|---|---|
| 1 | sys_write |
s: str* |
n: i64 |
— | C aeroos_sys_write() |
✅ Available |
| 2 | sys_yield |
— | — | — | asm yield | ✅ Available |
| 3 | sys_exit |
— | — | — | asm exit | ✅ Available |
| 4 | sys_fork |
entry: u64 |
— | — | C aeroos_sys_fork() |
✅ Available |
sys_write (a7=1)
C signature:
int64_t sys_write(const char *s, int64_t n);
Aero example:
extern "C" fn sys_write(s: str, n: i64) -> i64;
sys_write("hello\n", 6);
sys_yield (a7=2)
Cooperative yield. Forces scheduler tick. 26R1 uses cooperative yield + preemptive timer dual-track: - U-mode programs actively yield → good fairness - Timer interrupt force-preempts (0.2s period) → no starvation
Adding a new syscall
- Add C backend in
api.c - Add
a7dispatch case intrap.S trap_ecall - Add asm shim in
syscall_shim.S - Update this doc and
API-REFERENCE.md