Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/arch/i386/socketcall.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File size: 838 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 #
2 # socketcall.S
3 #
4 # Socketcalls use the following convention:
5 # %eax = __NR_socketcall
6 # %ebx = socketcall number
7 # %ecx = pointer to arguments (up to 6)
8 #
9
10 #include <asm/unistd.h>
11
12 #ifdef __i386__
13
14 .text
15 .align 4
16 .globl __socketcall_common
17 .type __socketcall_common, @function
18
19 __socketcall_common:
20 xchgl %ebx,(%esp) # The stub passes the socketcall # on stack
21
22 #ifdef _REGPARM
23 pushl 16(%esp) # Arg 6
24 pushl 16(%esp) # Arg 5
25 pushl 16(%esp) # Arg 4
26 pushl %ecx
27 pushl %edx
28 pushl %eax
29 movl %esp,%ecx
30 #else
31 leal 8(%esp),%ecx # Arguments already contiguous on-stack
32 #endif
33
34 movl $__NR_socketcall,%eax
35 int $0x80
36
37 #ifdef _REGPARM
38 addl $6*4, %esp
39 #endif
40
41 cmpl $-4095,%eax # Error return?
42
43 popl %ebx
44
45 jb 1f
46
47 negl %eax
48 movl %eax,errno
49 orl $-1,%eax # Return -1
50 1:
51 ret
52
53 .size __socketcall_common,.-__socketcall_common
54
55 #endif