Luna/libs/libc/crt0.asm
apio 7d20c507b1 Kernel, libc, userspace: Implement command-line arguments (argv)
The only thing missing now is for sh to pass them on.
2022-10-26 18:57:06 +02:00

35 lines
377 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
push rdi
push rsi
call initialize_libc
call _init
pop rsi ; argv
pop rdi ; argc
call main
push rax
call _fini
pop rdi
call exit