get rid of BOOTDEBUG code
authorMike Hibler <hibler@ucbvax.Berkeley.EDU>
Tue, 16 Jun 1992 05:51:32 +0000 (21:51 -0800)
committerMike Hibler <hibler@ucbvax.Berkeley.EDU>
Tue, 16 Jun 1992 05:51:32 +0000 (21:51 -0800)
SCCS-vsn: sys/hp300/hp300/locore.s 7.14
SCCS-vsn: sys/hp300/hp300/pmap_bootstrap.c 7.2

usr/src/sys/hp300/hp300/locore.s
usr/src/sys/hp300/hp300/pmap_bootstrap.c

index ce25640..7e9eaa4 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: locore.s 1.62 92/01/20$
  *
  *
  * from: Utah $Hdr: locore.s 1.62 92/01/20$
  *
- *     @(#)locore.s    7.13 (Berkeley) %G%
+ *     @(#)locore.s    7.14 (Berkeley) %G%
  */
 
 #include "assym.s"
  */
 
 #include "assym.s"
@@ -906,227 +906,9 @@ Lstart1:
        pea     a5@                     | firstpa
        pea     a4@                     | nextpa
        RELOC(_pmap_bootstrap,a0)
        pea     a5@                     | firstpa
        pea     a4@                     | nextpa
        RELOC(_pmap_bootstrap,a0)
-       jbsr    a0@                     | bootstrap(firstpa, nextpa)
+       jbsr    a0@                     | pmap_bootstrap(firstpa, nextpa)
        addql   #8,sp
 
        addql   #8,sp
 
-#ifdef BOOTDEBUG
-/*
- * If we are debugging the pmap_bootstrap code, we ignore what it has
- * just done (without clobbering it) and do it ourselves here with the
- * code we know works.
- */
-       .globl  _Xavail_start
-       RELOC(_Xavail_start,a0)
-       movl    a0@,a4                  | grab new first avail PA
-       movl    a4,d1                   | new firstpa
-       movl    d5,d0
-       addl    a5,d0                   | old firstpa
-       subl    d0,d1                   | new - old == amount allocated
-       addl    d1,d5                   | update firstva
-/*
- * Allocate kernel segment/page table resources.
- *     a5 contains the PA of lowest RAM page
- *     a4 contains the PA of first available page at any time
- *     d5 contains the VA of first available page at any time
- *        (since we assume a zero load point, it is also the size of
- *        allocated space at any time)
- * We assume (i.e. do not check) that the initial page table size
- * (Sysptsize) is big enough to map everything we allocate here.
- *
- * We allocate the IO maps here since the 320/350 MMU registers are
- * mapped in this range and it would be nice to be able to access them
- * after the MMU is turned on.
- */
-       .globl  _Sysseg, _Sysmap, _Sysptmap, _Sysptsize
-#if 0
-       movl    #_end,d5                | end of static kernel text/data
-       addl    #NBPG-1,d5
-       andl    #PG_FRAME,d5            | round to a page
-       movl    d5,a4
-       addl    a5,a4
-#endif
-/* allocate kernel segment table */
-       RELOC(_Sysseg, a0)
-       movl    d5,a0@                  | remember VA for pmap module
-       movl    a4,sp@-                 | remember PA for loading MMU
-       addl    #NBPG,a4
-       addl    #NBPG,d5
-/* allocate initial page table pages (including internal IO map) */
-       RELOC(_Sysptsize, a0)
-       movl    a0@,d0                  | initial system PT size (pages)
-       addl    #(IIOMAPSIZE+EIOMAPSIZE+NPTEPG-1)/NPTEPG,d0
-                                       | add pages for IO maps
-       movl    #PGSHIFT,d1
-       lsll    d1,d0                   | convert to bytes
-       movl    a4,sp@-                 | remember PA for ST load
-       addl    d0,a4
-       addl    d0,d5
-/* allocate kernel page table map */
-       RELOC(_Sysptmap, a0)
-       movl    d5,a0@                  | remember VA for pmap module
-       movl    a4,sp@-                 | remember PA for PT map load
-       addl    #NBPG,a4
-       addl    #NBPG,d5
-/* compute KVA of Sysptmap; mapped after page table pages */
-       movl    d0,d2                   | remember PT size (bytes)
-       moveq   #SG_ISHIFT-PGSHIFT,d1
-       lsll    d1,d0                   | page table size serves as seg index
-       RELOC(_Sysmap, a0)
-       movl    d0,a0@                  | remember VA for pmap module
-/* initialize ST and PT map: PT pages + PT map */
-       movl    sp@+,a1                 | PT map PA
-       movl    sp@+,d4                 | start of PT pages
-       movl    sp@+,a0                 | ST phys addr
-       lea     a0@(NBPG-4),a2          | (almost) end of ST
-       movl    d4,d3
-       orl     #SG_RW+SG_V,d4          | create proto STE for ST
-       orl     #PG_RW+PG_CI+PG_V,d3    | create proto PTE for PT map
-List1:
-       movl    d4,a0@+
-       movl    d3,a1@+
-       addl    #NBPG,d4
-       addl    #NBPG,d3
-       cmpl    a4,d4                   | sleezy, but works ok
-       jcs     List1
-/* initialize ST and PT map: invalidate up to last entry */
-List2:
-       movl    #SG_NV,a0@+
-       movl    #PG_NV,a1@+
-       cmpl    a2,a0
-       jcs     List2
-/*
- * Portions of the last segment of KVA space (0xFFF00000 - 0xFFFFFFFF)
- * are mapped for a couple of purposes. 0xFFF00000 for UPAGES is used
- * for mapping the current process u-area (u + kernel stack).  The
- * very last page (0xFFFFF000) is mapped to the last physical page of
- * RAM to give us a region in which PA == VA.  We use this page for
- * enabling/disabling mapping.
- */
-       movl    a4,d1                   | grab next available for PT page
-       andl    #SG_FRAME,d1            | mask to frame number
-       orl     #SG_RW+SG_V,d1          | RW and valid
-       movl    d1,a0@+                 | store in last ST entry
-       movl    a0,a2                   | remember addr for PT load
-       andl    #PG_FRAME,d1
-       orl     #PG_RW+PG_CI+PG_V,d1    | convert to PTE
-       movl    d1,a1@+                 | store in PT map
-       movl    a4,a0                   | physical beginning of PT page
-       lea     a0@(NBPG-4),a1          | (almost) end of page
-Lispt7:
-       movl    #PG_NV,a0@+             | invalidate
-       cmpl    a1,a0
-       jcs     Lispt7
-       movl    #MAXADDR,d1             | get last phys page addr
-       andl    #PG_FRAME,d1
-       orl     #PG_RW+PG_CI+PG_V,d1
-       movl    d1,a0@+                 | map to last virt page
-       addl    #NBPG,a4
-       addl    #NBPG,d5
-/* record KVA at which to access current u-area PTEs */
-       RELOC(_Sysmap, a0)
-       movl    a0@,d0                  | get system PT address
-       addl    #NPTEPG*NBPG,d0         | end of system PT
-       subl    #HIGHPAGES*4,d0         | back up to first PTE for u-area
-       RELOC(_Umap, a0)
-       movl    d0,a0@                  | remember location
-/* initialize page table pages */
-       movl    a2,a0                   | end of ST is start of PT
-       addl    d2,a2                   | add size to get end of PT
-/* text pages are read-only */
-       clrl    d0                      | assume load at VA 0
-       movl    a5,d1                   | get load PA
-       andl    #PG_FRAME,d1            | convert to a page frame
-#ifdef KGDB
-       orl     #PG_RW+PG_V,d1          | XXX: RW for now
-#else
-       orl     #PG_RO+PG_V,d1          | create proto PTE
-#endif
-       movl    #_etext,a1              | go til end of text
-Lipt1:
-       movl    d1,a0@+                 | load PTE
-       addl    #NBPG,d1                | increment page frame number
-       addl    #NBPG,d0                | and address counter
-       cmpl    a1,d0                   | done yet?
-       jcs     Lipt1                   | no, keep going
-/* data, bss and dynamic tables are read/write */
-       andl    #PG_FRAME,d1            | mask out old prot bits
-       orl     #PG_RW+PG_V,d1          | mark as valid and RW
-       movl    d5,a1                   | go til end of data allocated so far
-       addl    #(UPAGES+1)*NBPG,a1     | and proc0 PT/u-area (to be allocated)
-Lipt2:
-       movl    d1,a0@+                 | load PTE
-       addl    #NBPG,d1                | increment page frame number
-       addl    #NBPG,d0                | and address counter
-       cmpl    a1,d0                   | done yet?
-       jcs     Lipt2                   | no, keep going
-/* invalidate remainder of kernel PT */
-       movl    a2,a1                   | end of PT
-Lipt3:
-       movl    #PG_NV,a0@+             | invalidate PTE
-       cmpl    a1,a0                   | done yet?
-       jcs     Lipt3                   | no, keep going
-/* go back and validate internal IO PTEs at end of allocated PT space */
-       movl    a2,a0                   | end of allocated PT space
-       subl    #(IIOMAPSIZE+EIOMAPSIZE)*4,a0   | back up IOMAPSIZE PTEs
-       subl    #EIOMAPSIZE*4,a2        | only initialize internal IO PTEs
-       movl    #INTIOBASE,d1           | physical internal IO base
-       orl     #PG_RW+PG_CI+PG_V,d1    | create proto PTE
-Lipt4:
-       movl    d1,a0@+                 | load PTE
-       addl    #NBPG,d1                | increment page frame number
-       cmpl    a2,a0                   | done yet?
-       jcs     Lipt4                   | no, keep going
-/* record base KVA of IO spaces which are just before Sysmap */
-       RELOC(_Sysmap, a0)
-       movl    a0@,d0                  | Sysmap VA
-       subl    #EIOMAPSIZE*NBPG,d0     | back up size of external IO space
-       RELOC(_extiobase, a0)
-       movl    d0,a0@                  | and record
-       RELOC(_intiolimit, a0)
-       movl    d0,a0@                  | external base is also internal limit
-       subl    #IIOMAPSIZE*NBPG,d0     | back up size of internal IO space
-       RELOC(_intiobase, a0)
-       movl    d0,a0@                  | and record
-/* also record base of clock and MMU registers for fast access */
-       addl    #CLKBASE,d0
-       RELOC(_CLKbase, a0)
-       movl    d0,a0@
-       subl    #CLKBASE,d0
-       addl    #MMUBASE,d0
-       RELOC(_MMUbase, a0)
-       movl    d0,a0@
-
-/*
- * Setup page table for process 0.
- *
- * We set up page table access for the kernel via Umap and access to
- * the u-area itself via `u'.  First available UPAGES pages (start at
- * VA: d5, PA: a4) are used for the u-area.
- */
-       movl    a4,d0
-       movl    a4,a2
-       lea     a4@(-HIGHPAGES*4),a0    | u-area PTE base in Umap PT
-       lea     a0@(UPAGES*4),a1        | end of PTEs for u-area
-       movl    d0,d1                   | get base of u-area
-       andl    #PG_FRAME,d1            | mask to page frame number
-       orl     #PG_RW+PG_V,d1          | add valid and writable
-Liudot2:
-       movl    d1,a0@+                 | validate p_addr PTE
-       addl    #NBPG,d1                | to next page
-       cmpl    a1,a0                   | done yet?
-       jcs     Liudot2                 | no, keep going
-/* clear process 0 u-area */
-       addl    #NBPG*UPAGES,d0         | end of u-area
-Lclru1:
-       clrl    a2@+                    | clear
-       cmpl    d0,a2                   | done yet?
-       jcs     Lclru1                  | no, keep going
-       movl    a2,a4                   | save phys addr of first avail page
-       RELOC(_proc0paddr, a0)
-       movl    d5,a0@                  | save KVA of proc0 u-area
-       addl    #UPAGES*NBPG,d5         | increment virtual addr as well
-#endif
-
 /*
  * Prepare to enable MMU.
  * Since the kernel is not mapped logical == physical we must insure
 /*
  * Prepare to enable MMU.
  * Since the kernel is not mapped logical == physical we must insure
index 989057a..8e5cac7 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)pmap_bootstrap.c    7.1 (Berkeley) %G%
+ *     @(#)pmap_bootstrap.c    7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
  */
 #define BSDVM_COMPAT   1
 
  */
 #define BSDVM_COMPAT   1
 
-#ifdef BOOTDEBUG
-/*
- * Mirrors the actual PT setup done in locore but none of the data
- * structures set up here are actually used.  In this way you can boot
- * the system and compare what it would have done (pmap_bootstrap) with
- * what it should do (locore) when debugging.  See locore.s as well.
- */
-#define RELOC(v, t)    *((t*)((u_int)&(X##v) + firstpa))
-int XSysptsize = 2;
-int Xmmutype = MMU_68040;
-int Xectype = 0;
-int Xmachineid = HP_380;
-int Xprotection_codes[8];
-struct ste *XSysseg;
-struct pte *XSysptmap, *XSysmap;
-u_int XUmap, XCLKbase, XMMUbase;
-char *Xintiobase, *Xintiolimit, *Xextiobase, *Xproc0paddr;
-vm_offset_t Xavail_start, Xavail_end, Xvirtual_avail, Xvirtual_end;
-vm_size_t Xmem_size;
-int Xmaxmem, Xphysmem, Xpmap_aliasmask;
-struct pmap Xkernel_pmap_store;
-#else
 #define RELOC(v, t)    *((t*)((u_int)&(v) + firstpa))
 #define RELOC(v, t)    *((t*)((u_int)&(v) + firstpa))
-#endif
 
 extern char *etext;
 extern int Sysptsize;
 
 extern char *etext;
 extern int Sysptsize;
@@ -75,12 +52,6 @@ struct pte   *CMAP1, *CMAP2, *mmap;
 caddr_t                CADDR1, CADDR2, vmmap;
 struct pte     *msgbufmap;
 struct msgbuf  *msgbufp;
 caddr_t                CADDR1, CADDR2, vmmap;
 struct pte     *msgbufmap;
 struct msgbuf  *msgbufp;
-#ifdef BOOTDEBUG
-struct pte     *XCMAP1, *XCMAP2, *Xmmap;
-caddr_t                XCADDR1, XCADDR2, Xvmmap;
-struct pte     *Xmsgbufmap;
-struct msgbuf  *Xmsgbufp;
-#endif
 #endif
 
 /*
 #endif
 
 /*
@@ -552,109 +523,3 @@ pmap_showstuff()
                printf("%x ", protection_codes[i]);
        printf("\n");
 }
                printf("%x ", protection_codes[i]);
        printf("\n");
 }
-
-#ifdef BOOTDEBUG
-/*
- *     Bootstrap the system enough to run with virtual memory.
- *     Map the kernel's code and data, and allocate the system page table.
- *
- *     On the HP this is called after mapping has already been enabled
- *     and just syncs the pmap module with what has already been done.
- *     [We can't call it easily with mapping off since the kernel is not
- *     mapped with PA == VA, hence we would have to relocate every address
- *     from the linked base (virtual) address 0 to the actual (physical)
- *     address of 0xFFxxxxxx.]
- */
-void
-Opmap_bootstrap(firstaddr, loadaddr)
-       vm_offset_t firstaddr;
-       vm_offset_t loadaddr;
-{
-#if BSDVM_COMPAT
-       vm_offset_t va;
-       struct pte *pte;
-#endif
-
-       avail_start = firstaddr;
-       avail_end = maxmem << PGSHIFT;
-
-#if BSDVM_COMPAT
-       /* XXX: allow for msgbuf */
-       avail_end -= hp300_round_page(sizeof(struct msgbuf));
-#endif
-
-       mem_size = physmem << PGSHIFT;
-       virtual_avail = VM_MIN_KERNEL_ADDRESS + (firstaddr - loadaddr);
-       virtual_end = VM_MAX_KERNEL_ADDRESS;
-#if defined(DYNPGSIZE)
-       hppagesperpage = PAGE_SIZE / HP_PAGE_SIZE;
-#endif
-
-       /*
-        * Determine VA aliasing distance if any
-        */
-       if (ectype == EC_VIRT)
-               switch (machineid) {
-               case HP_320:
-                       pmap_aliasmask = 0x3fff;        /* 16k */
-                       break;
-               case HP_350:
-                       pmap_aliasmask = 0x7fff;        /* 32k */
-                       break;
-               }
-
-       /*
-        * Initialize protection array.
-        */
-       {
-               register int *kp, prot;
-
-               kp = protection_codes;
-               for (prot = 0; prot < 8; prot++) {
-                       switch (prot) {
-                       case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE:
-                               *kp++ = 0;
-                               break;
-                       case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE:
-                       case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE:
-                       case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE:
-                               *kp++ = PG_RO;
-                               break;
-                       case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE:
-                       case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE:
-                       case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE:
-                       case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE:
-                               *kp++ = PG_RW;
-                               break;
-                       }
-               }
-       }
-       /*
-        * Kernel page/segment table allocated in locore,
-        * just initialize pointers.
-        */
-       kernel_pmap->pm_stab = Sysseg;
-       kernel_pmap->pm_ptab = Sysmap;
-
-       simple_lock_init(&kernel_pmap->pm_lock);
-       kernel_pmap->pm_count = 1;
-
-#if BSDVM_COMPAT
-       /*
-        * Allocate all the submaps we need
-        */
-#define        SYSMAP(c, p, v, n)      \
-       v = (c)va; va += ((n)*HP_PAGE_SIZE); p = pte; pte += (n);
-
-       va = virtual_avail;
-       pte = &Sysmap[hp300_btop(va)];
-
-       SYSMAP(caddr_t          ,CMAP1          ,CADDR1    ,1           )
-       SYSMAP(caddr_t          ,CMAP2          ,CADDR2    ,1           )
-       SYSMAP(caddr_t          ,mmap           ,vmmap     ,1           )
-       SYSMAP(struct msgbuf *  ,msgbufmap      ,msgbufp   ,1           )
-       virtual_avail = va;
-#undef SYSMAP
-#endif
-}
-#endif