-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memalloc.s
More file actions
38 lines (34 loc) · 1.22 KB
/
ft_memalloc.s
File metadata and controls
38 lines (34 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# **************************************************************************** #
# #
# ::: :::::::: #
# ft_memalloc.s :+: :+: :+: #
# +:+ +:+ +:+ #
# By: edelangh <edelangh@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/03/24 17:12:14 by edelangh #+# #+# #
# Updated: 2015/03/27 18:14:47 by edelangh ### ########.fr #
# #
# **************************************************************************** #
section .text
global _ft_memalloc
extern _malloc
extern _ft_bzero
; rdi rsi rdx
_ft_memalloc:
enter 24, 0
mov rax, 0
cmp rdi, 0
je end
malloc:
mov qword [rbp - 8], rdi
call _malloc
test rax, rax
jz end
mov qword [rbp - 16], rax
mov rdi, rax
mov rsi, qword [rbp - 8]
call _ft_bzero
mov rax, qword [rbp - 16]
end:
leave
ret