1 /* Copyright (C) 2000, 2001, 2003 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <sysdep-cancel.h>
21 #include <socketcall.h>
23 /* &%/$&!! preprocessor */
24 #define P(a, b) P2(a, b)
28 /* The socket-oriented system calls are handled unusally in Linux.
29 They are all gated through the single `socketcall' system call number.
30 `socketcall' takes two arguments: the first is the subcode, specifying
31 which socket function is being called; and the second is a pointer to
32 the arguments to the specific function.
34 The .S files for the other calls just #define socket and #include this. */
38 #define __socket P(__,socket)
40 #define __socket socket
44 #ifndef NARGS /* the socket.o object is compiled directly ... */
50 /* Save registers and setup stack. */
51 stm %r6,%r15,24(%r15) /* save registers */
52 cfi_offset (%r15, -36)
53 cfi_offset (%r14, -40)
54 cfi_offset (%r13, -44)
55 cfi_offset (%r12, -48)
56 cfi_offset (%r11, -52)
57 cfi_offset (%r10, -56)
63 l %r0,4(0,%r15) /* load eos */
64 ahi %r15,-120 /* buy stack space */
65 cfi_adjust_cfa_offset (120)
66 st %r1,0(0,%r15) /* store back chain */
67 st %r0,4(0,%r15) /* store eos */
69 /* Reorder arguments */
71 mvc 0x74(4,%r15),216(%r15) /* move between parameter lists */
74 st %r6,0x70(0,%r15) /* store into parameter list */
77 st %r5,0x6C(0,%r15) /* store into parameter list */
80 st %r4,0x68(0,%r15) /* store into parameter list */
83 st %r3,0x64(0,%r15) /* store into parameter list */
87 #if defined NEED_CANCELLATION && defined CENABLE
92 /* load subcode for socket syscall */
93 lhi %r2,P(SOCKOP_,socket)
94 la %r3,0x60(0,%r15) /* load address of parameter list */
96 /* Do the system call trap. */
97 svc SYS_ify(socketcall)
100 l %r15,0(0,%r15) /* load back chain */
101 lm %r6,15,24(%r15) /* load registers */
103 /* gpr2 is < 0 if there was an error. */
106 jnl SYSCALL_ERROR_LABEL
108 /* Successful; return the syscall's value. */
111 #if defined NEED_CANCELLATION && defined CENABLE
119 /* load subcode for socket syscall */
120 lhi %r2,P(SOCKOP_,socket)
121 la %r3,0x60(0,%r15) /* load address of parameter list */
123 /* Do the system call trap. */
124 svc SYS_ify(socketcall)
138 SYSCALL_ERROR_HANDLER
141 #ifndef NO_WEAK_ALIAS
142 weak_alias (__socket, socket)