Fix _start not following the ABI.
This commit is contained in:
parent
5c702ed44b
commit
690b5ada52
|
@ -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.
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ _start:
|
||||||
|
|
||||||
movq %rcx, environ # envp
|
movq %rcx, environ # envp
|
||||||
|
|
||||||
# Prepare signals, memory allocation, stdio and such.
|
# Initialize the standard library.
|
||||||
|
subq $8, %rsp
|
||||||
pushq %rsi
|
pushq %rsi
|
||||||
pushq %rdi
|
pushq %rdi
|
||||||
pushq %rcx
|
pushq %rcx
|
||||||
|
@ -49,6 +50,7 @@ _start:
|
||||||
popq %rdx # Note! envp is now %rdx (previously %rcx)
|
popq %rdx # Note! envp is now %rdx (previously %rcx)
|
||||||
popq %rdi
|
popq %rdi
|
||||||
popq %rsi
|
popq %rsi
|
||||||
|
addq $8, %rsp
|
||||||
call main
|
call main
|
||||||
|
|
||||||
# Terminate the process with main's exit code.
|
# 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.
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
@ -37,12 +37,18 @@ _start:
|
||||||
movl %ecx, environ # envp
|
movl %ecx, environ # envp
|
||||||
|
|
||||||
# Arguments for main
|
# Arguments for main
|
||||||
push %ecx # envp
|
subl $12, %esp
|
||||||
push %ebx # argv
|
push %ecx # envp (to main)
|
||||||
push %eax # argc
|
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
|
call initialize_standard_library
|
||||||
|
addl $16, %esp
|
||||||
|
|
||||||
# Run the global constructors.
|
# Run the global constructors.
|
||||||
call _init
|
call _init
|
||||||
|
@ -51,6 +57,7 @@ _start:
|
||||||
call main
|
call main
|
||||||
|
|
||||||
# Terminate the process with main's exit code.
|
# Terminate the process with main's exit code.
|
||||||
|
subl $12, %esp
|
||||||
push %eax
|
push %eax
|
||||||
call exit
|
call exit
|
||||||
.size _start, .-_start
|
.size _start, .-_start
|
||||||
|
|
Loading…
Reference in New Issue