Module Name: src
Committed By: rin
Date: Thu Feb 20 07:07:02 UTC 2020
Modified Files:
src/lib/libpthread/arch/powerpc: pthread_md.h
src/sys/arch/powerpc/powerpc: sig_machdep.c
Log Message:
libpthread sets initial value of MSR for lwp's. However, appropriate
value differs b/w oea/booke/ibm4xx, and there's no way to obtain it
from userland. Therefore, this initial value should be corrected by
cpu_setmcontext().
- Comment this in libpthread
- Add KASSERT in cpu_mcontext_validate()
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/powerpc/pthread_md.h
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/powerpc/powerpc/sig_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpthread/arch/powerpc/pthread_md.h
diff -u src/lib/libpthread/arch/powerpc/pthread_md.h:1.7 src/lib/libpthread/arch/powerpc/pthread_md.h:1.8
--- src/lib/libpthread/arch/powerpc/pthread_md.h:1.7 Tue Jan 25 19:12:05 2011
+++ src/lib/libpthread/arch/powerpc/pthread_md.h Thu Feb 20 07:07:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_md.h,v 1.7 2011/01/25 19:12:05 christos Exp $ */
+/* $NetBSD: pthread_md.h,v 1.8 2020/02/20 07:07:02 rin Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -53,7 +53,10 @@ pthread__sp(void)
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
- * 0xd032 is PSL_USERSET from arch/powerpc/include/psl.h
+ *
+ * XXX
+ * "Sane value" for MSR differs between oea/booke/ibm4xx, but no way to
+ * obtain from userland. It should be corrected by cpu_setmcontext().
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_MSR] = 0xd032;
Index: src/sys/arch/powerpc/powerpc/sig_machdep.c
diff -u src/sys/arch/powerpc/powerpc/sig_machdep.c:1.46 src/sys/arch/powerpc/powerpc/sig_machdep.c:1.47
--- src/sys/arch/powerpc/powerpc/sig_machdep.c:1.46 Tue Nov 27 14:09:54 2018
+++ src/sys/arch/powerpc/powerpc/sig_machdep.c Thu Feb 20 07:07:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.46 2018/11/27 14:09:54 maxv Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.47 2020/02/20 07:07:02 rin Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.46 2018/11/27 14:09:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.47 2020/02/20 07:07:02 rin Exp $");
#include "opt_ppcarch.h"
#include "opt_altivec.h"
@@ -191,6 +191,8 @@ cpu_getmcontext(struct lwp *l, mcontext_
int
cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
{
+
+ KASSERT(PSL_USEROK_P(mcp->__gregs[_REG_MSR]));
return 0;
}