]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/am33/socket.S
Replace FSF snail mail address by URL.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / am33 / socket.S
1 /* Copyright 2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>.
4 Based on ../i386/socket.S.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
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 .text
27 /* The socket-oriented system calls are handled unusally in Linux.
28 They are all gated through the single `socketcall' system call number.
29 `socketcall' takes two arguments: the first is the subcode, specifying
30 which socket function is being called; and the second is a pointer to
31 the arguments to the specific function.
32
33 The .S files for the other calls just #define socket and #include this. */
34
35 #ifndef __socket
36 #ifndef NO_WEAK_ALIAS
37 #define __socket P(__,socket)
38 #else
39 #define __socket socket
40 #endif
41 #endif
42
43 .globl __socket
44 ENTRY (__socket)
45
46 mov d0,(4,sp)
47 mov d1,(8,sp)
48
49 mov SYS_ify(socketcall),d0 /* System call number in d0. */
50
51 /* Use ## so `socket' is a separate token that might be #define'd. */
52 mov P(SOCKOP_,socket),a0 /* Subcode is first arg to syscall. */
53 mov sp,d1
54 add 4,d1 /* Address of args is 2nd arg. */
55
56 /* Do the system call trap. */
57 syscall 0
58
59 /* d0 is < 0 if there was an error. */
60 cmp -126,d0
61 bls L(pseudo_end)
62 jmp SYSCALL_ERROR_LABEL
63
64 /* Successful; return the syscall's value. */
65 L(pseudo_end):
66 ret
67
68 PSEUDO_END (__socket)
69
70 #ifndef NO_WEAK_ALIAS
71 weak_alias (__socket, socket)
72 #endif