add: ft_read

This commit is contained in:
2024-09-03 14:34:52 +02:00
parent a05124885e
commit 174a587414
2 changed files with 27 additions and 1 deletions

25
src/ft_read.asm Normal file
View File

@ -0,0 +1,25 @@
extern __errno_location
section .text
global ft_read
ft_read:
xor rax, rax
syscall
cmp rax, 0
jne syscall_failed
ret
syscall_failed:
neg rax
mov rbx, rax
call __errno_location wrt ..plt
mov [rax], rbx
mov rax, -1
ret