]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / powerpc / powerpc32 / socket.S
1 /* Copyright (C) 1995-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <sysdep-cancel.h>
19 #include <socketcall.h>
20
21 #define P(a, b) P2(a, b)
22 #define P2(a, b) a##b
23
24 /* The socket-oriented system calls are handled unusally in Linux.
25 They are all gated through the single `socketcall' system call number.
26 `socketcall' takes two arguments: the first is the subcode, specifying
27 which socket function is being called; and the second is a pointer to
28 the arguments to the specific function.
29
30 The .S files for the other calls just #define socket and #include this.
31 They also #define a 'number-of-arguments' word in NARGS, which
32 defaults to 3. */
33
34 #ifndef NARGS
35 #ifdef socket
36 #error NARGS not defined
37 #endif
38 #define NARGS 3
39 #endif
40
41 /* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used
42 for temp saves. 44(r1) is used to save r30. */
43 #define stackblock 20
44
45 #ifndef __socket
46 # ifndef NO_WEAK_ALIAS
47 # define __socket P(__,socket)
48 # else
49 # define __socket socket
50 # endif
51 #endif
52
53 .text
54 ENTRY(__socket)
55 stwu r1,-48(r1)
56 cfi_adjust_cfa_offset(48)
57 #if NARGS >= 1
58 stw r3,stackblock(r1)
59 #endif
60 #if NARGS >= 2
61 stw r4,4+stackblock(r1)
62 #endif
63 #if NARGS >= 3
64 stw r5,8+stackblock(r1)
65 #endif
66 #if NARGS >= 4
67 stw r6,12+stackblock(r1)
68 #endif
69 #if NARGS >= 5
70 stw r7,16+stackblock(r1)
71 #endif
72 #if NARGS >= 6
73 stw r8,20+stackblock(r1)
74 #endif
75 #if NARGS >= 7
76 #error too many arguments!
77 #endif
78
79 #if defined NEED_CANCELLATION && defined CENABLE
80 SINGLE_THREAD_P
81 bne- .Lsocket_cancel
82 #endif
83
84 li r3,P(SOCKOP_,socket)
85 addi r4,r1,stackblock
86 DO_CALL(SYS_ify(socketcall))
87 addi r1,r1,48
88 PSEUDO_RET
89
90 #if defined NEED_CANCELLATION && defined CENABLE
91 .Lsocket_cancel:
92 mflr r9
93 stw r9,52(r1)
94 cfi_offset (lr, 4)
95 CENABLE
96 stw r3,16(r1)
97 li r3,P(SOCKOP_,socket)
98 addi r4,r1,stackblock
99 DO_CALL(SYS_ify(socketcall))
100 mfcr r0
101 stw r3,8(r1)
102 stw r0,12(r1)
103 lwz r3,16(r1)
104 CDISABLE
105 lwz r4,52(r1)
106 lwz r0,12(r1)
107 lwz r3,8(r1)
108 mtlr r4
109 mtcr r0
110 addi r1,r1,48
111 PSEUDO_RET
112 #endif
113
114 PSEUDO_END (__socket)
115
116 #ifndef NO_WEAK_ALIAS
117 weak_alias (__socket, socket)
118 #endif