chiark / gitweb /
[PATCH] added klibc version 0.82 (cvs tree) to the udev tree.
[elogind.git] / klibc / klibc / arch / i386 / socketcall.S
1 #
2 # socketcall.S
3 #
4 # On i386, the main (only?) user of socketcall(2), the memory array
5 # socketcall(2) needs is conveniently already assembled for us on
6 # the stack.  Capitalize on that to make a common socketcall stub.
7 #
8
9 #include <asm/unistd.h>
10
11 #ifdef __i386__
12
13         .text
14         .align 4
15         .globl __socketcall_common
16         .type __socketcall_common, @function
17
18 __socketcall_common:
19         pushl %ebx
20         movzbl %al,%ebx         # The socketcall number is passed in in %al
21         leal 8(%esp),%ecx       # Argument pointer
22         movl $__NR_socketcall, %eax
23         int $0x80
24         cmpl $-125,%eax         # Error return?
25         popl %ebx
26         jb 1f
27         neg %eax
28         movl %eax,errno
29         xorl %eax,%eax
30         decl %eax               # Return = -1
31 1:
32         ret
33
34         .size __socketcall_common,.-__socketcall_common
35         
36 #endif
37
38