summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-01-04 13:51:20 +0000
committerart <art@openbsd.org>2002-01-04 13:51:20 +0000
commit6489e645278eda2ef24b05d390e5256a179f76bf (patch)
tree95b904e88fc38f8eaf3ae66c9e93701a2e090699
parentTest _longjmp too. (Don't hate me for the '_' option). (diff)
downloadwireguard-openbsd-6489e645278eda2ef24b05d390e5256a179f76bf.tar.xz
wireguard-openbsd-6489e645278eda2ef24b05d390e5256a179f76bf.zip
longjmp(..., 0) is not really legal, but all other archs I've looked
at make sure that setjmp doesn't return 0 if longjmp is passed a 0. Avoid surprises.
-rw-r--r--lib/libc/arch/alpha/gen/_setjmp.S7
-rw-r--r--lib/libc/arch/alpha/gen/setjmp.S8
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/libc/arch/alpha/gen/_setjmp.S b/lib/libc/arch/alpha/gen/_setjmp.S
index 711bb7abbce..5ad0bf9cce6 100644
--- a/lib/libc/arch/alpha/gen/_setjmp.S
+++ b/lib/libc/arch/alpha/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.3 1996/11/13 21:20:09 niklas Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.4 2002/01/04 13:51:20 art Exp $ */
/* $NetBSD: _setjmp.S,v 1.2 1996/10/17 03:08:03 cgd Exp $ */
/*
@@ -32,7 +32,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: _setjmp.S,v 1.3 1996/11/13 21:20:09 niklas Exp $"
+ .asciz "$OpenBSD: _setjmp.S,v 1.4 2002/01/04 13:51:20 art Exp $"
#endif
/*
@@ -119,6 +119,9 @@ LEAF(_longjmp, 2)
ldt ft0, (69 * 8)(a0) /* get sc_fpcr */
mt_fpcr ft0 /* and restore it. */
+ bne a1, 1f
+ addq a1, 1, a1
+1:
mov a1, v0 /* return second arg */
RET
diff --git a/lib/libc/arch/alpha/gen/setjmp.S b/lib/libc/arch/alpha/gen/setjmp.S
index 0caaec361c7..66d0d42b4e7 100644
--- a/lib/libc/arch/alpha/gen/setjmp.S
+++ b/lib/libc/arch/alpha/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.3 1996/11/13 21:20:21 niklas Exp $ */
+/* $OpenBSD: setjmp.S,v 1.4 2002/01/04 13:51:20 art Exp $ */
/* $NetBSD: setjmp.S,v 1.2 1996/10/17 03:08:06 cgd Exp $ */
/*
@@ -32,7 +32,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: setjmp.S,v 1.3 1996/11/13 21:20:21 niklas Exp $"
+ .asciz "$OpenBSD: setjmp.S,v 1.4 2002/01/04 13:51:20 art Exp $"
#endif
/*
@@ -120,6 +120,9 @@ END(setjmp)
LEAF(longjmp, 2)
LDGP(pv)
+ bne a1, 1f
+ addq a1, 1, a1
+1:
stq a1, (( 0 + 4) * 8)(a0) /* save return value */
CALL(sigreturn) /* use sigreturn to return */
@@ -128,3 +131,4 @@ botch:
CALL(abort)
RET /* "can't" get here... */
END(longjmp)
+