mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix _start not following the ABI.
This commit is contained in:
parent
5c702ed44b
commit
690b5ada52
2 changed files with 16 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
|
@ -36,7 +36,8 @@ _start:
|
|||
|
||||
movq %rcx, environ # envp
|
||||
|
||||
# Prepare signals, memory allocation, stdio and such.
|
||||
# Initialize the standard library.
|
||||
subq $8, %rsp
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
pushq %rcx
|
||||
|
@ -49,6 +50,7 @@ _start:
|
|||
popq %rdx # Note! envp is now %rdx (previously %rcx)
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
addq $8, %rsp
|
||||
call main
|
||||
|
||||
# Terminate the process with main's exit code.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
|
@ -37,12 +37,18 @@ _start:
|
|||
movl %ecx, environ # envp
|
||||
|
||||
# Arguments for main
|
||||
push %ecx # envp
|
||||
push %ebx # argv
|
||||
push %eax # argc
|
||||
subl $12, %esp
|
||||
push %ecx # envp (to main)
|
||||
push %ebx # argv (to main)
|
||||
push %eax # argc (to main)
|
||||
subl $4, %esp
|
||||
push %ecx # envp (to initialize_standard_library)
|
||||
push %ebx # argv (to initialize_standard_library)
|
||||
push %eax # argc (to initialize_standard_library)
|
||||
|
||||
# Prepare signals, memory allocation, stdio and such.
|
||||
# Initialize the standard library.
|
||||
call initialize_standard_library
|
||||
addl $16, %esp
|
||||
|
||||
# Run the global constructors.
|
||||
call _init
|
||||
|
@ -51,6 +57,7 @@ _start:
|
|||
call main
|
||||
|
||||
# Terminate the process with main's exit code.
|
||||
subl $12, %esp
|
||||
push %eax
|
||||
call exit
|
||||
.size _start, .-_start
|
||||
|
|
Loading…
Add table
Reference in a new issue