Module Name:    src
Committed By:   skrll
Date:           Thu Dec  8 21:00:50 UTC 2011

Modified Files:
        src/sys/arch/hppa/hppa: hppa_machdep.c
        src/sys/arch/hppa/include: mcontext.h

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/hppa/hppa_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/include/mcontext.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/hppa/hppa_machdep.c
diff -u src/sys/arch/hppa/hppa/hppa_machdep.c:1.25 src/sys/arch/hppa/hppa/hppa_machdep.c:1.26
--- src/sys/arch/hppa/hppa/hppa_machdep.c:1.25	Thu Feb 24 08:59:22 2011
+++ src/sys/arch/hppa/hppa/hppa_machdep.c	Thu Dec  8 21:00:49 2011
@@ -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 @@ cpu_getmcontext(struct lwp *l, mcontext_
 		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 @@ cpu_setmcontext(struct lwp *l, const mco
 			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 @@ cpu_setmcontext(struct lwp *l, const mco
 #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);
 

Index: src/sys/arch/hppa/include/mcontext.h
diff -u src/sys/arch/hppa/include/mcontext.h:1.6 src/sys/arch/hppa/include/mcontext.h:1.7
--- src/sys/arch/hppa/include/mcontext.h:1.6	Fri Feb 25 14:07:12 2011
+++ src/sys/arch/hppa/include/mcontext.h	Thu Dec  8 21:00:50 2011
@@ -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 @@ __lwp_getprivate_fast(void)
 
 #define	_UC_SETSTACK	0x00010000
 #define	_UC_CLRSTACK	0x00020000
+#define	_UC_TLSBASE	0x00040000
 
 #endif /* _HPPA_MCONTEXT_H_ */

Reply via email to