STDIN equ 0
STDOUT equ 1
STDERR equ 2
O_RDONLY equ 0
O_WRONLY equ 1
O_RDWR equ 2
AF_INET equ 2
SOCK_STREAM equ 1
INADDR_ANY equ 0
macro scall1 v_rax, v_rdi
{
mov rax, v_rax
mov rdi, v_rdi
syscall
}
macro scall2 v_rax, v_rdi, v_rsi
{
mov rax, v_rax
mov rdi, v_rdi
mov rsi, v_rsi
syscall
}
macro scall3 v_rax, v_rdi, v_rsi, v_rdx
{
mov rax, v_rax
mov rdi, v_rdi
mov rsi, v_rsi
mov rdx, v_rdx
syscall
}
macro ls_read fd, buf, count { scall3 0, fd, buf, count }
macro ls_write fd, buf, count { scall3 1, fd, buf, count }
macro ls_open filename, flags, mode { scall3 2, filename, flags, mode }
macro ls_close fd { scall1 3, fd }
;; macro ls_stat filename, statbuf { scall2 4, filename, statbuf }
macro ls_socket family, type, protocol { scall3 41, family, type, protocol }
macro ls_accept fd, upeer_sockaddr, upeer_addrlen { scall3 43, fd, upeer_sockaddr, upeer_addrlen }
macro ls_bind fd, umyaddr, addrlen { scall3 49, fd, umyaddr, addrlen }
macro ls_listen fd, backlog { scall2 50, fd, backlog }
macro ls_exit status { scall1 60, status }