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/969f34c1d1ff
branches:  trunk
changeset: 1021303:969f34c1d1ff
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 bca08b0e2a6c -r 969f34c1d1ff 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 @@
 
        /* 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 bca08b0e2a6c -r 969f34c1d1ff 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 @@
        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 bca08b0e2a6c -r 969f34c1d1ff 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 @@
 
 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