Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/vax gcc 4.5 on vax creates PLT stubs with an e...



details:   https://anonhg.NetBSD.org/src/rev/dae449aea757
branches:  trunk
changeset: 771462:dae449aea757
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Nov 21 16:17:48 2011 +0000

description:
gcc 4.5 on vax creates PLT stubs with an entry mask of 0xffc
rather than 0 like gcc 4.1 did, so the sneaky assembly functions
that "ret" without really returning now clobber their registers.
adjust these functions to avoid this problem.

diffstat:

 lib/libc/arch/vax/gen/alloca.S     |   6 +++---
 lib/libc/arch/vax/sys/__vfork14.S  |   5 +++--
 lib/libc/arch/vax/sys/getcontext.S |  17 +++++++++--------
 3 files changed, 15 insertions(+), 13 deletions(-)

diffs (92 lines):

diff -r a2c4f98d3559 -r dae449aea757 lib/libc/arch/vax/gen/alloca.S
--- a/lib/libc/arch/vax/gen/alloca.S    Mon Nov 21 15:11:45 2011 +0000
+++ b/lib/libc/arch/vax/gen/alloca.S    Mon Nov 21 16:17:48 2011 +0000
@@ -31,17 +31,17 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
        /* .asciz "@(#)alloca.s 8.1 (Berkeley) 6/4/93" */
-RCSID("$NetBSD: alloca.S,v 1.4 2011/01/25 02:38:15 matt Exp $")
+RCSID("$NetBSD: alloca.S,v 1.5 2011/11/21 16:17:48 chs Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 ENTRY(alloca, 0)
        movl    4(%ap),%r0      # get allocation size
-       movl    16(%fp),%r2     # save return address before we smash it
+       movl    16(%fp),%r1     # save return address before we smash it
        movab   here,16(%fp)
        ret
 here:
        subl2   %r0,%sp         # create stack space
        bicl2   $3,%sp          # align to longword boundary
        movl    %sp,%r0
-       jmp     (%r2)
+       jmp     (%r1)
 END(alloca)
diff -r a2c4f98d3559 -r dae449aea757 lib/libc/arch/vax/sys/__vfork14.S
--- a/lib/libc/arch/vax/sys/__vfork14.S Mon Nov 21 15:11:45 2011 +0000
+++ b/lib/libc/arch/vax/sys/__vfork14.S Mon Nov 21 16:17:48 2011 +0000
@@ -31,7 +31,7 @@
 
 #if defined(SYSLIBC_SCCS) && !defined(lint)
        /* .asciz "@(#)Ovfork.s 8.1 (Berkeley) 6/4/93" */
-RCSID("$NetBSD: __vfork14.S,v 1.6 2011/01/25 02:38:15 matt Exp $")
+RCSID("$NetBSD: __vfork14.S,v 1.7 2011/11/21 16:17:48 chs Exp $")
 #endif /* SYSLIBC_SCCS and not lint */
 
 /*
@@ -51,10 +51,11 @@
  */
 
 ENTRY(__vfork14, 0)
-       movl    16(%fp),%r2     # save return address before we smash it
+       movl    16(%fp),%r0     # save return address before we smash it
        movab   here,16(%fp)
        ret
 here:
+       movl    %r0,%r2
        chmk    $ SYS___vfork14
        bcs     err             # if failed, set errno and return -1
        /* this next trick is Chris Torek's fault */
diff -r a2c4f98d3559 -r dae449aea757 lib/libc/arch/vax/sys/getcontext.S
--- a/lib/libc/arch/vax/sys/getcontext.S        Mon Nov 21 15:11:45 2011 +0000
+++ b/lib/libc/arch/vax/sys/getcontext.S        Mon Nov 21 16:17:48 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getcontext.S,v 1.5 2011/01/25 02:38:15 matt Exp $      */
+/*     $NetBSD: getcontext.S,v 1.6 2011/11/21 16:17:48 chs Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "SYS.h"
 
 #ifdef SYSLIBC_SCCS
-RCSID("$NetBSD: getcontext.S,v 1.5 2011/01/25 02:38:15 matt Exp $")
+RCSID("$NetBSD: getcontext.S,v 1.6 2011/11/21 16:17:48 chs Exp $")
 #endif
 
 #ifdef WEAK_ALIAS
@@ -48,8 +48,8 @@
        jcc     1f
        jmp     CERROR+2                /* badness happened */
 
-1:     movl    4(%ap),%r2              /* ptr to ucontext */
-       movl    16(%fp),%r3             /* PC to return to */
+1:     movl    4(%ap),%r0              /* ptr to ucontext */
+       movl    16(%fp),%r1             /* PC to return to */
        movab   2f,16(%fp)              /* let's return early */
        ret
        /*
@@ -59,8 +59,9 @@
         * the callers state but we still have control.
         */
        _ALIGN_TEXT
-2:     movq    %ap,(36+12*4)(%r2)      /* adjust AP + SP */
-       movl    %fp,(36+14*4)(%r2)      /* adjust FP */
-       movl    %r3,(36+15*4)(%r2)      /* adjust PC */
-       jmp     (%r3)                   /* and return */
+2:     movq    %ap,(36+12*4)(%r0)      /* adjust AP + SP */
+       movl    %fp,(36+14*4)(%r0)      /* adjust FP */
+       movl    %r3,(36+15*4)(%r0)      /* adjust PC */
+       clrl    %r0
+       jmp     (%r1)                   /* and return */
 END(_getcontext)



Home | Main Index | Thread Index | Old Index