Module Name:    src
Committed By:   skrll
Date:           Tue Aug  9 09:02:10 UTC 2016

Modified Files:
        src/sys/arch/mips/mips: vm_machdep.c

Log Message:
Initialise md_upte for the new lwp
KASSERT that we're always direct mapped when we expect to be


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/arch/mips/mips/vm_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/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.151 src/sys/arch/mips/mips/vm_machdep.c:1.152
--- src/sys/arch/mips/mips/vm_machdep.c:1.151	Tue Aug  9 08:59:08 2016
+++ src/sys/arch/mips/mips/vm_machdep.c	Tue Aug  9 09:02:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -116,6 +116,10 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 
 	l2->l_md.md_utf = tf;
 #if (USPACE > PAGE_SIZE) || !defined(_LP64)
+	CTASSERT(__arraycount(l2->l_md.md_upte) >= UPAGES);
+	for (u_int i = 0; i < __arraycount(l2->l_md.md_upte); i++) {
+		l2->l_md.md_upte[i] = 0;
+	}
 	if (!pmap_md_direct_mapped_vaddr_p(ua2)) {
 		CTASSERT((PGSHIFT == 12) == (UPAGES == 2));
 		pt_entry_t * const pte = pmap_pte_lookup(pmap_kernel(), ua2);
@@ -128,6 +132,8 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 			l2->l_md.md_upte[i] = pte[i] & ~x;
 		}
 	}
+#else
+	KASSERT(pmap_md_direct_mapped_vaddr_p(ua2));
 #endif
 	/*
 	 * Rig kernel stack so that it would start out in lwp_trampoline()

Reply via email to