Kernel/LibC: Add crt* files to LibC and remove crt0 from kernel

There was no reason for libc get crt0 from kernel.
This commit is contained in:
2023-10-30 11:06:13 +02:00
parent f33c0bad99
commit 0b5fcb3f88
5 changed files with 49 additions and 19 deletions

View File

@@ -1,34 +0,0 @@
.section .text
.global _start
_start:
# Set up end of the stack frame linked list.
movq $0, %rbp
pushq %rbp # rip=0
pushq %rbp # rbp=0
movq %rsp, %rbp
# We need those in a moment when we call main.
pushq %rdx
pushq %rsi
pushq %rdi
# Prepare signals, memory allocation, stdio and such.
movq %rdx, %rdi
call _init_libc
# Run the global constructors.
call _init
# Restore argc and argv.
popq %rdi
popq %rsi
popq %rdx
# Run main
call main
# Terminate the process with the exit code.
movl %eax, %edi
call exit
.size _start, . - _start