]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/microblaze/socket.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / microblaze / socket.S
CommitLineData
b168057a 1/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
7756ba9d
DH
2
3 This file is part of the GNU C Library.
4
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 License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
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
13 Lesser General Public License for more details.
14
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/>. */
18
19#include <sysdep-cancel.h>
20#include <socketcall.h>
21
22#define P(a, b) P2(a, b)
23#define P2(a, b) a##b
24
25/* The socket-oriented system calls are handled unusally in Linux.
26 They are all gated through the single `socketcall' system call number.
27 `socketcall' takes two arguments: the first is the subcode, specifying
28 which socket function is being called; and the second is a pointer to
29 the arguments to the specific function.
30
31 The .S files for the other calls just #define socket and #include this.
32 They also #define a 'number-of-arguments' word in NARGS, which
33 defaults to 3. */
34
35#ifndef NARGS
36# ifdef socket
37# error NARGS not defined
38# endif
39# define NARGS 3
40#endif
41
42/* Stack usage:
43 0 - r15 (return address)
44 4 - 12 args to syscall
45 16 - scratch for cancellation state
46 20 - scratch for return value
47*/
48#define stackadjust 24
49
50#ifndef __socket
51# ifndef NO_WEAK_ALIAS
52# define __socket P(__,socket)
53# else
54# define __socket socket
55# endif
56#endif
57
58 .text
59ENTRY(__socket)
60 addik r1,r1,-stackadjust
61 swi r15,r1,0
62#if NARGS >= 1
63 swi r5,r1,stackadjust+4
64#endif
65#if NARGS >= 2
66 swi r6,r1,stackadjust+8
67#endif
68#if NARGS >= 3
69 swi r7,r1,stackadjust+12
70#endif
71#if NARGS >= 4
72 swi r8,r1,stackadjust+16
73#endif
74#if NARGS >= 5
75 swi r9,r1,stackadjust+20
76#endif
77#if NARGS >= 6
78 swi r10,r1,stackadjust+24
79#endif
80/* The rest of the args (if any) are on the caller's stack already. */
81
82#if defined NEED_CANCELLATION && defined CENABLE
0cdcad17 83 SINGLE_THREAD_P(r12)
7756ba9d
DH
84 bnei r12,L(socket_cancel)
85#endif
86
87 addik r12,r0,SYS_ify(socketcall)
88 addik r5,r0,P(SOCKOP_,socket)
89 addik r6,r1,stackadjust+4
90 brki r14,8
91 addk r0,r0,r0
92 lwi r15,r1,0
93 addik r1,r1,stackadjust
94 addik r4,r0,-4095
95 cmpu r4,r4,r3
96 bgei r4,SYSCALL_ERROR_LABEL
97 rtsd r15,8
98 addk r0,r0,r0
99
100#if defined NEED_CANCELLATION && defined CENABLE
101L(socket_cancel):
102 CENABLE
103 swi r3,r1,16
104 addik r12,r0,SYS_ify(socketcall)
105 addik r5,r0,P(SOCKOP_,socket)
106 addik r6,r1,stackadjust+4
107 brki r14,8
108 addk r0,r0,r0
109 swi r3,r1,20
110 lwi r5,r1,16
111 CDISABLE
112 lwi r3,r1,20
113 lwi r15,r1,0
114 addik r1,r1,stackadjust
115 addik r4,r0,-4095
116 cmpu r4,r4,r3
117 bgei r4,SYSCALL_ERROR_LABEL
118 rtsd r15,8
119 addk r0,r0,r0
120#endif
121
122PSEUDO_END (__socket)
123
124#ifndef NO_WEAK_ALIAS
125weak_alias (__socket, socket)
126#endif