summaryrefslogtreecommitdiff
path: root/packages/glibc/files/ppc-sfp-machine.patch
blob: 6171a03411f137a173c677a62864ef2af1ab35e7 (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
This patch combined with the other patches from Bugzilla #2749 allows
powerpc32 to build. The Subdirs pulls in the soft-fp directory from
libc, The Implies pulls in the ports powerpc/soft-fp directory which
includes sfp-machine.h

The get/set/swapcontext changes overide the common implimentation in
libc to avoid using hardware FP instructions.



2006-06-01  Steven Munroe  <sjmunroe@us.ibm.com>

	[BZ #2749]
	* sysdeps/powerpc/soft-fp/Subdirs: New file.
	* sysdeps/powerpc/soft-fp/sfp-machine.h: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies: New file.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S:
	New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S:
	New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S:
	New file.

diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/powerpc/soft-fp/Subdirs 
libc24/ports/sysdeps/powerpc/soft-fp/Subdirs
--- dummy-libc/ports-cvstip-20060512/sysdeps/powerpc/soft-fp/Subdirs	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/powerpc/soft-fp/Subdirs	Wed May 31 16:58:44 2006
@@ -0,0 +1,1 @@
+soft-fp
diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/powerpc/soft-fp/sfp-machine.h 
libc24/ports/sysdeps/powerpc/soft-fp/sfp-machine.h
--- dummy-libc/ports-cvstip-20060512/sysdeps/powerpc/soft-fp/sfp-machine.h	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/powerpc/soft-fp/sfp-machine.h	Wed May 31 13:57:07 2006
@@ -0,0 +1,63 @@
+#define _FP_W_TYPE_SIZE		32
+#define _FP_W_TYPE		unsigned long
+#define _FP_WS_TYPE		signed long
+#define _FP_I_TYPE		long
+
+#define _FP_MUL_MEAT_S(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_D(R,X,Y)				\
+  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y)				\
+  _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
+#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
+#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
+#define _FP_NANSIGN_S		0
+#define _FP_NANSIGN_D		0
+#define _FP_NANSIGN_Q		0
+
+#define _FP_KEEPNANFRACP 1
+
+/* Someone please check this.  */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
+	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
+      {								\
+	R##_s = Y##_s;						\
+	_FP_FRAC_COPY_##wc(R,Y);				\
+      }								\
+    else							\
+      {								\
+	R##_s = X##_s;						\
+	_FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
+  } while (0)
+
+/* Exception flags.  We use the bit positions of the appropriate bits
+   in the FPSCR, which also correspond to the FE_* bits.  This makes
+   everything easier ;-).  */
+#define FP_EX_INVALID         (1 << (31 - 2))
+#define FP_EX_OVERFLOW        (1 << (31 - 3))
+#define FP_EX_UNDERFLOW       (1 << (31 - 4))
+#define FP_EX_DENORM          FP_EX_UNDERFLOW
+#define FP_EX_DIVZERO         (1 << (31 - 5))
+#define FP_EX_INEXACT         (1 << (31 - 6))
+
+#define FP_HANDLE_EXCEPTIONS  __simulate_exceptions (_fex)
+#define FP_ROUNDMODE          __sim_round_mode
+
+extern int __sim_exceptions;
+libc_hidden_proto (__sim_exceptions);
+extern int __sim_disabled_exceptions;
+libc_hidden_proto (__sim_disabled_exceptions);
+extern int __sim_round_mode;
+libc_hidden_proto (__sim_round_mode);
+
+extern void __simulate_exceptions (int x) attribute_hidden;
diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies 
libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies
--- dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies	Wed May 31 15:46:44 2006
@@ -0,0 +1,1 @@
+powerpc/soft-fp
diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S 
libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
--- dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S	Thu Jun 01 15:31:03 2006
@@ -0,0 +1,59 @@
+/* Save current context.
+   Copyright (C) 2002, 2004, 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.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
+
+#define __ASSEMBLY__
+#include <asm/ptrace.h>
+#include "ucontext_i.h"
+
+#define __CONTEXT_FUNC_NAME __getcontext
+#undef __CONTEXT_ENABLE_FPRS
+#undef __CONTEXT_ENABLE_VRS
+
+#include "getcontext-common.S"
+
+versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+/* For the nofpu case the old/new versions are the same function.  */  
+strong_alias (__getcontext, __novec_getcontext)
+
+compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
+
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
+
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+	compat_text_section
+ENTRY (__getcontext_stub)
+	li	r3,ENOSYS
+	b	__syscall_error@local
+END (__getcontext_stub)
+	.previous
+
+compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
+
+#endif
diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S 
libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
--- dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S	Thu Jun 01 15:31:03 2006
@@ -0,0 +1,59 @@
+/* Jump to a new context.
+   Copyright (C) 2002, 2004, 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.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
+
+#define __ASSEMBLY__
+#include <asm/ptrace.h>
+#include "ucontext_i.h"
+
+#define __CONTEXT_FUNC_NAME __setcontext
+#undef __CONTEXT_ENABLE_FPRS
+#undef __CONTEXT_ENABLE_VRS
+
+#include "setcontext-common.S"
+
+versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+/* For the nofpu case the old/new versions are the same function.  */  
+strong_alias (__setcontext, __novec_setcontext)
+
+compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
+
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
+
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+	compat_text_section
+ENTRY (__setcontext_stub)
+	li	r3,ENOSYS
+	b	__syscall_error@local
+END (__setcontext_stub)
+	.previous
+
+compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_0)
+
+#endif
diff -urN dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S 
libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
--- dummy-libc/ports-cvstip-20060512/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S	Wed Dec 31 18:00:00 1969
+++ libc24/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S	Thu Jun 01 15:31:03 2006
@@ -0,0 +1,59 @@
+/* Save current context and jump to a new context.
+   Copyright (C) 2002, 2004, 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.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
+
+#define __ASSEMBLY__
+#include <asm/ptrace.h>
+#include "ucontext_i.h"
+
+#define __CONTEXT_FUNC_NAME __swapcontext
+#undef __CONTEXT_ENABLE_FPRS
+#undef __CONTEXT_ENABLE_VRS
+
+# include "swapcontext-common.S"
+
+versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+/* For the nofpu case the old/new versions are the same function.  */  
+strong_alias (__swapcontext, __novec_swapcontext)
+
+compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
+
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
+
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+	compat_text_section
+ENTRY (__swapcontext_stub)
+	li	r3,ENOSYS
+	b	__syscall_error@local
+END (__swapcontext_stub)
+	.previous
+
+compat_symbol (libc, __swapcontext_stub, swapcontext, GLIBC_2_1)
+
+#endif