1 /* Copyright (C) 2001-2014 Free Software Foundation, Inc.
2 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <sysdep-cancel.h>
20 #include <socketcall.h>
22 /* &%/$&!! preprocessor */
23 #define P(a, b) P2(a, b)
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.
33 The .S files for the other calls just #define socket and #include this. */
37 #define __socket P(__,socket)
39 #define __socket socket
43 #ifndef NARGS /* The socket.o object is compiled directly ... */
49 /* Save registers and setup stack. */
50 stmg %r6,%r15,48(%r15) /* Save registers. */
62 lg %r0,8(%r15) /* Load eos. */
63 aghi %r15,-208 /* Buy stack space. */
64 cfi_adjust_cfa_offset (208)
65 stg %r1,0(%r15) /* Store back chain. */
66 stg %r0,8(%r15) /* Store eos. */
68 /* Reorder arguments. */
70 mvc 200(8,%r15),368(%r15) /* Move between parameter lists. */
73 stg %r6,192(%r15) /* Store into parameter list. */
76 stg %r5,184(%r15) /* Store into parameter list. */
79 stg %r4,176(%r15) /* Store into parameter list. */
82 stg %r3,168(%r15) /* Store into parameter list. */
86 #if defined NEED_CANCELLATION && defined CENABLE
91 /* Load subcode for socket syscall. */
92 lghi %r2,P(SOCKOP_,socket)
93 la %r3,160(%r15) /* Load address of parameter list. */
95 /* Do the system call trap. */
96 svc SYS_ify(socketcall)
99 lg %r15,0(%r15) /* Load back chain. */
100 lmg %r6,15,48(%r15) /* Load registers. */
102 /* gpr2 is < 0 if there was an error. */
105 jgnl SYSCALL_ERROR_LABEL
107 /* Successful; return the syscall's value. */
110 #if defined NEED_CANCELLATION && defined CENABLE
115 /* Load subcode for socket syscall. */
116 lghi %r2,P(SOCKOP_,socket)
117 la %r3,160(%r15) /* Load address of parameter list. */
119 /* Do the system call trap. */
120 svc SYS_ify(socketcall)
130 SYSCALL_ERROR_HANDLER
133 #ifndef NO_WEAK_ALIAS
134 weak_alias (__socket, socket)