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_list_push_front.s | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'ft_list_push_front.s') diff --git a/ft_list_push_front.s b/ft_list_push_front.s index 686ee10..6a95909 100644 --- a/ft_list_push_front.s +++ b/ft_list_push_front.s @@ -10,13 +10,28 @@ ; ; ; **************************************************************************** ; +extern _malloc + global _ft_list_push_front ; void ft_list_push_front(t_list **begin_list, void *data); _ft_list_push_front: - cmp rdi, 0 - je FT_LIST_PUSH_FRONT_END - mov [rsi + 8], [rdi] - mov [rdi], rsi + cmp rdi, 0 + je FT_LIST_PUSH_FRONT_END + + push rdi + push rsi + xor rdi, rdi + mov edi, 16 + call _malloc + pop rsi + pop rdi + cmp rax, 0 + je FT_LIST_PUSH_FRONT_END + + mov qword [rax + 0], rsi + mov r10, [rdi] + mov [rax + 8], r10 + mov [rdi], rax FT_LIST_PUSH_FRONT_END: ret -- cgit