[crt0] Actually pass argc, argv, envp to main()s

With the new SysV style process init args, it's a bit easier to finally
parse out argc, argv, and envp from the stack and pass them on to main
functions.
This commit is contained in:
Justin C. Miller
2024-08-10 17:37:34 -07:00
parent fa587060f1
commit d3f5db2479
3 changed files with 14 additions and 4 deletions

View File

@@ -87,11 +87,16 @@ _libc_crt0_start:
call __run_global_ctors
; argc
mov rdi, [r15]
; argv
mov rsi, r15
add rsi, 8
mov rdx, 0 ; TODO: actually parse stack for argc, argv, envp
mov rcx, rbx
; envp
lea rdx, [rsi + rdi*8 + 8]
lookup_GOT main
call rax