Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/sh5/gen Various setjmp/longjmp fixes.
details: https://anonhg.NetBSD.org/src/rev/7131bed87977
branches: trunk
changeset: 536089:7131bed87977
user: scw <scw%NetBSD.org@localhost>
date: Fri Sep 06 15:33:48 2002 +0000
description:
Various setjmp/longjmp fixes.
Synchronise with the kernel's sh5 signal code.
diffstat:
lib/libc/arch/sh5/gen/__setjmp14.S | 32 ++++++++++++++++++--------------
lib/libc/arch/sh5/gen/_setjmp.S | 17 +++++++++--------
2 files changed, 27 insertions(+), 22 deletions(-)
diffs (128 lines):
diff -r b0c91c6b8d88 -r 7131bed87977 lib/libc/arch/sh5/gen/__setjmp14.S
--- a/lib/libc/arch/sh5/gen/__setjmp14.S Fri Sep 06 15:32:56 2002 +0000
+++ b/lib/libc/arch/sh5/gen/__setjmp14.S Fri Sep 06 15:33:48 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: __setjmp14.S,v 1.1 2002/07/11 14:23:05 scw Exp $ */
+/* $NetBSD: __setjmp14.S,v 1.2 2002/09/06 15:33:48 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -59,6 +59,7 @@
st.q r2, _JB_R14, r14
st.q r2, _JB_R15, r15
st.q r2, _JB_R18, r18
+ st.q r2, _JB_PC, r18
LDUC32(0xACEBABE5, r0)
st.q r2, _JB_R24, r0 /* sigcontext magic number */
st.q r2, _JB_R26, r26
@@ -87,12 +88,11 @@
st.q r2, _JB_R57, r57
st.q r2, _JB_R58, r58
st.q r2, _JB_R59, r59
- movi 1, r0
- st.q r2, _JB_TR0, r0 /* Ensure caller-saved copies of */
- st.q r2, _JB_TR1, r0 /* branch-target registers have valid */
- st.q r2, _JB_TR2, r0 /* (albeit, pointing to nothing) */
- st.q r2, _JB_TR3, r0 /* SHmedia addresses. */
- st.q r2, _JB_TR4, r0
+ st.q r2, _JB_TR0, r18 /* Ensure caller-saved copies of */
+ st.q r2, _JB_TR1, r18 /* branch-target registers have valid */
+ st.q r2, _JB_TR2, r18 /* SHmedia addresses for the caller's */
+ st.q r2, _JB_TR3, r18 /* address space. */
+ st.q r2, _JB_TR4, r18
gettr tr5, r0
st.q r2, _JB_TR5, r0
gettr tr6, r0
@@ -141,7 +141,7 @@
/* Prepare to fetch the current signal stack state */
pta/l _C_LABEL(__sigaltstack14), tr0
#ifndef _LP64
- addi r15, -12, r15 /* sizeof(struct sigaltstack) */
+ addi r15, -16, r15 /* ALIGN(sizeof(struct sigaltstack)) */
#else
addi r15, -24, r15 /* sizeof(struct sigaltstack) */
#endif
@@ -150,7 +150,7 @@
blink tr0, r18
#ifndef _LP64
ld.l r15, 8, r0 /* Fetch oss->ss_flags */
- addi r15, 12, r15 /* Clear stack */
+ addi r15, 16, r15 /* Clear stack */
#else
ld.l r15, 16, r0 /* Fetch oss->ss_flags */
addi r15, 24, r15 /* Clear stack */
@@ -162,20 +162,24 @@
st.l r28, _JB_SIGONSTACK, r0 /* Save it in sc_onstack */
st.l r28, _JB_SIGMASK13, r63 /* Zero unused fields */
st.l r28, _JB_SIGPAD, r63
- ld.l r28, _JB_R18, r18 /* Restore return address */
- ld.l r28, _JB_R28, r28 /* Restore r28 */
+ ld.q r28, _JB_R28, r28 /* Restore r28 */
ptabs/l r18, tr0
movi 0, r2
blink tr0, r63
ENTRY_NOPROFILE(__longjmp14)
- LINK_FRAME(0)
pta/l _C_LABEL(__sigreturn14), tr0
- cmpeq r3, r63, r3 /* Ensure a non-zero return value */
+ movi 1, r1
+ cmveq r3, r1, r3 /* Ensure a non-zero return value */
st.q r2, _JB_R2, r3 /* Modify jmp_buf's copy of r2 */
blink tr0, r18
- UNLINK_FRAME(0)
+
+ /*
+ * The call to __sigreturn14 will only return here on error.
+ * This usually happens if the kernel determines that the jmp_buf
+ * is invalid in some way.
+ */
Lbotch: pta/l _C_LABEL(longjmperror), tr0
blink tr0, r18
diff -r b0c91c6b8d88 -r 7131bed87977 lib/libc/arch/sh5/gen/_setjmp.S
--- a/lib/libc/arch/sh5/gen/_setjmp.S Fri Sep 06 15:32:56 2002 +0000
+++ b/lib/libc/arch/sh5/gen/_setjmp.S Fri Sep 06 15:33:48 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _setjmp.S,v 1.3 2002/07/11 14:23:05 scw Exp $ */
+/* $NetBSD: _setjmp.S,v 1.4 2002/09/06 15:33:48 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -59,6 +59,7 @@
st.q r2, _JB_R14, r14
st.q r2, _JB_R15, r15
st.q r2, _JB_R18, r18
+ st.q r2, _JB_PC, r18
LDUC32(0xBADBABE5, r0)
st.q r2, _JB_R24, r0 /* sigcontext magic number */
st.q r2, _JB_R26, r26
@@ -87,12 +88,11 @@
st.q r2, _JB_R57, r57
st.q r2, _JB_R58, r58
st.q r2, _JB_R59, r59
- movi 1, r0
- st.q r2, _JB_TR0, r0 /* Ensure caller-saved copies of */
- st.q r2, _JB_TR1, r0 /* branch-target registers have valid */
- st.q r2, _JB_TR2, r0 /* (albeit, pointing to nothing) */
- st.q r2, _JB_TR3, r0 /* SHmedia addresses. */
- st.q r2, _JB_TR4, r0
+ st.q r2, _JB_TR0, r18 /* Ensure caller-saved copies of */
+ st.q r2, _JB_TR1, r18 /* branch-target registers have valid */
+ st.q r2, _JB_TR2, r18 /* SHmedia addresses in the caller's */
+ st.q r2, _JB_TR3, r18 /* address space. */
+ st.q r2, _JB_TR4, r18
gettr tr5, r0
st.q r2, _JB_TR5, r0
gettr tr6, r0
@@ -137,7 +137,8 @@
ld.q r2, _JB_R24, r0 /* Check if jmp_buf was saved by a */
LDUC32(0xBADBABE5, r1) /* call to _setjmp, above */
bne/u r0, r1, tr0 /* Punt if not */
- cmpeq r3, r63, r3 /* Ensure a non-zero return value */
+ movi 1, r1
+ cmveq r3, r1, r3 /* Ensure a non-zero return value */
/* Restore callee-saved register */
ld.q r2, _JB_R10, r10
Home |
Main Index |
Thread Index |
Old Index