summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-09-20 10:51:45 +0200
committerfxqnlr <[email protected]>2024-09-20 10:51:45 +0200
commit0b7957db671400ee34f8f597b409f792e5300186 (patch)
tree8d0375b54a861b6de54c69a34fdd68d20e959d76
parent9c5783f030d7c876ccf6e05e8182d88f84a97fc3 (diff)
downloadasmsite-main.tar
asmsite-main.tar.gz
asmsite-main.zip
stuff and debug deleteHEADmain
-rw-r--r--.gitignore1
-rwxr-xr-xdebugbin15552 -> 0 bytes
-rw-r--r--main.asm16
-rw-r--r--sys.asm2
4 files changed, 17 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index e36c9ec..6717582 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ gf/
2fasm/ 2fasm/
3main 3main
4*.c 4*.c
5debug
diff --git a/debug b/debug
deleted file mode 100755
index a0634a1..0000000
--- a/debug
+++ /dev/null
Binary files 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]
12segment writable readable 12segment writable readable
13connect_header db 'HTTP/1.1 200 OK', 13, 10 13connect_header db 'HTTP/1.1 200 OK', 13, 10
14 db 'Content-Type: text/html', 13, 10 14 db 'Content-Type: text/html', 13, 10
15 db 'Server: asmsite', 13, 10
15 db 'Connection: close', 13, 10 16 db 'Connection: close', 13, 10
16 db 13, 10 17 db 13, 10
17 db '<!DOCTYPE html><html><head><title>asmsite</title></head><body>Hello, World!</body></html>', 10 18 db '<!DOCTYPE html><html><head><title>asmsite</title></head><body>Hello, World!</body></html>', 10
18connect_header_len = $ - connect_header 19connect_header_len = $ - connect_header
19 20
20stat_msg db 'Get file stats', 10 21stat_msg db 'Get file stats', 10
@@ -50,6 +51,13 @@ serveraddr_len = $ - serveraddr.sin_family
50clientaddr servaddr_in 51clientaddr servaddr_in
51clientaddr_len dd serveraddr_len 52clientaddr_len dd serveraddr_len
52 53
54struc timespec
55{
56 .time dq 0
57 .time_nano dd 0
58}
59sleep_time timespec
60
53segment readable executable 61segment readable executable
54 62
55entry _main 63entry _main
@@ -92,7 +100,7 @@ _main:
92 jl error 100 jl error
93 101
94 ls_write STDOUT, listen_msg, listen_msg.size 102 ls_write STDOUT, listen_msg, listen_msg.size
95 ls_listen qword [socketfd], 5 103 ls_listen qword [socketfd], 4096
96 cmp rax, 0 104 cmp rax, 0
97 jl error 105 jl error
98 106
@@ -106,6 +114,10 @@ listen:
106 114
107 ls_write qword [connfd], connect_header, connect_header_len 115 ls_write qword [connfd], connect_header, connect_header_len
108 116
117 ;; mov [sleep_time.time], 10
118 ;; mov [sleep_time.time_nano], 1000
119 ;; ls_nanosleep sleep_time.time, 0
120
109 ls_close qword [connfd] 121 ls_close qword [connfd]
110 122
111 jmp listen 123 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 }
44 44
45;; macro ls_stat filename, statbuf { scall2 4, filename, statbuf } 45;; macro ls_stat filename, statbuf { scall2 4, filename, statbuf }
46 46
47macro ls_nanosleep rqtp, rmtp { scall2 35, rqtp, rmtp }
48
47macro ls_socket family, type, protocol { scall3 41, family, type, protocol } 49macro ls_socket family, type, protocol { scall3 41, family, type, protocol }
48 50
49macro ls_accept fd, upeer_sockaddr, upeer_addrlen { scall3 43, fd, upeer_sockaddr, upeer_addrlen } 51macro ls_accept fd, upeer_sockaddr, upeer_addrlen { scall3 43, fd, upeer_sockaddr, upeer_addrlen }