tcp client

This commit is contained in:
2025-06-30 11:20:09 +02:00
parent 2b9bcbc56f
commit a8ce309eac
3 changed files with 50 additions and 2 deletions

View File

@@ -124,6 +124,12 @@ extern readdir
extern closedir
extern exit
extern gettimeofday
extern connect
extern inet_addr
extern socket
extern send
extern read
extern close
section .text._builtin_deref
_builtin_deref:
@@ -245,6 +251,28 @@ _builtin_array_free:
mov rdi, rbx
pop rbx
jmp free
_builtin_sa_from_addr:
push r15
push r14
push rbx
mov rbx, rsi
mov r14, rdi
push 16
pop rdi
call malloc
mov r15, rax
mov dword [rax], 2
rol bx, 8
mov word [rax+2], bx
mov rdi, r14
call inet_addr
mov dword [r15+4], eax
mov rax, r15
pop rbx
pop r14
pop r15
ret
"
);
Ok(())

View File

@@ -11,8 +11,8 @@ func print_i64[x: I64] : I64
func String.nth[s: String, n: I64] : U8
return _builtin_deref(s + n)
func String.set[s: String, n: I64] : I64
_builtin_string_set(s, n)
func String.set[s: String, n: I64, c: U8] : I64
_builtin_string_set(s, n, c)
func String.is_whitespace[c: U8] : Bool
return c == ' ' || c == 10 || c == 13 || c == 9