python-pyrex: Rework DEPENDS updates
[openembedded.git] / recipes / glibc / glibc-2.3.2 / glibc23-powerpc-sigcontext.patch
blobb5deae40b6344b0c3833155cd319c5a77d85ac2f
1 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions 2003-08-25 13:15:36.000000000 +1000
2 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions 2003-09-23 18:19:41.000000000 +1000
3 @@ -22,5 +22,6 @@
5 GLIBC_2.3.3 {
6 posix_fadvise64; posix_fallocate64;
7 + setcontext; getcontext; swapcontext; makecontext;
10 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2003-06-18 13:36:23.000000000 +1000
11 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2003-09-23 19:15:38.000000000 +1000
12 @@ -18,12 +18,20 @@
13 02111-1307 USA. */
15 #include <sysdep.h>
16 +#include <shlib-compat.h>
18 #define __ASSEMBLY__
19 #include <asm/ptrace.h>
20 #include "ucontext_i.h"
22 ENTRY(__getcontext)
23 + /*
24 + * Since we are not attempting to save the altivec registers,
25 + * there is no need to get the register storage space
26 + * aligned on a 16-byte boundary.
27 + */
28 + addi r3,r3,_UC_REG_SPACE
29 + stw r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
30 stw r0,_UC_GREGS+(PT_R0*4)(r3)
31 stw r1,_UC_GREGS+(PT_R1*4)(r3)
32 mflr r0
33 @@ -112,7 +120,7 @@
34 stfd fp31,_UC_FREGS+(31*8)(r3)
35 stfd fp0,_UC_FREGS+(32*8)(r3)
37 - addi r5,r3,_UC_SIGMASK
38 + addi r5,r3,_UC_SIGMASK - _UC_REG_SPACE
39 li r4,0
40 li r3,SIG_BLOCK
41 bl JUMPTARGET(sigprocmask)
42 @@ -123,4 +131,18 @@
43 blr
44 PSEUDO_END(__getcontext)
46 -weak_alias(__getcontext, getcontext)
47 +versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_3)
49 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
51 +#define _ERRNO_H 1
52 +#include <bits/errno.h>
54 +ENTRY (__getcontext_stub)
55 + li r3,ENOSYS
56 + b JUMPTARGET(__syscall_error)
57 + END (__getcontext_stub)
59 +compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
61 +#endif
62 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2003-06-18 13:36:38.000000000 +1000
63 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2003-09-23 19:15:48.000000000 +1000
64 @@ -18,6 +18,7 @@
65 02111-1307 USA. */
67 #include <sysdep.h>
68 +#include <shlib-compat.h>
70 #define __ASSEMBLY__
71 #include <asm/ptrace.h>
72 @@ -25,22 +26,24 @@
74 ENTRY(__makecontext)
75 /* Set up the first 7 args to the function in its registers */
76 - stw r6,_UC_GREGS+(PT_R3*4)(r3)
77 - stw r7,_UC_GREGS+(PT_R4*4)(r3)
78 - stw r8,_UC_GREGS+(PT_R5*4)(r3)
79 - stw r9,_UC_GREGS+(PT_R6*4)(r3)
80 - stw r10,_UC_GREGS+(PT_R7*4)(r3)
81 + addi r11,r3,_UC_REG_SPACE
82 + stw r11,_UC_REGS_PTR(r3)
83 + stw r6,_UC_GREGS+(PT_R3*4)(r11)
84 + stw r7,_UC_GREGS+(PT_R4*4)(r11)
85 + stw r8,_UC_GREGS+(PT_R5*4)(r11)
86 + stw r9,_UC_GREGS+(PT_R6*4)(r11)
87 + stw r10,_UC_GREGS+(PT_R7*4)(r11)
88 lwz r8,8(r1)
89 lwz r9,12(r1)
90 - stw r8,_UC_GREGS+(PT_R8*4)(r3)
91 - stw r9,_UC_GREGS+(PT_R9*4)(r3)
92 + stw r8,_UC_GREGS+(PT_R8*4)(r11)
93 + stw r9,_UC_GREGS+(PT_R9*4)(r11)
95 /* Set the NIP to the start of the function */
96 - stw r4,_UC_GREGS+(PT_NIP*4)(r3)
97 + stw r4,_UC_GREGS+(PT_NIP*4)(r11)
99 /* Set the function's r31 to ucp->uc_link for the exitcode below. */
100 lwz r7,_UC_LINK(r3)
101 - stw r7,_UC_GREGS+(PT_R31*4)(r3)
102 + stw r7,_UC_GREGS+(PT_R31*4)(r11)
104 /* Set the function's LR to point to the exitcode below. */
105 #ifdef PIC
106 @@ -53,7 +56,7 @@
107 lis r6,L(exitcode)@ha
108 addi r6,r6,L(exitcode)@l
109 #endif
110 - stw r6,_UC_GREGS+(PT_LNK*4)(r3)
111 + stw r6,_UC_GREGS+(PT_LNK*4)(r11)
114 * Set up the stack frame for the function.
115 @@ -71,7 +74,7 @@
116 cmpwi r5,8
117 blt 2f /* less than 8 args is easy */
118 lwz r10,16(r1)
119 - stw r10,_UC_GREGS+(PT_R10*4)(r3)
120 + stw r10,_UC_GREGS+(PT_R10*4)(r11)
121 beq 2f /* if exactly 8 args */
122 subi r9,r5,3
123 subi r5,r5,8
124 @@ -83,7 +86,7 @@
125 3: lwzu r10,4(r6)
126 stwu r10,4(r8)
127 bdnz 3b
128 -2: stw r7,_UC_GREGS+(PT_R1*4)(r3)
129 +2: stw r7,_UC_GREGS+(PT_R1*4)(r11)
130 li r6,0
131 stw r6,0(r7)
133 @@ -102,4 +105,19 @@
134 b 4b
136 END(__makecontext)
137 -weak_alias(__makecontext, makecontext)
139 +versioned_symbol (libc, __makecontext, makecontext, GLIBC_2_3_3)
141 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
143 +#define _ERRNO_H 1
144 +#include <bits/errno.h>
146 +ENTRY (__makecontext_stub)
147 + li r3,ENOSYS
148 + b JUMPTARGET(__syscall_error)
149 + END (__makecontext_stub)
151 +compat_symbol (libc, __makecontext_stub, makecontext, GLIBC_2_1)
153 +#endif
154 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2003-06-18 13:36:57.000000000 +1000
155 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2003-09-23 17:01:40.000000000 +1000
156 @@ -18,6 +18,7 @@
157 02111-1307 USA. */
159 #include <sysdep.h>
160 +#include <shlib-compat.h>
162 #define __ASSEMBLY__
163 #include <asm/ptrace.h>
164 @@ -28,7 +29,7 @@
165 stwu r1,-16(r1)
166 stw r0,20(r1)
167 stw r31,12(r1)
168 - mr r31,r3
169 + lwz r31,_UC_REGS_PTR(r3)
172 * If this ucontext refers to the point where we were interrupted
173 @@ -144,6 +145,20 @@
175 /* NOTREACHED */
177 -PSEUDO_END(__setcontext)
178 +PSEUDO_END (__setcontext)
180 -weak_alias(__setcontext, setcontext)
181 +versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_3)
183 +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
185 +#define _ERRNO_H 1
186 +#include <bits/errno.h>
188 +ENTRY (__setcontext_stub)
189 + li r3,ENOSYS
190 + b JUMPTARGET(__syscall_error)
191 + END (__setcontext_stub)
193 +compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_0)
195 +#endif
196 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2003-06-18 13:37:19.000000000 +1000
197 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2003-09-23 19:15:56.000000000 +1000
198 @@ -18,6 +18,7 @@
199 02111-1307 USA. */
201 #include <sysdep.h>
202 +#include <shlib-compat.h>
204 #define __ASSEMBLY__
205 #include <asm/ptrace.h>
206 @@ -25,6 +26,8 @@
208 ENTRY(__swapcontext)
209 /* Save the current context */
210 + addi r3,r3,_UC_REG_SPACE
211 + stw r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
212 stw r0,_UC_GREGS+(PT_R0*4)(r3)
213 stw r1,_UC_GREGS+(PT_R1*4)(r3)
214 mflr r0
215 @@ -115,7 +118,7 @@
216 stfd fp31,_UC_FREGS+(31*8)(r3)
217 stfd fp0,_UC_FREGS+(32*8)(r3)
219 - addi r5,r3,_UC_SIGMASK
220 + addi r5,r3,_UC_SIGMASK - _UC_REG_SPACE
221 addi r4,r4,_UC_SIGMASK
222 li r3,SIG_SETMASK
223 bl JUMPTARGET(sigprocmask)
224 @@ -133,6 +136,8 @@
225 * r0, xer, ctr. We don't restore r2 since it will be used as
226 * the TLS pointer.
228 + mr r4,r31
229 + lwz r31,_UC_REGS_PTR(r31)
230 lwz r0,_UC_GREGS+(PT_MSR*4)(r31)
231 cmpwi r0,0
232 bne L(do_sigret)
233 @@ -223,11 +228,25 @@
236 L(do_sigret):
237 - addi r1,r31,-0xd0
238 + addi r1,r4,-0xd0
239 li r0,SYS_ify(rt_sigreturn)
241 /* NOTREACHED */
243 PSEUDO_END(__swapcontext)
245 -weak_alias(__swapcontext, swapcontext)
246 +versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_3)
248 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
250 +#define _ERRNO_H 1
251 +#include <bits/errno.h>
253 +ENTRY (__swapcontext_stub)
254 + li r3,ENOSYS
255 + b JUMPTARGET(__syscall_error)
256 + END (__swapcontext_stub)
258 +compat_symbol (libc, __swapcontext_stub, swapcontext, GLIBC_2_1)
260 +#endif
261 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h 2003-06-18 13:37:33.000000000 +1000
262 +++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h 2003-09-11 16:48:08.000000000 +1000
263 @@ -24,7 +24,11 @@
264 #define _UC_LINK 4
265 #define _UC_STACK_SP 8
266 #define _UC_STACK_SIZE 16
267 -#define _UC_SIGMASK 64
268 -#define _UC_GREGS 192
269 -#define _UC_FREGS 384
270 -#define _UC_VREGS 656
271 +#define _UC_REGS_PTR 48
272 +#define _UC_SIGMASK 52
273 +#define _UC_REG_SPACE 180
275 +/* offsets within mcontext_t */
276 +#define _UC_GREGS 0
277 +#define _UC_FREGS 192
278 +#define _UC_VREGS 464
279 --- cvs/libc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h 2003-07-04 10:12:48.000000000 +1000
280 +++ libc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h 2003-09-11 16:31:52.000000000 +1000
281 @@ -74,14 +74,40 @@
282 struct ucontext *uc_link;
283 stack_t uc_stack;
284 #if __WORDSIZE == 32
285 - /* These fields are for backwards compatibility. */
286 + /*
287 + * These fields are set up this way to maximize source and
288 + * binary compatibility with code written for the old
289 + * ucontext_t definition, which didn't include space for the
290 + * registers.
292 + * Different versions of the kernel have stored the registers on
293 + * signal delivery at different offsets from the ucontext struct.
294 + * Programs should thus use the uc_mcontext.uc_regs pointer to
295 + * find where the registers are actually stored. The registers
296 + * will be stored within the ucontext_t struct but not necessarily
297 + * at a fixed address. As a side-effect, this lets us achieve
298 + * 16-byte alignment for the register storage space if the
299 + * Altivec registers are to be saved, without requiring 16-byte
300 + * alignment on the whole ucontext_t.
302 + * The uc_mcontext.regs field is included for source compatibility
303 + * with programs written against the older ucontext_t definition,
304 + * and its name should therefore not change. The uc_pad field
305 + * is for binary compatibility with programs compiled against the
306 + * old ucontext_t; it ensures that uc_mcontext.regs and uc_sigmask
307 + * are at the same offset as previously.
308 + */
309 int uc_pad[7];
310 - mcontext_t *uc_regs;
311 - unsigned int uc_oldsigmask[2];
312 - int uc_pad2;
313 -#endif
314 + union uc_regs_ptr {
315 + struct pt_regs *regs;
316 + mcontext_t *uc_regs;
317 + } uc_mcontext;
318 + sigset_t uc_sigmask;
319 + char uc_reg_space[sizeof(mcontext_t) + 12]; /* last for extensibility */
320 +#else /* 64-bit */
321 sigset_t uc_sigmask;
322 mcontext_t uc_mcontext; /* last for extensibility */
323 +#endif
324 } ucontext_t;
326 #endif /* sys/ucontext.h */