]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
Update to LGPL v2.1.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sparc / sparc64 / socket.S
1 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
19
20 #include <sysdep.h>
21 #include <socketcall.h>
22
23 #define P(a, b) P2(a, b)
24 #define P2(a, b) a##b
25
26 #ifndef NARGS
27 #ifdef socket
28 #error NARGS not defined
29 #endif
30 #define NARGS 3
31 #endif
32
33 .text
34 /* The socket-oriented system calls are handled unusually in Linux.
35 They are all gated through the single `socketcall' system call number.
36 `socketcall' takes two arguments: the first is the subcode, specifying
37 which socket function is being called; and the second is a pointer to
38 the arguments to the specific function.
39
40 The .S files for the other calls just #define socket and #include this. */
41
42 #ifndef __socket
43 #define __socket P(__,socket)
44 #endif
45
46 .globl __socket
47 ENTRY (__socket)
48
49 /* Drop up to 6 arguments (recvfrom) into the memory allocated by
50 the caller for varargs, since that's really what we have. */
51 stx %o0, [%sp + STACK_BIAS + 128 + 0]
52 stx %o1, [%sp + STACK_BIAS + 128 + 8]
53 #if NARGS > 2
54 stx %o2, [%sp + STACK_BIAS + 128 + 16]
55 #if NARGS > 3
56 stx %o3, [%sp + STACK_BIAS + 128 + 24]
57 #if NARGS > 4
58 stx %o4, [%sp + STACK_BIAS + 128 + 32]
59 #if NARGS > 5
60 stx %o5, [%sp + STACK_BIAS + 128 + 40]
61 #endif
62 #endif
63 #endif
64 #endif
65
66 mov P(SOCKOP_,socket), %o0 /* arg 1: socket subfunction */
67 add %sp, STACK_BIAS + 128, %o1 /* arg 2: parameter block */
68 LOADSYSCALL(socketcall)
69 ta 0x6d
70
71 bcs,pn %xcc, 1f
72 nop
73 retl
74 nop
75
76 1: SYSCALL_ERROR_HANDLER
77
78 END (__socket)
79
80 weak_alias (__socket, socket)