Module Name:    src
Committed By:   matt
Date:           Mon Feb  1 06:53:00 UTC 2010

Modified Files:
        src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c trap.c

Log Message:
Allow port-specific code to init lwp0.l_addr early.  (pmax needs it so it
call badaddr).


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.30 -r1.205.4.1.2.1.2.31 \
    src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.217.12.17 -r1.217.12.18 src/sys/arch/mips/mips/trap.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/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.30 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.31
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.30	Mon Feb  1 04:16:19 2010
+++ src/sys/arch/mips/mips/mips_machdep.c	Mon Feb  1 06:52:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.30 2010/02/01 04:16:19 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.31 2010/02/01 06:52:59 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.30 2010/02/01 04:16:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.31 2010/02/01 06:52:59 matt Exp $");
 
 #include "opt_cputype.h"
 #include "opt_compat_netbsd32.h"
@@ -1620,8 +1620,16 @@
 void
 mips_init_lwp0_uarea(void)
 {
-	vaddr_t v = uvm_pageboot_alloc(USPACE);
-	lwp0.l_addr = proc0paddr = (struct user *)v;
+	struct lwp *l = curlwp;
+	vaddr_t v;
+	KASSERT(l == &lwp0);
+	if (l->l_addr == NULL) {
+		v = uvm_pageboot_alloc(USPACE);
+		l->l_addr = proc0paddr = (struct user *)v;
+	} else {
+		v = (vaddr_t)l->l_addr;
+		proc0paddr = l->l_addr;
+	}
 	lwp0.l_md.md_utf = (struct trapframe *)(v + USPACE) - 1;
 #ifdef _LP64
 	lwp0.l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX;

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.17 src/sys/arch/mips/mips/trap.c:1.217.12.18
--- src/sys/arch/mips/mips/trap.c:1.217.12.17	Mon Feb  1 04:16:20 2010
+++ src/sys/arch/mips/mips/trap.c	Mon Feb  1 06:52:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.217.12.17 2010/02/01 04:16:20 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.217.12.18 2010/02/01 06:52:59 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.17 2010/02/01 04:16:20 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.18 2010/02/01 06:52:59 matt Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -343,7 +343,7 @@
 		 * It is an error for the kernel to access user space except
 		 * through the copyin/copyout routines.
 		 */
-		if (l == NULL || l->l_addr->u_pcb.pcb_onfault == NULL)
+		if (l->l_addr->u_pcb.pcb_onfault == NULL)
 			goto dopanic;
 		/* check for fuswintr() or suswintr() getting a page fault */
 		if (l->l_addr->u_pcb.pcb_onfault == (void *)fswintrberr) {

Reply via email to