Module Name:    src
Committed By:   tsutsui
Date:           Sat May 14 10:49:06 UTC 2011

Modified Files:
        src/sys/arch/x68k/x68k: locore.s machdep.c

Log Message:
It's a bit horrible to call uvm_page_physload() from consinit().
Instead, prepare x68k_init() function for pre-main MD initialization as other
m68k ports and move uvm_page_physload() call and msgbuf initialization there.

Tested on X68030, but options EXTENDED_MEMORY is untested.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.102 src/sys/arch/x68k/x68k/locore.s:1.103
--- src/sys/arch/x68k/x68k/locore.s:1.102	Wed May 11 14:17:29 2011
+++ src/sys/arch/x68k/x68k/locore.s	Sat May 14 10:49:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.102 2011/05/11 14:17:29 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.103 2011/05/14 10:49:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -930,6 +930,7 @@
 /* final setup for C code */
 	movl	%d7,_C_LABEL(boothowto)	| save reboot flags
 	movl	%d6,_C_LABEL(bootdev)	|   and boot device
+	jbsr	_C_LABEL(x68k_init)	| additional pre-main initialization
 
 /*
  * Create a fake exception frame so that cpu_lwp_fork() can copy it.

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.173 src/sys/arch/x68k/x68k/machdep.c:1.174
--- src/sys/arch/x68k/x68k/machdep.c:1.173	Fri Mar  4 22:25:30 2011
+++ src/sys/arch/x68k/x68k/machdep.c	Sat May 14 10:49:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.173 2011/03/04 22:25:30 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.173 2011/03/04 22:25:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -142,6 +142,7 @@
 #endif
 
 /* functions called from locore.s */
+void	x68k_init(void);
 void	dumpsys(void);
 void    straytrap(int, u_short);
 void	nmihand(struct frame);
@@ -167,6 +168,33 @@
 
 static callout_t candbtimer_ch;
 
+void
+x68k_init(void)
+{
+	u_int i;
+
+	/*
+	 * Tell the VM system about available physical memory.
+	 */
+	uvm_page_physload(atop(avail_start), atop(avail_end),
+	    atop(avail_start), atop(avail_end),
+	    VM_FREELIST_DEFAULT);
+#ifdef EXTENDED_MEMORY
+	setmemrange();
+#endif
+
+	/*
+	 * Initialize error message buffer (at end of core).
+	 * avail_end was pre-decremented in pmap_bootstrap to compensate.
+	 */
+	for (i = 0; i < btoc(MSGBUFSIZE); i++)
+		pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
+		    avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
+		    VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
+	pmap_update(pmap_kernel());
+	initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
+}
+
 /*
  * Console initialization: called early on from main,
  * before vm init or startup.  Do enough configuration
@@ -196,16 +224,6 @@
 	if (boothowto & RB_KDB)
 		Debugger();
 #endif
-
-	/*
-	 * Tell the VM system about available physical memory.
-	 */
-	uvm_page_physload(atop(avail_start), atop(avail_end),
-			atop(avail_start), atop(avail_end),
-			VM_FREELIST_DEFAULT);
-#ifdef EXTENDED_MEMORY
-	setmemrange();
-#endif
 }
 
 /*
@@ -217,7 +235,6 @@
 {
 	vaddr_t minaddr, maxaddr;
 	char pbuf[9];
-	u_int i;
 #ifdef DEBUG
 	extern int pmapdebug;
 	int opmapdebug = pmapdebug;
@@ -229,17 +246,6 @@
 		m68k_make_fpu_idle_frame();
 
 	/*
-	 * Initialize error message buffer (at end of core).
-	 * avail_end was pre-decremented in pmap_bootstrap to compensate.
-	 */
-	for (i = 0; i < btoc(MSGBUFSIZE); i++)
-		pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
-		    avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
-		    VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
-	pmap_update(pmap_kernel());
-	initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
-
-	/*
 	 * Initialize the kernel crash dump header.
 	 */
 	cpu_init_kcore_hdr();

Reply via email to