From 0b7957db671400ee34f8f597b409f792e5300186 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Fri, 20 Sep 2024 10:51:45 +0200 Subject: stuff and debug delete --- .gitignore | 1 + debug | Bin 15552 -> 0 bytes main.asm | 16 ++++++++++++++-- sys.asm | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) delete mode 100755 debug diff --git a/.gitignore b/.gitignore index e36c9ec..6717582 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ gf/ fasm/ main *.c +debug diff --git a/debug b/debug deleted file mode 100755 index a0634a1..0000000 Binary files a/debug and /dev/null differ diff --git a/main.asm b/main.asm index 8c19651..03148b4 100644 --- a/main.asm +++ b/main.asm @@ -12,9 +12,10 @@ struc db [data] segment writable readable connect_header db 'HTTP/1.1 200 OK', 13, 10 db 'Content-Type: text/html', 13, 10 + db 'Server: asmsite', 13, 10 db 'Connection: close', 13, 10 db 13, 10 - db 'asmsiteHello, World!', 10 + db 'asmsiteHello, World!', 10 connect_header_len = $ - connect_header stat_msg db 'Get file stats', 10 @@ -50,6 +51,13 @@ serveraddr_len = $ - serveraddr.sin_family clientaddr servaddr_in clientaddr_len dd serveraddr_len +struc timespec +{ + .time dq 0 + .time_nano dd 0 +} +sleep_time timespec + segment readable executable entry _main @@ -92,7 +100,7 @@ _main: jl error ls_write STDOUT, listen_msg, listen_msg.size - ls_listen qword [socketfd], 5 + ls_listen qword [socketfd], 4096 cmp rax, 0 jl error @@ -106,6 +114,10 @@ listen: ls_write qword [connfd], connect_header, connect_header_len + ;; mov [sleep_time.time], 10 + ;; mov [sleep_time.time_nano], 1000 + ;; ls_nanosleep sleep_time.time, 0 + ls_close qword [connfd] jmp listen diff --git a/sys.asm b/sys.asm index a237890..e8ee2e1 100644 --- a/sys.asm +++ b/sys.asm @@ -44,6 +44,8 @@ macro ls_close fd { scall1 3, fd } ;; macro ls_stat filename, statbuf { scall2 4, filename, statbuf } +macro ls_nanosleep rqtp, rmtp { scall2 35, rqtp, rmtp } + 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 } -- cgit v1.2.3