btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / glue / arch / x86 / crti.S
blob711213cdfe254f0d6252cf5a9c6fcaf00052c459
1 /*
2  * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
6 /**     This file contains the first part of the ".init" and ".fini" sections in
7  *      the ELF executable.
8  *      The functions defined here will be called during initialization/termination
9  *      of the loaded executable/library. The ".init" and ".fini" sections are
10  *      stacked together like this:
11  *
12  *      crti.S          entry point
13  *                              call to _init_before/_term_before
14  *      crtbegin.S      GCC specific: constructors/destructors are called, ...
15  *      crtend.S
16  *      crtn.S          call to _init_after/_term_after
17  *                              exit
18  */
20 #define FUNCTION(x) .global x; .type x,@function; x
22 .section .init
23 FUNCTION(_init):
24         pushl   %ebp
25         movl    %esp, %ebp
26         sub     $4,%esp         // Keep stack aligned
27         pushl   8(%ebp)         // put image ID on the stack again
28         call    __haiku_init_before
29         // crtbegin.o stuff comes here
31 .section .fini
32 FUNCTION(_fini):
33         pushl   %ebp
34         movl    %esp, %ebp
35         sub     $4,%esp         // Keep stack aligned
36         pushl   8(%ebp)
37         call    __haiku_term_before
38         // crtend.o stuff comes here