Update.
[glibc.git] / sysdeps / unix / sysv / linux / powerpc / socket.S
blob32bb8f64cd9b389492644c01447f83132d2e1d26
1 /* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
19 #include <sysdep.h>
20 #include <sys/socketcall.h>
22 #define P(a, b) P2(a, b)
23 #define P2(a, b) a##b
25 /* The socket-oriented system calls are handled unusally in Linux.
26    They are all gated through the single `socketcall' system call number.
27    `socketcall' takes two arguments: the first is the subcode, specifying
28    which socket function is being called; and the second is a pointer to
29    the arguments to the specific function.
31    The .S files for the other calls just #define socket and #include this.
32    They also #define a 'number-of-arguments' word in NARGS, which
33    defaults to 3.  */
35 #ifndef NARGS
36 #ifdef socket
37 #error NARGS not defined
38 #endif
39 #define NARGS 3
40 #endif
42 #define stackblock 20
44         .text
45 ENTRY(P(__,socket))
46         stwu 1,-48(1)
47 #if NARGS >= 1
48         stw 3,stackblock(1)
49 #endif
50 #if NARGS >= 2
51         stw 4,4+stackblock(1)
52 #endif
53 #if NARGS >= 3
54         stw 5,8+stackblock(1)
55 #endif
56 #if NARGS >= 4
57         stw 6,12+stackblock(1)
58 #endif
59 #if NARGS >= 5
60         stw 7,16+stackblock(1)
61 #endif
62 #if NARGS >= 6
63         stw 8,20+stackblock(1)
64 #endif
65 #if NARGS >= 7
66         stw 9,24+stackblock(1)
67 #endif
68 #if NARGS >= 8
69         stw 10,28+stackblock(1)
70 #endif
71 #if NARGS >= 9
72 #error too many arguments!
73 #endif
74         li 3,P(SOCKOP_,socket)
75         addi 4,1,stackblock
76         DO_CALL(SYS_ify(socketcall))
77         addi 1,1,48
78         bnslr
79         b __syscall_error
81 PSEUDO_END (P(__,socket))
83 weak_alias (P(__,socket), socket)