Module Name: src Committed By: chs Date: Mon Nov 21 16:17:48 UTC 2011
Modified Files: src/lib/libc/arch/vax/gen: alloca.S src/lib/libc/arch/vax/sys: __vfork14.S getcontext.S Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/vax/gen/alloca.S cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/vax/sys/__vfork14.S cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/sys/getcontext.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/arch/vax/gen/alloca.S diff -u src/lib/libc/arch/vax/gen/alloca.S:1.4 src/lib/libc/arch/vax/gen/alloca.S:1.5 --- src/lib/libc/arch/vax/gen/alloca.S:1.4 Tue Jan 25 02:38:15 2011 +++ src/lib/libc/arch/vax/gen/alloca.S Mon Nov 21 16:17:48 2011 @@ -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) Index: src/lib/libc/arch/vax/sys/__vfork14.S diff -u src/lib/libc/arch/vax/sys/__vfork14.S:1.6 src/lib/libc/arch/vax/sys/__vfork14.S:1.7 --- src/lib/libc/arch/vax/sys/__vfork14.S:1.6 Tue Jan 25 02:38:15 2011 +++ src/lib/libc/arch/vax/sys/__vfork14.S Mon Nov 21 16:17:48 2011 @@ -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 @@ RCSID("$NetBSD: __vfork14.S,v 1.6 2011/0 */ 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 */ Index: src/lib/libc/arch/vax/sys/getcontext.S diff -u src/lib/libc/arch/vax/sys/getcontext.S:1.5 src/lib/libc/arch/vax/sys/getcontext.S:1.6 --- src/lib/libc/arch/vax/sys/getcontext.S:1.5 Tue Jan 25 02:38:15 2011 +++ src/lib/libc/arch/vax/sys/getcontext.S Mon Nov 21 16:17:48 2011 @@ -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 @@ ENTRY(_getcontext, 0) 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 @@ ENTRY(_getcontext, 0) * 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)