lib: c: implement runtime initialisation
This commit is contained in:
@@ -3,18 +3,20 @@
|
||||
.global _start
|
||||
.type _start, @function
|
||||
|
||||
.extern main
|
||||
.type main, @function
|
||||
.extern __libc_init
|
||||
.type __libc_init, @function
|
||||
|
||||
.extern task_exit
|
||||
.type task_exit, @function
|
||||
|
||||
_start:
|
||||
# Args (as provided by the ABI)
|
||||
# %rdi: int argc
|
||||
# %rsi: const char **argv
|
||||
# %rdx: kern_handle_t task
|
||||
# %rcx: kern_handle_t address_space
|
||||
# %rdi: (struct rosetta_bootstrap *)bs_info
|
||||
mov %rdi, %rbx
|
||||
call __libc_init
|
||||
|
||||
mov 0(%rbx), %rdi # argc
|
||||
mov 8(%rbx), %rsi # argv
|
||||
mov 24(%rbx), %rdx # envp
|
||||
call main
|
||||
|
||||
mov %rax, %rdi
|
||||
|
||||
Reference in New Issue
Block a user