Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa Track if we saved l_private in the mcontext an...



details:   https://anonhg.NetBSD.org/src/rev/9a6198486855
branches:  trunk
changeset: 771917:9a6198486855
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Dec 08 21:00:49 2011 +0000

description:
Track if we saved l_private in the mcontext and don't blindly restore it.

This fixes the tests in /usr/tests/lib/libc/setjmp/t_threadjmp

diffstat:

 sys/arch/hppa/hppa/hppa_machdep.c |  16 ++++++++++------
 sys/arch/hppa/include/mcontext.h  |   3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r 160c4a21c926 -r 9a6198486855 sys/arch/hppa/hppa/hppa_machdep.c
--- a/sys/arch/hppa/hppa/hppa_machdep.c Thu Dec 08 15:35:34 2011 +0000
+++ b/sys/arch/hppa/hppa/hppa_machdep.c Thu Dec 08 21:00:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hppa_machdep.c,v 1.25 2011/02/24 08:59:22 skrll Exp $  */
+/*     $NetBSD: hppa_machdep.c,v 1.26 2011/12/08 21:00:49 skrll Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.25 2011/02/24 08:59:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.26 2011/12/08 21:00:49 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -201,7 +201,7 @@
                gr[_REG_PCOQT] = ras_pc + 4;
        }
 
-       *flags |= _UC_CPU;
+       *flags |= _UC_CPU | _UC_TLSBASE;
 
        if (l->l_md.md_flags & 0) {
                return;
@@ -303,9 +303,6 @@
                        tf->tf_iioq_tail |= HPPA_PC_PRIV_USER;
                }
 
-               lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_CR27]);
-               tf->tf_cr27     = gr[_REG_CR27];
-
 #if 0
                tf->tf_sr0      = gr[_REG_SR0];
                tf->tf_sr1      = gr[_REG_SR1];
@@ -316,6 +313,13 @@
 #endif
        }
 
+       /* Restore the private thread context */
+       if (flags & _UC_TLSBASE) {
+               lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_CR27]);
+               tf->tf_cr27     = gr[_REG_CR27];
+       }
+
+       /* Restore the floating point registers */
        if ((flags & _UC_FPU) != 0) {
                struct pcb *pcb = lwp_getpcb(l);
 
diff -r 160c4a21c926 -r 9a6198486855 sys/arch/hppa/include/mcontext.h
--- a/sys/arch/hppa/include/mcontext.h  Thu Dec 08 15:35:34 2011 +0000
+++ b/sys/arch/hppa/include/mcontext.h  Thu Dec 08 21:00:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcontext.h,v 1.6 2011/02/25 14:07:12 joerg Exp $       */
+/*     $NetBSD: mcontext.h,v 1.7 2011/12/08 21:00:50 skrll Exp $       */
 
 #ifndef _HPPA_MCONTEXT_H_
 #define        _HPPA_MCONTEXT_H_
@@ -73,5 +73,6 @@
 
 #define        _UC_SETSTACK    0x00010000
 #define        _UC_CLRSTACK    0x00020000
+#define        _UC_TLSBASE     0x00040000
 
 #endif /* _HPPA_MCONTEXT_H_ */



Home | Main Index | Thread Index | Old Index