From 9c5783f030d7c876ccf6e05e8182d88f84a97fc3 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Fri, 20 Sep 2024 00:22:43 +0200 Subject: it works, sometimes --- sys.asm | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'sys.asm') diff --git a/sys.asm b/sys.asm index b9ab190..a237890 100644 --- a/sys.asm +++ b/sys.asm @@ -6,6 +6,10 @@ 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 @@ -38,31 +42,15 @@ macro ls_open filename, flags, mode { scall3 2, filename, flags, mode } macro ls_close fd { scall1 3, fd } -;; kernel: arch/x86/include/uapi/asm/stat.h -;; struc stat -;; { -;; .st_dev rd 1 -;; .st_ino rd 1 -;; .st_mode rw 1 -;; .st_nlink rw 1 -;; .st_uid rw 1 -;; .st_gid rw 1 -;; .st_rdev rd 1 -;; .st_size rd 1 -;; .st_blksize rd 1 -;; .st_blocks rd 1 -;; -;; .st_atime rd 1 -;; .st_atime_nsec rd 1 -;; .st_mtime rd 1 -;; .st_mtime_nsec rd 1 -;; .st_ctime rd 1 -;; .st_ctime_nsec rd 1 -;; -;; .__unused4 rd 1 -;; .__unused5 rd 1 -;; } -macro ls_stat filename, statbuf { scall2 4, filename, statbuf } +;; 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 } -- cgit v1.2.3