utest: add syscall test
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
c5091ea5d9
commit
7cc7da0f54
3 changed files with 52 additions and 2 deletions
22
usr.bin/utest/syscall.S
Normal file
22
usr.bin/utest/syscall.S
Normal 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
|
||||
|
||||
Loading…
Reference in a new issue