summaryrefslogtreecommitdiff
path: root/recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch
blob: fb733b919432682176bc43215de22e340b886482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
Fix up ARM EABI for removed syscalls
http://sourceware.org/ml/libc-ports/2006-03/msg00029.html

Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/socket.S
===================================================================
--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/socket.S	2006-03-21 15:58:10.000000000 -0500
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,131 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2005
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep-cancel.h>
-#include <socketcall.h>
-
-#define P(a, b) P2(a, b)
-#define P2(a, b) a##b
-
-	.text
-/* The socket-oriented system calls are handled unusally in Linux.
-   They are all gated through the single `socketcall' system call number.
-   `socketcall' takes two arguments: the first is the subcode, specifying
-   which socket function is being called; and the second is a pointer to
-   the arguments to the specific function.
-
-   The .S files for the other calls just #define socket and #include this.  */
-
-#ifndef __socket
-# ifndef NO_WEAK_ALIAS
-#  define __socket P(__,socket)
-# else
-#  define __socket socket
-# endif
-#endif
-
-#define PUSHARGS_1	str a1, [sp, $-8]!; .pad #8
-#define PUSHARGS_2	stmfd sp!, {a1, a2}; .pad #8
-#define PUSHARGS_3	stmfd sp!, {a1, a2, a3, a4}; .pad #16	/* a4 pushed for padding */
-#define PUSHARGS_4	stmfd sp!, {a1, a2, a3, a4}; .pad #16
-#define PUSHARGS_5	stmfd sp!, {a1, a2, a3, a4}; .pad #16	/* Caller has already pushed arg 5 */
-#define PUSHARGS_6	stmfd sp!, {a1, a2, a3, a4}; .pad #16
-
-#define POPARGS_1	add sp, sp, #8
-#define POPARGS_2	add sp, sp, #8
-#define POPARGS_3	add sp, sp, #16
-#define POPARGS_4	add sp, sp, #16
-#define POPARGS_5	add sp, sp, #16
-#define POPARGS_6	add sp, sp, #16
-
-#ifndef NARGS
-#define NARGS 3			/* If we were called with no wrapper, this is really socket() */
-#endif
-
-#if defined NEED_CANCELLATION && defined CENABLE
-	PSEUDO_PROLOGUE
-#endif
-
-.globl __socket
-ENTRY (__socket)
-	.fnstart
-
-	/* This code previously moved sp into ip and stored the args using
-	   stmdb ip!, {a1-a4}.  It did not modify sp, so the stack never had
-	   to be restored after the syscall completed.  It saved an
-	   instruction and meant no stack cleanup work was required.
-
-	   This will not work in the case of a socket call being interrupted
-	   by a signal.  If the signal handler uses any stack the arguments
-	   to socket will be trashed.  The results of a restart of any
-	   socket call are then unpredictable. */
-
-	/* Push args onto the stack.  */
-	P(PUSHARGS_,NARGS)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-	SINGLE_THREAD_P
-	bne 1f
-#endif
-
-        /* Do the system call trap.  */
-	mov a1, $P(SOCKOP_,socket)
-	mov a2, sp
-	DO_CALL (socketcall, 0)
-
-	/* Pop args off the stack */
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-1:
-	stmfd sp!, {r7, lr}
-	.save {r7, lr}
-	CENABLE
-	mov ip, r0
-
-	mov r0, #P(SOCKOP_,socket)
-	add r1, sp, #8
-	mov r7, #SYS_ify(socketcall)
-	swi 0x0
-
-	mov r7, r0
-	mov r0, ip
-	CDISABLE
-	mov r0, r7
-	ldmfd sp!, {r7, lr}
-
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-#endif
-
-	.fnend
-PSEUDO_END (__socket)
-
-#ifndef NO_WEAK_ALIAS
-weak_alias (__socket, socket)
-#endif
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list	2006-03-21 15:58:46.000000000 -0500
@@ -0,0 +1,34 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+# semaphore and shm system calls
+msgctl		-	msgctl		i:iip	__msgctl	msgctl
+msgget		-	msgget		i:ii	__msgget	msgget
+msgrcv		-	msgrcv		Ci:ibnii __msgrcv	msgrcv
+msgsnd		-	msgsnd		Ci:ibni	__msgsnd	msgsnd
+shmat		-	shmat		i:ipi	__shmat		shmat
+shmctl		-	shmctl		i:iip	__shmctl	shmctl
+shmdt		-	shmdt		i:s	__shmdt		shmdt
+shmget		-	shmget		i:iii	__shmget	shmget
+semop		-	semop		i:ipi	__semop		semop
+semtimedop	-	semtimedop	i:ipip	semtimedop
+semget		-	semget		i:iii	__semget	semget
+semctl		-	semctl		i:iiii	__semctl	semctl
+
+# proper socket implementations:
+accept		-	accept		Ci:iBN	__libc_accept	__accept accept
+bind		-	bind		i:ipi	__bind		bind
+connect		-	connect		Ci:ipi	__libc_connect	__connect_internal __connect connect
+getpeername	-	getpeername	i:ipp	__getpeername	getpeername
+getsockname	-	getsockname	i:ipp	__getsockname	getsockname
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+listen		-	listen		i:ii	__listen	listen
+recv		-	recv		Ci:ibni	__libc_recv	__recv recv
+recvfrom	-	recvfrom	Ci:ibniBN	__libc_recvfrom	__recvfrom recvfrom
+recvmsg		-	recvmsg		Ci:ipi	__libc_recvmsg	__recvmsg recvmsg
+send		-	send		Ci:ibni	__libc_send	__send send
+sendmsg		-	sendmsg		Ci:ipi	__libc_sendmsg	__sendmsg sendmsg
+sendto		-	sendto		Ci:ibnibn	__libc_sendto	__sendto sendto
+setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
+shutdown	-	shutdown	i:ii	__shutdown	shutdown
+socket		-	socket		i:iii	__socket	socket
+socketpair	-	socketpair	i:iiif	__socketpair	socketpair
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h
===================================================================
--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h	2006-03-21 15:58:10.000000000 -0500
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h	2006-03-21 15:58:46.000000000 -0500
@@ -53,9 +53,9 @@
     UNDOARGS_##args;							\
     cmn r0, $4096;
 
-/* DOARGS pushes four bytes on the stack for five arguments, and nothing
-   otherwise.  In order to preserve doubleword alignment, sometimes we must
-   save an extra register.  */
+/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for
+   six arguments, and nothing for fewer.  In order to preserve doubleword
+   alignment, sometimes we must save an extra register.  */
 
 # define DOCARGS_0	stmfd sp!, {r7, lr}
 # define UNDOCARGS_0
@@ -81,6 +81,10 @@
 # define UNDOCARGS_5	ldmfd sp!, {r0, r1, r2, r3}
 # define RESTORE_LR_5	ldmfd sp!, {r4, r7, lr}
 
+# define DOCARGS_6	stmfd sp!, {r0, r1, r2, r3, r7, lr}
+# define UNDOCARGS_6	ldmfd sp!, {r0, r1, r2, r3}
+# define RESTORE_LR_6	RESTORE_LR_0
+
 # ifdef IS_IN_libpthread
 #  define CENABLE	bl PLTJMP(__pthread_enable_asynccancel)
 #  define CDISABLE	bl PLTJMP(__pthread_disable_asynccancel)
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h
===================================================================
--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h	2006-03-21 15:58:10.000000000 -0500
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h	2006-03-21 15:58:46.000000000 -0500
@@ -64,9 +64,9 @@
     UNDOARGS_##args;							\
     cmn r0, $4096;
 
-/* DOARGS pushes four bytes on the stack for five arguments, and nothing
-   otherwise.  In order to preserve doubleword alignment, sometimes we must
-   save an extra register.  */
+/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for
+   six arguments, and nothing for fewer.  In order to preserve doubleword
+   alignment, sometimes we must save an extra register.  */
 
 # define RESTART_UNWIND .fnend; .fnstart; .save {r7, lr}
 
@@ -94,6 +94,10 @@
 # define UNDOCARGS_5	ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4}; .save {r7, lr}; .pad #4
 # define RESTORE_LR_5	ldmfd sp!, {r4, r7, lr}
 
+# define DOCARGS_6	.save {r4, r5}; stmfd sp!, {r0, r1, r2, r3, r7, lr}; .save {r7, lr}; .pad #20
+# define UNDOCARGS_6	ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4, r5}; .save {r7, lr}
+# define RESTORE_LR_6	RESTORE_LR_0
+
 # ifdef IS_IN_libpthread
 #  define CENABLE	bl PLTJMP(__pthread_enable_asynccancel)
 #  define CDISABLE	bl PLTJMP(__pthread_disable_asynccancel)
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h
===================================================================
--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h	2006-03-21 15:58:10.000000000 -0500
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h	2006-03-21 15:58:46.000000000 -0500
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005
+/* Copyright (C) 2005, 2006
    Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -29,6 +29,12 @@
 # error Kernel headers are too old
 #endif
 
+/* Don't use stime, even if the kernel headers define it.  We have
+   settimeofday, and some EABI kernels have removed stime.  Similarly
+   use setitimer to implement alarm.  */
+#undef __NR_stime
+#undef __NR_alarm
+
 /* The ARM EABI user interface passes the syscall number in r7, instead
    of in the swi.  This is more efficient, because the kernel does not need
    to fetch the swi from memory to find out the number; which can be painful
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/umount.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/umount.c	2006-03-21 15:58:46.000000000 -0500
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Since we don't have an oldumount system call, do what the kernel
+   does down here.  */
+
+extern long int __umount2 (const char *name, int flags);
+
+long int
+__umount (const char *name)
+{
+  return __umount2 (name, 0);
+}
+
+weak_alias (__umount, umount);
Index: glibc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ glibc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h	2006-03-20 17:26:58.000000000 -0500
@@ -0,0 +1,31 @@
+/* Set flags signalling availability of kernel features based on given
+   kernel version number.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* The utimes syscall was added before 2.6.1.  */
+#if __LINUX_KERNEL_VERSION >= 132609
+# define __ASSUME_UTIMES	1
+#endif
+
+/* The new getrlimit syscall was added sometime before 2.4.6.  */
+#if __LINUX_KERNEL_VERSION >= 132102
+#define __ASSUME_NEW_GETRLIMIT_SYSCALL	1
+#endif
+
+#include_next <kernel-features.h>