Module Name:    src
Committed By:   tsutsui
Date:           Fri Dec  4 16:57:18 UTC 2009

Modified Files:
        src/sys/arch/mac68k/mac68k: locore.s pmap_bootstrap.c

Log Message:
Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Tested on LC630.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/mac68k/mac68k/pmap_bootstrap.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/mac68k/mac68k/locore.s
diff -u src/sys/arch/mac68k/mac68k/locore.s:1.156 src/sys/arch/mac68k/mac68k/locore.s:1.157
--- src/sys/arch/mac68k/mac68k/locore.s:1.156	Thu Nov 26 00:19:18 2009
+++ src/sys/arch/mac68k/mac68k/locore.s	Fri Dec  4 16:57:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.156 2009/11/26 00:19:18 matt Exp $	*/
+/*	$NetBSD: locore.s,v 1.157 2009/12/04 16:57:18 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -336,15 +336,13 @@
 /* select the software page size now */
 	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
 	jbsr	_C_LABEL(uvm_setpagesize)  | select software page size
-
+/* call final pmap setup which initialize lwp0, curlwp, and curpcb */
+	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP, lwp0, and initial pcb */
-	lea	_C_LABEL(lwp0),%a2	| get lwp0.l_addr
-	movl	%a2@(L_ADDR),%a1	|   set kernel stack to end of area 
-	lea	%a1@(USPACE-4),%sp	|   and curlwp so that we don't
-	movl	%a2,_C_LABEL(curlwp)	|   deref NULL in trap()
+	movl	_C_LABEL(lwp0uarea),%a1	| get lwp0 uarea
+	lea	%a1@(USPACE-4),%sp	|   set kernel stack to end of area
 	movl	#USRSTACK-4,%a2
 	movl	%a2,%usp		| init %USP
-	movl	%a1,_C_LABEL(curpcb)	| lwp0 is running
 
 /* flush TLB and turn on caches */
 	cmpl	#MMU_68040,_C_LABEL(mmutype) | 68040?

Index: src/sys/arch/mac68k/mac68k/pmap_bootstrap.c
diff -u src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.80 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.81
--- src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.80	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/mac68k/mac68k/pmap_bootstrap.c	Fri Dec  4 16:57:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.80 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.81 2009/12/04 16:57:18 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.80 2009/11/27 03:23:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.81 2009/12/04 16:57:18 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -110,7 +110,7 @@
 void
 pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
 {
-	paddr_t kstpa, kptpa, kptmpa, l0upa;
+	paddr_t kstpa, kptpa, kptmpa, lwp0upa;
 	u_int nptpages, kstsize;
 	paddr_t avail_next;
 	int avail_remaining;
@@ -138,7 +138,7 @@
 	 *
 	 *	kptmpa		kernel PT map		1 page
 	 *
-	 *	l0upa		lwp 0 u-area		UPAGES pages
+	 *	lwp0upa		lwp 0 u-area		UPAGES pages
 	 *
 	 */
 	if (mmutype == MMU_68040)
@@ -149,7 +149,7 @@
 	nextpa += kstsize * PAGE_SIZE;
 	kptmpa = nextpa;
 	nextpa += PAGE_SIZE;
-	l0upa = nextpa;
+	lwp0upa = nextpa;
 	nextpa += USPACE;
 	kptpa = nextpa;
 	nptpages = Sysptsize +
@@ -335,7 +335,7 @@
 	}
 	/*
 	 * Validate PTEs for kernel data/bss, dynamic data allocated
-	 * by us so far (nextpa - firstpa bytes), and pages for proc0
+	 * by us so far (nextpa - firstpa bytes), and pages for lwp0
 	 * u-area and page table allocated below (RW).
 	 */
 	epte = &(PA2VA(kptpa, u_int *))[m68k_btop(nextpa - firstpa)];
@@ -399,21 +399,22 @@
 	Sysmap = (pt_entry_t *)m68k_ptob((NPTEPG - 1) * NPTEPG);
 
 	/*
-	 * Setup u-area for process 0.
+	 * Setup u-area for lwp 0.
 	 */
 	/*
 	 * Zero the u-area.
 	 * NOTE: `pte' and `epte' aren't PTEs here.
 	 */
-	pte = PA2VA(l0upa, u_int *);
-	epte = (u_int *)(PA2VA(l0upa, u_int) + USPACE);
+	pte = PA2VA(lwp0upa, u_int *);
+	epte = (u_int *)(PA2VA(lwp0upa, u_int) + USPACE);
 	while (pte < epte)
 		*pte++ = 0;
 
 	/*
-	 * Store the u-area address
+	 * Remember the u-area address so it can be loaded in the lwp0
+	 * via uvm_lwp_setuarea() later in pmap_bootstrap_finalize().
 	 */
-	uvm_lwp_setuarea(&lwp0, PA2VA(l0upa, vaddr_t));
+	lwp0uarea = PA2VA(lwp0upa, vaddr_t);
 
 	/*
 	 * VM data structures are now initialized, set up data for

Reply via email to