Luna/libc/src/arch/x86_64/crt0.S

32 lines
419 B
ArmAsm
Raw Normal View History

.section .text
.global _start
.extern exit
.extern libc_init
_start:
# Set up end of the stack frame linked list.
movq $0, %rbp
pushq %rbp # rip=0
pushq %rbp # rbp=0
movq %rsp, %rbp
2023-03-18 21:25:19 +00:00
pushq %rsi
pushq %rdi
pushq %rcx
2023-03-18 21:25:19 +00:00
call libc_init
# Run the global constructors.
call _init
popq %rdx
2023-03-18 21:25:19 +00:00
popq %rdi
popq %rsi
# Run main
call main
# Terminate the process with the exit code.
movl %eax, %edi
call exit