Source-Changes-HG archive

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

[src/trunk]: src/lib/libc POSIX sez:



details:   https://anonhg.NetBSD.org/src/rev/1f21c467e83b
branches:  trunk
changeset: 379272:1f21c467e83b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 25 00:14:41 2021 +0000

description:
POSIX sez:
    The longjmp() function shall not cause setjmp() to return 0; if val
    is 0, setjmp() shall return 1.

Fixes the _longjmp_zero and longjmp_zero test cases in the t_setjmp
test on alpha.

diffstat:

 lib/libc/arch/alpha/gen/__longjmp14.c           |  4 ++--
 lib/libc/compat/arch/alpha/gen/compat__setjmp.S |  6 ++++--
 lib/libc/compat/arch/alpha/gen/compat_setjmp.S  |  6 ++++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 0b9eb53320f5 -r 1f21c467e83b lib/libc/arch/alpha/gen/__longjmp14.c
--- a/lib/libc/arch/alpha/gen/__longjmp14.c     Mon May 24 23:59:59 2021 +0000
+++ b/lib/libc/arch/alpha/gen/__longjmp14.c     Tue May 25 00:14:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __longjmp14.c,v 1.7 2013/03/13 08:05:46 martin Exp $   */
+/*     $NetBSD: __longjmp14.c,v 1.8 2021/05/25 00:14:41 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@ void
 
        /* Ensure non-zero return value */
        if (val == 0)
-               val = -1;
+               val = 1;
 
        /* Set _UC_SIGMASK and _UC_CPU */
        uc.uc_flags = _UC_SIGMASK | _UC_CPU;
diff -r 0b9eb53320f5 -r 1f21c467e83b lib/libc/compat/arch/alpha/gen/compat__setjmp.S
--- a/lib/libc/compat/arch/alpha/gen/compat__setjmp.S   Mon May 24 23:59:59 2021 +0000
+++ b/lib/libc/compat/arch/alpha/gen/compat__setjmp.S   Tue May 25 00:14:41 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat__setjmp.S,v 1.4 2014/01/24 10:19:18 skrll Exp $ */
+/* $NetBSD: compat__setjmp.S,v 1.5 2021/05/25 00:14:41 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -115,7 +115,9 @@ LEAF(_longjmp, 2)
        ldt     ft0, (69 * 8)(a0)               /* get sc_fpcr */
        mt_fpcr ft0                             /* and restore it. */
 
-       mov     a1, v0                          /* return second arg */
+       bne     a1, 1f                          /* val != 0, just go */
+       ldiq    a1, 1                           /* val = 1 otherwise */
+1:     mov     a1, v0                          /* return second arg */
        RET
 
 botch:
diff -r 0b9eb53320f5 -r 1f21c467e83b lib/libc/compat/arch/alpha/gen/compat_setjmp.S
--- a/lib/libc/compat/arch/alpha/gen/compat_setjmp.S    Mon May 24 23:59:59 2021 +0000
+++ b/lib/libc/compat/arch/alpha/gen/compat_setjmp.S    Tue May 25 00:14:41 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_setjmp.S,v 1.2 2014/01/23 03:08:50 christos Exp $ */
+/* $NetBSD: compat_setjmp.S,v 1.3 2021/05/25 00:14:41 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -114,7 +114,9 @@ END(setjmp)
 
 LEAF(longjmp, 2)
        LDGP(pv)
-       stq     a1, (( 0 + 4) * 8)(a0)          /* save return value */
+       bne     a1, 1f                          /* val != 0, just go */
+       ldiq    a1, 1                           /* val = 1 otherwise */
+1:     stq     a1, (( 0 + 4) * 8)(a0)          /* save return value */
        CALL(sigreturn)                         /* use sigreturn to return */
 
 botch:



Home | Main Index | Thread Index | Old Index