Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/x68k It's a bit horrible to call uvm_page_phys...



details:   https://anonhg.NetBSD.org/src/rev/09e8c0629972
branches:  trunk
changeset: 764957:09e8c0629972
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat May 14 10:49:06 2011 +0000

description:
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.

diffstat:

 sys/arch/x68k/x68k/locore.s  |   3 +-
 sys/arch/x68k/x68k/machdep.c |  54 ++++++++++++++++++++++++-------------------
 2 files changed, 32 insertions(+), 25 deletions(-)

diffs (120 lines):

diff -r 6878fd134ef5 -r 09e8c0629972 sys/arch/x68k/x68k/locore.s
--- a/sys/arch/x68k/x68k/locore.s       Sat May 14 10:19:58 2011 +0000
+++ b/sys/arch/x68k/x68k/locore.s       Sat May 14 10:49:06 2011 +0000
@@ -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.
diff -r 6878fd134ef5 -r 09e8c0629972 sys/arch/x68k/x68k/machdep.c
--- a/sys/arch/x68k/x68k/machdep.c      Sat May 14 10:19:58 2011 +0000
+++ b/sys/arch/x68k/x68k/machdep.c      Sat May 14 10:49:06 2011 +0000
@@ -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();



Home | Main Index | Thread Index | Old Index