Paweł Wieczorek avatar Paweł Wieczorek committed b842a93 Draft

skeleton for main

Comments (0)

Files changed (2)

 GLOBAL_PROC main
     FRAME_ENTER size=16
 
-    call sock_create
-    mov     %rax,           %r15
-    lea     -0x8(%rbp),     %r14
+    call prepare_server
+    call serve
 
-    mov     %r14,           %rdi
-    mov     $addr,          %rsi
-    mov     $0x0,           %rdx
-    call    fill_sockaddr_in
+    mov $0x0, %rax
+    FRAME_LEAVE
 
-    mov     %r15,           %rdi
-    mov     %r14,           %rsi
-    call    sock_bind
+LOCAL_PROC prepare_server
+    FRAME_ENTER
+    FRAME_LEAVE
 
-    mov     %r15,           %rdi
-    mov     $0x100,         %rsi
-    call    sock_listen
+LOCAL_PROC serve
+    FRAME_ENTER
+
+serve.main_loop:
+    call wait_for_client
+    jmp serve.main_loop
 
     FRAME_LEAVE
 
+LOCAL_PROC wait_for_client
+    FRAME_ENTER
+    call handle_client
+    FRAME_LEAVE
+
+LOCAL_PROC handle_client
+    FRAME_ENTER
+    FRAME_LEAVE
 
 LOCAL_PROC print_int
     FRAME_ENTER
 ##########################################################################
 .section .text
 
-# SOCKET_T
-# [l
-
 # sock_create(SOCKET_T &sock)
 GLOBAL_PROC sock_create
     FRAME_ENTER
     FRAME_LEAVE
 
 ##########################################################################
-# SECTION TEXT
+# SECTION DATA
 ##########################################################################
 .section .data
 
 
 .set SOCKADDR_IN_SIZE, 16
 
-
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.