]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/glibc/glibc-2.3.2/glibc23-powerpc-sigcontext.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / glibc / glibc-2.3.2 / glibc23-powerpc-sigcontext.patch
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 @@
4    }
5    GLIBC_2.3.3 {
6      posix_fadvise64; posix_fallocate64;
7 +    setcontext; getcontext; swapcontext; makecontext;
8    }
9  }
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.  */
14  
15  #include <sysdep.h>
16 +#include <shlib-compat.h>
17  
18  #define __ASSEMBLY__
19  #include <asm/ptrace.h>
20  #include "ucontext_i.h"
21  
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)
36  
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)
45  
46 -weak_alias(__getcontext, getcontext)
47 +versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_3)
48 +
49 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
50 +
51 +#define _ERRNO_H       1
52 +#include <bits/errno.h>
53 +
54 +ENTRY (__getcontext_stub)
55 +       li      r3,ENOSYS
56 +       b       JUMPTARGET(__syscall_error)
57 +       END (__getcontext_stub)
58 +
59 +compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
60 +
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.  */
66  
67  #include <sysdep.h>
68 +#include <shlib-compat.h>
69  
70  #define __ASSEMBLY__
71  #include <asm/ptrace.h>
72 @@ -25,22 +26,24 @@
73  
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)
94  
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)
98  
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)
103  
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)
112  
113         /*
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)
132  
133 @@ -102,4 +105,19 @@
134         b       4b
135  
136  END(__makecontext)
137 -weak_alias(__makecontext, makecontext)
138 +
139 +versioned_symbol (libc, __makecontext, makecontext, GLIBC_2_3_3)
140 +
141 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
142 +
143 +#define _ERRNO_H       1
144 +#include <bits/errno.h>
145 +
146 +ENTRY (__makecontext_stub)
147 +       li      r3,ENOSYS
148 +       b       JUMPTARGET(__syscall_error)
149 +       END (__makecontext_stub)
150 +
151 +compat_symbol (libc, __makecontext_stub, makecontext, GLIBC_2_1)
152 +
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.  */
158  
159  #include <sysdep.h>
160 +#include <shlib-compat.h>
161  
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)
170  
171         /*
172          * If this ucontext refers to the point where we were interrupted
173 @@ -144,6 +145,20 @@
174         sc
175         /* NOTREACHED */
176  
177 -PSEUDO_END(__setcontext)
178 +PSEUDO_END (__setcontext)
179  
180 -weak_alias(__setcontext, setcontext)
181 +versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_3)
182 +
183 +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
184 +
185 +#define _ERRNO_H       1
186 +#include <bits/errno.h>
187 +
188 +ENTRY (__setcontext_stub)
189 +       li      r3,ENOSYS
190 +       b       JUMPTARGET(__syscall_error)
191 +       END (__setcontext_stub)
192 +
193 +compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_0)
194 +
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.  */
200  
201  #include <sysdep.h>
202 +#include <shlib-compat.h>
203  
204  #define __ASSEMBLY__
205  #include <asm/ptrace.h>
206 @@ -25,6 +26,8 @@
207  
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)
218  
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.
227          */
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 @@
234         blr
235  
236  L(do_sigret):
237 -       addi    r1,r31,-0xd0
238 +       addi    r1,r4,-0xd0
239         li      r0,SYS_ify(rt_sigreturn)
240         sc
241         /* NOTREACHED */
242  
243  PSEUDO_END(__swapcontext)
244  
245 -weak_alias(__swapcontext, swapcontext)
246 +versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_3)
247 +
248 +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
249 +
250 +#define _ERRNO_H       1
251 +#include <bits/errno.h>
252 +
253 +ENTRY (__swapcontext_stub)
254 +       li      r3,ENOSYS
255 +       b       JUMPTARGET(__syscall_error)
256 +       END (__swapcontext_stub)
257 +
258 +compat_symbol (libc, __swapcontext_stub, swapcontext, GLIBC_2_1)
259 +
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
274 +
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.
291 +     *
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.
301 +     *
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;
325  
326  #endif /* sys/ucontext.h */