Commits

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
 
-
-