Luna/libs/libc/crt0.asm
2022-10-21 18:33:06 +02:00

34 lines
423 B
NASM

section .text
extern _init
extern main
extern _fini
extern initialize_libc
extern exit
extern __argv
global _start
_start:
; Set up end of the stack frame linked list.
xor rbp, rbp
push rbp ; rip=0
push rbp ; rbp=0
mov rbp, rsp
call initialize_libc
call _init
mov rdi, 0 ; argc = 0
mov rsi, __argv ; Dummy argv which is equal to {NULL}
call main
push rax
call _fini
pop rdi
call exit