add other basic functions and test with them
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
global ft_read
|
||||
extern __errno_location
|
||||
section .text
|
||||
|
||||
ft_read:
|
||||
mov rax, 0 ;syscall number for read, args are already set at the right place
|
||||
syscall
|
||||
|
||||
cmp rax, 0 ; if return is < 0, it's an error in negative
|
||||
jg success
|
||||
|
||||
neg rax ; inv errno, and set errno
|
||||
mov edi, eax
|
||||
call __errno_location wrt ..plt
|
||||
mov [rax], edi
|
||||
mov rax, -1
|
||||
|
||||
success:
|
||||
ret
|
||||
|
Reference in New Issue
Block a user