Luna/libs/libc/crt0.asm
apio 80ab982fe4 libc: make stdout and stderr functional
what were before one extern FILE* without reference now are opened by libc on program initialization, to point to /dev/console by default.
2022-10-11 21:08:46 +02:00

32 lines
376 B
NASM

section .text
extern _init
extern main
extern _fini
extern initialize_libc
extern exit
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, 0 ; argv = 0
call main
push rax
call _fini
pop rdi
call exit