utest: add syscall test

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-19 21:43:37 -04:00
commit 7cc7da0f54
3 changed files with 52 additions and 2 deletions

22
usr.bin/utest/syscall.S Normal file
View file

@ -0,0 +1,22 @@
.intel_syntax noprefix
.macro syscall_define name no
.global \name
\name:
mov rax, \no
mov r10, rcx
call syscall
ret
.endm
.global syscall
syscall:
mov r10, rcx
syscall
ret
syscall_define read 0
syscall_define write 1
syscall_define open 2
syscall_define close 3