chiark / gitweb /
volume_id: provide libvolume_id.a file
[elogind.git] / klibc / klibc / arch / i386 / exits.S
1 #
2 # exit and _exit get included in *every* program, and gcc generates
3 # horrible code for them.  Yes, this only saves a few bytes, but
4 # it does it in every program.
5 #
6
7 #include <asm/unistd.h>
8
9         .data
10         .align 4
11         .globl __exit_handler
12         .type __exit_handler,@object
13 __exit_handler:
14         .long _exit
15         .size __exit_handler,4
16
17         .text
18         .align 4
19         .globl exit
20         .type exit,@function
21 exit:
22         jmp *(__exit_handler)
23         .size exit,.-exit
24
25         /* No need to save any registers... we're exiting! */
26         .text
27         .align 4
28         .globl _exit
29         .type _exit,@function
30 _exit:
31 #ifdef _REGPARM
32         movl %eax,%ebx
33 #else
34         popl %ebx
35         popl %ebx
36 #endif
37 #if __NR_exit == 1
38         xorl %eax,%eax
39         incl %eax
40 #else
41         movl $__NR_exit,%eax
42 #endif
43         int $0x80
44         hlt
45         .size _exit,.-exit