aboutsummaryrefslogtreecommitdiff
path: root/ft_write.s
diff options
context:
space:
mode:
Diffstat (limited to 'ft_write.s')
-rw-r--r--ft_write.s14
1 files changed, 13 insertions, 1 deletions
diff --git a/ft_write.s b/ft_write.s
index c558ab6..13f4c6a 100644
--- a/ft_write.s
+++ b/ft_write.s
@@ -12,8 +12,20 @@
global _ft_write
-; int ft_write(int, const void*, size_t);
+; int ft_write(int rdi, const void *rsi, size_t rdx);
_ft_write:
+ cmp rdx, 0
+ je FT_WRITE_NO_SIZE
+ cmp rdi, 0
+ jl FT_WRITE_ERROR
+ cmp rsi, 0
+ je FT_WRITE_ERROR
mov rax, 0x2000004
syscall
ret
+FT_WRITE_ERROR:
+ mov rax, -1
+ ret
+FT_WRITE_NO_SIZE:
+ mov rax, 0
+ ret