30 lines
340 B
ArmAsm
30 lines
340 B
ArmAsm
global ft_list_push_front
|
|
extern malloc
|
|
|
|
section .text
|
|
|
|
ft_list_push_front:
|
|
test rdi, rdi
|
|
jz err
|
|
|
|
push rdi
|
|
push rsi
|
|
mov rdi, 10
|
|
call malloc wrt ..plt
|
|
pop rsi
|
|
pop rdi
|
|
|
|
test rax, rax ; did malloc return 0
|
|
jz err
|
|
|
|
push rdi
|
|
mov rdi, [rdi]
|
|
mov [rax + 8], rdi ;set both settings
|
|
mov [rax], rsi
|
|
pop rdi
|
|
|
|
mov [rdi], rax
|
|
|
|
err:
|
|
ret
|