]>
Commit | Line | Data |
---|---|---|
62f29da7 | 1 | /* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. |
fd26970f UD |
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 | |
41bdb6e2 AJ |
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. | |
fd26970f UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
fd26970f | 14 | |
41bdb6e2 AJ |
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. */ | |
fd26970f | 19 | |
62f29da7 | 20 | #include <sysdep-cancel.h> |
5107cf1d | 21 | #include <socketcall.h> |
fd26970f UD |
22 | |
23 | #define P(a, b) P2(a, b) | |
24 | #define P2(a, b) a##b | |
25 | ||
af6f3906 UD |
26 | #ifndef NARGS |
27 | #ifdef socket | |
28 | #error NARGS not defined | |
29 | #endif | |
30 | #define NARGS 3 | |
31 | #endif | |
32 | ||
fd26970f | 33 | .text |
5b826692 | 34 | /* The socket-oriented system calls are handled unusually in Linux. |
fd26970f UD |
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 | ||
74015205 | 42 | #ifndef __socket |
a334319f | 43 | #define __socket P(__,socket) |
74015205 UD |
44 | #endif |
45 | ||
a334319f | 46 | .globl __socket |
74015205 | 47 | ENTRY (__socket) |
fd26970f | 48 | |
af6f3906 UD |
49 | /* Drop up to 6 arguments (recvfrom) into the memory allocated by |
50 | the caller for varargs, since that's really what we have. */ | |
deb2f929 RH |
51 | st %o0, [%sp + 68 + 0] |
52 | st %o1, [%sp + 68 + 4] | |
af6f3906 | 53 | #if NARGS > 2 |
deb2f929 RH |
54 | st %o2, [%sp + 68 + 8] |
55 | #if NARGS > 3 | |
56 | st %o3, [%sp + 68 + 12] | |
af6f3906 | 57 | #if NARGS > 4 |
deb2f929 RH |
58 | st %o4, [%sp + 68 + 16] |
59 | #if NARGS > 5 | |
60 | st %o5, [%sp + 68 + 20] | |
61 | #endif | |
62 | #endif | |
af6f3906 UD |
63 | #endif |
64 | #endif | |
fd26970f | 65 | |
62f29da7 UD |
66 | #if defined NEED_CANCELLATION && defined CENABLE |
67 | SINGLE_THREAD_P | |
68 | cmp %g1, 0 | |
69 | bne .Lsocket_cancel | |
70 | #endif | |
71 | mov P(SOCKOP_,socket), %o0 /* arg 1: socket subfunction */ | |
af6f3906 UD |
72 | add %sp, 68, %o1 /* arg 2: parameter block */ |
73 | LOADSYSCALL(socketcall) | |
fd26970f | 74 | t 0x10 |
a334319f UD |
75 | bcs __syscall_error_handler |
76 | nop | |
77 | retl | |
af6f3906 UD |
78 | nop |
79 | ||
62f29da7 UD |
80 | #if defined NEED_CANCELLATION && defined CENABLE |
81 | .Lsocket_cancel: | |
a334319f | 82 | cfi_startproc |
62f29da7 | 83 | save %sp, -96, %sp |
a334319f | 84 | cfi_def_cfa_register (%fp) |
b5bc52ef | 85 | cfi_window_save |
a334319f | 86 | cfi_register (%o7, %i7) |
62f29da7 UD |
87 | CENABLE |
88 | nop | |
89 | mov %o0, %l0 | |
90 | add %sp, 68 + 96, %o1 | |
91 | mov P(SOCKOP_,socket), %o0 | |
92 | LOADSYSCALL(socketcall) | |
93 | t 0x10 | |
a334319f | 94 | bcs __syscall_error_handler2 |
62f29da7 | 95 | mov %o0, %l1 |
a334319f | 96 | CDISABLE |
62f29da7 | 97 | mov %l0, %o0 |
a334319f | 98 | jmpl %i7 + 8, %g0 |
62f29da7 | 99 | restore %g0, %l1, %o0 |
a334319f UD |
100 | cfi_endproc |
101 | SYSCALL_ERROR_HANDLER2 | |
62f29da7 UD |
102 | #endif |
103 | ||
a334319f UD |
104 | SYSCALL_ERROR_HANDLER |
105 | ||
74015205 | 106 | END (__socket) |
fd26970f | 107 | |
74015205 | 108 | weak_alias (__socket, socket) |