diff options
Diffstat (limited to 'usr/klibc/arch/i386/crt0.S')
-rw-r--r-- | usr/klibc/arch/i386/crt0.S | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/usr/klibc/arch/i386/crt0.S b/usr/klibc/arch/i386/crt0.S new file mode 100644 index 0000000..8c6635e --- /dev/null +++ b/usr/klibc/arch/i386/crt0.S @@ -0,0 +1,31 @@ +# +# arch/i386/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .align 4 + .type _start,@function + .globl _start +_start: + # Save the address of the ELF argument array + movl %esp,%eax # Address of ELF arguments + # Set up a faux stack frame for the benefit of gdb + xorl %ebp,%ebp + push %ebp # Keep gdb from getting confused + push %ebp # Keep gdb from getting confused + # Push the arguments and called __libc_init() +#ifndef _REGPARM + push %edx # atexit() function + push %eax # ELF array +#endif + call __libc_init + # If __libc_init returns, problem... + hlt + + .size _start, .-_start |