From 0e73aff73d301aac59dd604f6137969c3e2403ce Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 6 Feb 2020 00:29:09 +0100 Subject: read write protection, ft_list_size, ft_list_push_front finished --- ft_write.s | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ft_write.s') 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 -- cgit