chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / debian / patches / hppa / cvs-vfork.diff
1 2010-06-24  Carlos O'Donell  <carlos@codesourcery.com>
2
3         * sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S: Only create stack 
4         frame around call to SYSCALL_ERROR_HANDLER. Do not restore %rp 
5         from the stack frame on successfull return.
6
7 diff --git a/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S b/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
8 index 83a70b7..15efa98 100644
9 --- a/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
10 +++ b/ports/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
11 @@ -1,4 +1,4 @@
12 -/* Copyright (C) 2005 Free Software Foundation, Inc.
13 +/* Copyright (C) 2005, 2010 Free Software Foundation, Inc.
14     This file is part of the GNU C Library.
15  
16     The GNU C Library is free software; you can redistribute it and/or
17 @@ -50,10 +50,9 @@
18  
19         /* r26, r25, r24, r23 are free since vfork has no arguments */
20  ENTRY(__vfork)
21 -       /* Prologue */
22 -       stwm    %r3, 64(%sp)
23 -       stw     %sp, -4(%sp)
24 -       stw     %r19, -32(%sp)
25 +       /* We must not create a frame. When the child unwinds to call 
26 +          exec it will clobber the same frame that the parent
27 +          needs to unwind.  */
28  
29         /* Save the PIC register. */
30  #ifdef PIC
31 @@ -75,12 +74,20 @@ ENTRY(__vfork)
32         comclr,>>= %r1,%ret0,%r0        /* Note: unsigned compare. */
33         b,n     .Lerror
34  
35 -       /* Return, no need to restore the PIC register. */
36 -       ldw     -84(%sp), %rp
37 -       bv      %r0(%rp)
38 -       ldwm    -64(%sp), %r3
39 +       /* Return, and DO NOT restore rp. The child may have called
40 +          functions that updated the frame's rp. This works because
41 +          the kernel ensures rp is preserved across the vfork 
42 +          syscall.  */
43 +       bv,n    %r0(%rp)
44  
45  .Lerror:
46 +       /* Now we need a stack to call a function. We are assured
47 +          that there is no child now, so it's safe to create
48 +          a frame.  */
49 +       stw     %rp, -20(%sp)
50 +       stwm    %r3, 64(%sp)
51 +       stw     %sp, -4(%sp)
52 +
53         sub     %r0,%ret0,%r3
54         SYSCALL_ERROR_HANDLER
55         /* Restore the PIC register (in delay slot) on error */