]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ppc/db_low_trace.c
xnu-1228.12.14.tar.gz
[apple/xnu.git] / osfmk / ppc / db_low_trace.c
index 32f8304073b857ea0e47936c60c3a6a9dd7dd125..e081b2643b6f3dcc38c9b281b207b452b7e8ef45 100644 (file)
@@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
@@ -20,7 +23,7 @@
  * Please see the License for the specific language governing rights and
  * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_FREE_COPYRIGHT@
@@ -80,8 +83,9 @@ db_addr_t     db_low_trace_prev = 0;
  *             If entaddr is omitted, it starts with the most current
  *             If entaddr = 0, it starts with the most current and does the whole table
  */
-void db_low_trace(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_low_trace(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif)
+{
        int             c, i;
        unsigned int tempx, cnt;
        unsigned int xTraceCurr, xTraceStart, xTraceEnd, cxltr;
@@ -125,10 +129,13 @@ void db_low_trace(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
                ReadReal((addr64_t)xxltr + 64, &(((unsigned int *)&xltr)[16]));         /* Get the second half */
                ReadReal((addr64_t)xxltr + 96, &(((unsigned int *)&xltr)[24]));         /* Get the second half */
                
-               db_printf("\n%s%08llX  %1X  %08X %08X - %04X\n", (xxltr != cxltr ? " " : "*"), 
+               db_printf("\n%s%08llX  %1X  %08X %08X - %04X", (xxltr != cxltr ? " " : "*"), 
                        xxltr,
-                       xltr.LTR_cpu, xltr.LTR_timeHi, xltr.LTR_timeLo, 
+                       (xltr.LTR_cpu & 0xFF), xltr.LTR_timeHi, xltr.LTR_timeLo, 
                        (xltr.LTR_excpt & 0x8000 ? 0xFFFF : xltr.LTR_excpt * 64));      /* Print the first line */
+
+               if(xltr.LTR_cpu & 0xFF00) db_printf(", sflgs = %02X\n", ((xltr.LTR_cpu >> 8) & 0xFF));
+               else db_printf("\n");
                        
                db_printf("              DAR/DSR/CR: %016llX %08X %08X\n", xltr.LTR_dar, xltr.LTR_dsisr, xltr.LTR_cr);
                
@@ -147,7 +154,6 @@ void db_low_trace(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
        
        }
        db_next = (db_expr_t)(xxltr);
-       return;
 }
 
 
@@ -157,8 +163,10 @@ void db_low_trace(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
  *             
  *             dl [entaddr]
  */
-void db_display_long(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_long(db_expr_t addr, __unused boolean_t have_addr,
+               db_expr_t count, char * modif)
+{
        int                             i;
 
        for(i=0; i<8; i++) {                                                                    /* Print 256 bytes */
@@ -198,7 +206,10 @@ unsigned char xtran[256] = {
  *             
  *             dc [entaddr]
  */
-void db_display_char(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
+void
+db_display_char(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char * modif)
+{
 
        int                             i, j, k;
        unsigned char xlt[256], *xaddr;
@@ -234,8 +245,10 @@ void db_display_char(db_expr_t addr, int have_addr, db_expr_t count, char * modi
  *             
  *             dr [entaddr]
  */
-void db_display_real(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_real(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char *modif)
+{
        int                             i;
        unsigned int xbuf[8];
 
@@ -257,13 +270,15 @@ unsigned int      dvspace = 0;
  *             
  *             dm vaddr [space] (defaults to last entered) 
  */
-void db_display_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_mappings(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+                   char *modif)
+{
        db_expr_t       xspace;
        pmap_t                  pmap;
        addr64_t                lnextva;
 
-       mapping         *mp;
+       mapping_t       *mp;
        
        if (db_expression(&xspace)) {                                                   /* Get the address space requested */
                if(xspace >= maxAdrSp) {
@@ -296,9 +311,7 @@ void db_display_mappings(db_expr_t addr, int have_addr, db_expr_t count, char *
 
        db_dumpmapping(mp);                                                                             /* Dump it all out */
 
-       return;                                                                                                 /* Tell them we did it */
-
-
+       /* Tell them we did it */
 }
 
 /*
@@ -307,8 +320,10 @@ void db_display_mappings(db_expr_t addr, int have_addr, db_expr_t count, char *
  *             
  *             dh vaddr [space] (defaults to last entered) 
  */
-void db_display_hash(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_hash(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char *modif)
+{
        db_expr_t               xspace;
        unsigned int    seg, vsid, ptegindex, htsize;
        pmap_t                  pmap;
@@ -318,7 +333,7 @@ void db_display_hash(db_expr_t addr, int have_addr, db_expr_t count, char * modi
 
        llva = (addr64_t)((unsigned int)addr);                                  /* Make sure we are 64-bit now */
        
-       s4bit = !((per_proc_info[0].pf.Available & pf64Bit) == 0);      /* Are we a big guy? */
+       s4bit = !((PerProcTable[0].ppe_vaddr->pf.Available & pf64Bit) == 0);    /* Are we a big guy? */
        if (db_expression(&xspace)) {                                                   /* Get the address space requested */
                if(xspace >= maxAdrSp) {
                        db_printf("requested address space (%llX) larger than max (%X)\n", xspace, maxAdrSp - 1);
@@ -345,9 +360,7 @@ void db_display_hash(db_expr_t addr, int have_addr, db_expr_t count, char * modi
        ptegindex = llva & (htsize - 1);                                                /* Get the index to the pteg and pca */
        db_dumppca(ptegindex);                                                                  /* dump the info */
        
-       return;                                                                                                 /* Tell them we did it */
-
-
+       /* Tell them we did it */
 }
 
 /*
@@ -355,8 +368,10 @@ void db_display_hash(db_expr_t addr, int have_addr, db_expr_t count, char * modi
  *
   *            dp
  */
-void db_display_pmap(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_pmap(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char *modif)
+{
        pmap_t                  pmap;
        int i;
        unsigned int v0, v1, st0, st1;
@@ -397,7 +412,6 @@ void db_display_pmap(db_expr_t addr, int have_addr, db_expr_t count, char * modi
                pmap = (pmap_t)pmap->pmap_link.next;                            /* Skip to the next */
                if(pmap == kernel_pmap) break;                                          /* We've wrapped, we're done */
        }
-       return;
 }
 
 
@@ -407,8 +421,10 @@ void db_display_pmap(db_expr_t addr, int have_addr, db_expr_t count, char * modi
  *             
  *             cp pmap
  */
-void db_check_pmaps(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_check_pmaps(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+              char *modif)
+{
        int                             i;
        unsigned int ret;
        uint64_t dumpa[32];
@@ -431,25 +447,22 @@ void db_check_pmaps(db_expr_t addr, int have_addr, db_expr_t count, char * modif
                pmap = (pmap_t)pmap->pmap_link.next;                            /* Skip to the next */
                if(pmap == kernel_pmap) break;                                          /* We've wrapped, we're done */
        }
-       
-       return;
-
 }
 
 
 /*
  *             Displays iokit junk
  *
-  *            dp
+  *            di
  */
 
 void db_piokjunk(void);
 
-void db_display_iokit(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_iokit(__unused db_expr_t addr, __unused boolean_t have_addr,
+                __unused db_expr_t count, __unused char *modif)
+{
        db_piokjunk();
-
-       return;
 }
 
 /*
@@ -466,7 +479,7 @@ void db_dumpmapping(struct mapping *mp) {                                   /* Dump out a mapping */
                pmapTrans[mp->mpSpace].pmapPAddr);                      /* Header */
        db_printf("              mpFlags: %08X\n", mp->mpFlags);                 
        db_printf("              mpSpace: %04X\n", mp->mpSpace);                 
-       db_printf("              mpBSize: %04X\n", mp->mpBSize);                 
+       db_printf("              mpBSize: %04X\n", mp->u.mpBSize);                 
        db_printf("                mpPte: %08X\n", mp->mpPte);                 
        db_printf("              mpPAddr: %08X\n", mp->mpPAddr);                 
        db_printf("              mpVAddr: %016llX\n", mp->mpVAddr);                 
@@ -476,8 +489,6 @@ void db_dumpmapping(struct mapping *mp) {                                   /* Dump out a mapping */
        for(i = 1; i < (mp->mpFlags & mpLists); i++) {                  /* Dump out secondary physical skip lists */
                db_printf("             mpList%02d: %016llX\n", i, mp->mpList[i - 1]);     
        }
-                   
-       return;
 }
 
 /*
@@ -492,7 +503,7 @@ void db_dumppca(unsigned int ptegindex) {
        int i, s4bit;
        unsigned long long llslot, llseg, llhash;
 
-       s4bit = !((per_proc_info[0].pf.Available & pf64Bit) == 0);      /* Are we a big guy? */
+       s4bit = !((PerProcTable[0].ppe_vaddr->pf.Available & pf64Bit) == 0);    /* Are we a big guy? */
 
        pteg = hash_table_base + (ptegindex << 6);                              /* Point to the PTEG */
        if(s4bit) pteg = hash_table_base + (ptegindex << 7);    /* Point to the PTEG */
@@ -536,7 +547,7 @@ void db_dumppca(unsigned int ptegindex) {
                        llslot = ((long long)xpteg[i] << 32) | (long long)xpteg[i + 1]; /* Make a long long version of this */ 
                        space = (llslot >> 12) & (maxAdrSp - 1);                /* Extract the space */
                        llhash = (unsigned long long)space | ((unsigned long long)space << maxAdrSpb) | ((unsigned long long)space << (2 * maxAdrSpb)); /* Get the hash */
-                       llhash = llhash & 0x0000001FFFFFFFFF;                   /* Make sure we stay within supported ranges */
+                       llhash = llhash & 0x0000001FFFFFFFFFULL;                /* Make sure we stay within supported ranges */
                        pva =  (unsigned long long)ptegindex ^ llhash;  /* Get part of the vaddr */
                        llseg = (llslot >> 12) ^ llhash;                                /* Get the segment number */
                        api = (llslot >> 7) & 0x1F;                                             /* Get the API */
@@ -544,8 +555,6 @@ void db_dumppca(unsigned int ptegindex) {
                        db_printf("va = %016llX\n", llva);
                }
        }
-
-       return;
 }
 
 
@@ -556,14 +565,17 @@ void db_dumppca(unsigned int ptegindex) {
  *             dv [entaddr] [space]
  *             address must be on 32-byte boundary.  It will be rounded down if not
  */
-void db_display_virtual(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
+void
+db_display_virtual(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+                  char *modif)
+{
 
        int                     i, size, lines, rlines;
        unsigned int    xbuf[8];
        db_expr_t       xspace;
        pmap_t          pmap;
 
-       mapping         *mp, *mpv;
+       mapping_t       *mp, *mpv;
        addr64_t        pa;
        ppnum_t         pnum;
 
@@ -605,7 +617,7 @@ void db_display_virtual(db_expr_t addr, int have_addr, db_expr_t count, char * m
                db_printf("%016llX   %08X %08X %08X %08X  %08X %08X %08X %08X\n", addr, /* Print a line */
                        xbuf[0], xbuf[1], xbuf[2], xbuf[3], 
                        xbuf[4], xbuf[5], xbuf[6], xbuf[7]);
-               addr = (db_expr_t)((unsigned int)addr + 0x00000020);    /* Point to next address */
+               addr = (db_expr_t)(addr + 0x00000020);                          /* Point to next address */
                pa = pa + 0x00000020;                                                           /* Point to next address */
        }
        db_next = addr;
@@ -646,67 +658,68 @@ void db_display_virtual(db_expr_t addr, int have_addr, db_expr_t count, char * m
 
 #define chainmax 32
 
-void db_display_save(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_save(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char *modif)
+{
        int                             i, j, totsaves, tottasks, taskact, chainsize, vmid, didvmhead;
-       processor_set_t pset = &default_pset;
        task_t                  task;
        thread_act_t    act;
-       savearea                *save;
+       struct savearea         *save;
        vmmCntrlTable   *CTable;
        
        tottasks = 0;
        totsaves = 0;
        
-       for(task = (task_t)pset->tasks.next; task != (task_t)&pset->tasks.next; task = (task_t)task->pset_tasks.next) { /* Go through the tasks */
+       for(task = (task_t)tasks.next; task != (task_t)&tasks.next; task = (task_t)task->tasks.next) {  /* Go through the tasks */
                taskact = 0;                                                            /* Reset activation count */
                db_printf("\nTask %4d @%08X:\n", tottasks, task);       /* Show where we're at */
                for(act = (thread_act_t)task->threads.next; act != (thread_act_t)&task->threads; act = (thread_act_t)act->task_threads.next) {  /* Go through activations */
                        db_printf("   Act %4d @%08X - p: %08X  current context: %08X\n",
-                                         taskact, act, act->mact.pcb, act->mact.curctx);                                       
+                                         taskact, act, act->machine.pcb, act->machine.curctx);                                 
                                        
-                       save = (savearea *)act->mact.pcb;               /* Set the start of the normal chain */
+                       save = (struct savearea *)act->machine.pcb;             /* Set the start of the normal chain */
                        chainsize = 0;
                        
                        db_printf("      General context - fp: %08X  fl: %08X  fc: %d  vp: %08X  vl: %08X  vp: %d\n",
-                               act->mact.facctx.FPUsave, act->mact.facctx.FPUlevel, act->mact.facctx.FPUcpu,           
-                               act->mact.facctx.VMXsave, act->mact.facctx.VMXlevel, act->mact.facctx.VMXcpu);
+                               act->machine.facctx.FPUsave, act->machine.facctx.FPUlevel, act->machine.facctx.FPUcpu,          
+                               act->machine.facctx.VMXsave, act->machine.facctx.VMXlevel, act->machine.facctx.VMXcpu);
                        
                        while(save) {                                                   /* Do them all */
                                totsaves++;                                                     /* Count savearea */
                                db_printf("         Norm %08X: %016llX %016llX - tot = %d\n", save, save->save_srr0, save->save_srr1, totsaves);
-                               save = (savearea *)save->save_hdr.save_prev;    /* Next one */
+                               save = (struct savearea *)save->save_hdr.save_prev;     /* Next one */
                                if(chainsize++ > chainmax) {            /* See if we might be in a loop */
                                        db_printf("         Chain terminated by count (%d) before %08X\n", chainmax, save);
                                        break;
                                }
                        }
                        
-                       save = (savearea *)act->mact.facctx.FPUsave;    /* Set the start of the floating point chain */
+                       save = (struct savearea *)act->machine.facctx.FPUsave;  /* Set the start of the floating point chain */
                        chainsize = 0;
                        while(save) {                                                   /* Do them all */
                                totsaves++;                                                     /* Count savearea */
                                db_printf("         FPU  %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
-                               save = (savearea *)save->save_hdr.save_prev;    /* Next one */
+                               save = (struct savearea *)save->save_hdr.save_prev;     /* Next one */
                                if(chainsize++ > chainmax) {            /* See if we might be in a loop */
                                        db_printf("         Chain terminated by count (%d) before %08X\n", chainmax, save);
                                        break;
                                }
                        }
                        
-                       save = (savearea *)act->mact.facctx.VMXsave;    /* Set the start of the floating point chain */
+                       save = (struct savearea *)act->machine.facctx.VMXsave;  /* Set the start of the floating point chain */
                        chainsize = 0;
                        while(save) {                                                   /* Do them all */
                                totsaves++;                                                     /* Count savearea */
                                db_printf("         Vec  %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
-                               save = (savearea *)save->save_hdr.save_prev;    /* Next one */
+                               save = (struct savearea *)save->save_hdr.save_prev;     /* Next one */
                                if(chainsize++ > chainmax) {            /* See if we might be in a loop */
                                        db_printf("         Chain terminated by count (%d) before %08X\n", chainmax, save);
                                        break;
                                }
                        }
                        
-                       if(CTable = act->mact.vmmControl) {             /* Are there virtual machines? */
+                       if(CTable = act->machine.vmmControl) {          /* Are there virtual machines? */
                                
                                for(vmid = 0; vmid < kVmmMaxContexts; vmid++) {
                                        
@@ -719,24 +732,24 @@ void db_display_save(db_expr_t addr, int have_addr, db_expr_t count, char * modi
                                                CTable->vmmc[vmid].vmmFacCtx.VMXsave, CTable->vmmc[vmid].vmmFacCtx.VMXlevel, CTable->vmmc[vmid].vmmFacCtx.VMXcpu
                                        );
                                        
-                                       save = (savearea *)CTable->vmmc[vmid].vmmFacCtx.FPUsave;        /* Set the start of the floating point chain */
+                                       save = (struct savearea *)CTable->vmmc[vmid].vmmFacCtx.FPUsave;         /* Set the start of the floating point chain */
                                        chainsize = 0;
                                        while(save) {                                           /* Do them all */
                                                totsaves++;                                             /* Count savearea */
                                                db_printf("         FPU  %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
-                                               save = (savearea *)save->save_hdr.save_prev;    /* Next one */
+                                               save = (struct savearea *)save->save_hdr.save_prev;     /* Next one */
                                                if(chainsize++ > chainmax) {    /* See if we might be in a loop */
                                                        db_printf("         Chain terminated by count (%d) before %08X\n", chainmax, save);
                                                        break;
                                                }
                                        }
                                        
-                                       save = (savearea *)CTable->vmmc[vmid].vmmFacCtx.VMXsave;        /* Set the start of the floating point chain */
+                                       save = (struct savearea *)CTable->vmmc[vmid].vmmFacCtx.VMXsave;         /* Set the start of the floating point chain */
                                        chainsize = 0;
                                        while(save) {                                           /* Do them all */
                                                totsaves++;                                             /* Count savearea */
                                                db_printf("         Vec  %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
-                                               save = (savearea *)save->save_hdr.save_prev;    /* Next one */
+                                               save = (struct savearea *)save->save_hdr.save_prev;     /* Next one */
                                                if(chainsize++ > chainmax) {    /* See if we might be in a loop */
                                                        db_printf("         Chain terminated by count (%d) before %08X\n", chainmax, save);
                                                        break;
@@ -750,7 +763,6 @@ void db_display_save(db_expr_t addr, int have_addr, db_expr_t count, char * modi
        }
        
        db_printf("Total saveareas accounted for: %d\n", totsaves);
-       return;
 }
 
 /*
@@ -762,39 +774,57 @@ void db_display_save(db_expr_t addr, int have_addr, db_expr_t count, char * modi
 
 extern unsigned int dbfloats[33][2];
 extern unsigned int dbvecs[33][4];
-extern unsigned int dbspecrs[80];
-
-void db_display_xregs(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
+extern unsigned int dbspecrs[336];
 
+void
+db_display_xregs(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+                char *modif)
+{
        int                             i, j, pents;
 
        stSpecrs(dbspecrs);                                                                             /* Save special registers */
-       db_printf("PIR:    %08X\n", dbspecrs[0]);
-       db_printf("PVR:    %08X\n", dbspecrs[1]);
-       db_printf("SDR1:   %08X\n", dbspecrs[22]);
-       db_printf("HID0:   %08X\n", dbspecrs[39]);
-       db_printf("HID1:   %08X\n", dbspecrs[40]);
-       db_printf("L2CR:   %08X\n", dbspecrs[41]);
-       db_printf("MSSCR0: %08X\n", dbspecrs[42]);
-       db_printf("MSSCR1: %08X\n", dbspecrs[43]);
-       db_printf("THRM1:  %08X\n", dbspecrs[44]);
-       db_printf("THRM2:  %08X\n", dbspecrs[45]);
-       db_printf("THRM3:  %08X\n", dbspecrs[46]);
-       db_printf("ICTC:   %08X\n", dbspecrs[47]);
-       db_printf("L2CR2:  %08X\n", dbspecrs[48]);
-       db_printf("DABR:   %08X\n", dbspecrs[49]);
-       db_printf("\n");
-
-       db_printf("DBAT: %08X %08X %08X %08X\n", dbspecrs[2], dbspecrs[3], dbspecrs[4], dbspecrs[5]);
-       db_printf("      %08X %08X %08X %08X\n", dbspecrs[6], dbspecrs[7], dbspecrs[8], dbspecrs[9]);
-       db_printf("IBAT: %08X %08X %08X %08X\n", dbspecrs[10], dbspecrs[11], dbspecrs[12], dbspecrs[13]);
-       db_printf("      %08X %08X %08X %08X\n", dbspecrs[14], dbspecrs[15], dbspecrs[16], dbspecrs[17]);
-       db_printf("SPRG: %08X %08X %08X %08X\n", dbspecrs[18], dbspecrs[19], dbspecrs[20], dbspecrs[21]);
-       db_printf("\n");
-       for(i = 0; i < 16; i += 8) {                                                    /* Print 8 at a time */
-               db_printf("SR%02d: %08X %08X %08X %08X %08X %08X %08X %08X\n", i,
-                       dbspecrs[23+i], dbspecrs[24+i], dbspecrs[25+i], dbspecrs[26+i], 
-                       dbspecrs[27+i], dbspecrs[28+i], dbspecrs[29+i], dbspecrs[30+i]); 
+       if(PerProcTable[0].ppe_vaddr->pf.Available & pf64Bit) {
+               db_printf("PIR:    %08X\n", dbspecrs[0]);
+               db_printf("PVR:    %08X\n", dbspecrs[1]);
+               db_printf("SDR1:   %08X.%08X\n", dbspecrs[26], dbspecrs[27]);
+               db_printf("HID0:   %08X.%08X\n", dbspecrs[28], dbspecrs[29]);
+               db_printf("HID1:   %08X.%08X\n", dbspecrs[30], dbspecrs[31]);
+               db_printf("HID4:   %08X.%08X\n", dbspecrs[32], dbspecrs[33]);
+               db_printf("HID5:   %08X.%08X\n", dbspecrs[34], dbspecrs[35]);
+               db_printf("SPRG0:  %08X.%08X %08X.%08X\n", dbspecrs[18], dbspecrs[19], dbspecrs[20], dbspecrs[21]);
+               db_printf("SPRG2:  %08X.%08X %08X.%08X\n", dbspecrs[22], dbspecrs[23], dbspecrs[24], dbspecrs[25]);
+               db_printf("\n");
+               for(i = 0; i < (64 * 4); i += 4) {
+                       db_printf("SLB %02d: %08X.%08X %08X.%08X\n", i / 4, dbspecrs[80 + i], dbspecrs[81 + i], dbspecrs[82 + i], dbspecrs[83 + i]);
+               }
+       }
+       else {  
+               db_printf("PIR:    %08X\n", dbspecrs[0]);
+               db_printf("PVR:    %08X\n", dbspecrs[1]);
+               db_printf("SDR1:   %08X\n", dbspecrs[22]);
+               db_printf("HID0:   %08X\n", dbspecrs[39]);
+               db_printf("HID1:   %08X\n", dbspecrs[40]);
+               db_printf("L2CR:   %08X\n", dbspecrs[41]);
+               db_printf("MSSCR0: %08X\n", dbspecrs[42]);
+               db_printf("MSSCR1: %08X\n", dbspecrs[43]);
+               db_printf("THRM1:  %08X\n", dbspecrs[44]);
+               db_printf("THRM2:  %08X\n", dbspecrs[45]);
+               db_printf("THRM3:  %08X\n", dbspecrs[46]);
+               db_printf("ICTC:   %08X\n", dbspecrs[47]);
+               db_printf("L2CR2:  %08X\n", dbspecrs[48]);
+               db_printf("DABR:   %08X\n", dbspecrs[49]);
+       
+               db_printf("DBAT: %08X %08X %08X %08X\n", dbspecrs[2], dbspecrs[3], dbspecrs[4], dbspecrs[5]);
+               db_printf("      %08X %08X %08X %08X\n", dbspecrs[6], dbspecrs[7], dbspecrs[8], dbspecrs[9]);
+               db_printf("IBAT: %08X %08X %08X %08X\n", dbspecrs[10], dbspecrs[11], dbspecrs[12], dbspecrs[13]);
+               db_printf("      %08X %08X %08X %08X\n", dbspecrs[14], dbspecrs[15], dbspecrs[16], dbspecrs[17]);
+               db_printf("SPRG: %08X %08X %08X %08X\n", dbspecrs[18], dbspecrs[19], dbspecrs[20], dbspecrs[21]);
+               db_printf("\n");
+               for(i = 0; i < 16; i += 8) {                                            /* Print 8 at a time */
+                       db_printf("SR%02d: %08X %08X %08X %08X %08X %08X %08X %08X\n", i,
+                               dbspecrs[23+i], dbspecrs[24+i], dbspecrs[25+i], dbspecrs[26+i], 
+                               dbspecrs[27+i], dbspecrs[28+i], dbspecrs[29+i], dbspecrs[30+i]); 
+               }
        }
        
        db_printf("\n");
@@ -818,9 +848,7 @@ void db_display_xregs(db_expr_t addr, int have_addr, db_expr_t count, char * mod
        }
        db_printf("VCR: %08X %08X %08X %08X\n", dbvecs[32][0], dbvecs[32][1], dbvecs[32][2], dbvecs[32][3]);    /* Print VSCR */
 
-       return;                                                                                                 /* Tell them we did it */
-
-
+       /* Tell them we did it */
 }
 
 /*
@@ -828,18 +856,20 @@ void db_display_xregs(db_expr_t addr, int have_addr, db_expr_t count, char * mod
  *
   *            cm
  */
-void db_check_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_check_mappings(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+                 char *modif)
+{
        addr64_t  pteg, pca, llva, lnextva;     
        unsigned int xpteg[32], xpca[8], space, hash, pva, seg, api, va, free, free2, xauto, PTEGcnt, wimgkk, wimgxx, slotoff;
        int i, j, fnderr, slot, slot2, k, s4bit;
        pmap_t pmap;
-       mapping  *mp;
+       mapping_t *mp;
        ppnum_t ppn, pa, aoff;
        unsigned long long llslot, llseg, llhash;
        
        s4bit = 0;                                                                                              /* Assume dinky? */
-       if(per_proc_info[0].pf.Available & pf64Bit) s4bit = 1;  /* Are we a big guy? */
+       if(PerProcTable[0].ppe_vaddr->pf.Available & pf64Bit) s4bit = 1;        /* Are we a big guy? */
        
        PTEGcnt = hash_table_size / 64;                                                 /* Get the number of PTEGS */
        if(s4bit) PTEGcnt = PTEGcnt / 2;                                                /* PTEGs are twice as big */    
@@ -921,7 +951,7 @@ void db_check_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * mo
                                                llslot = ((long long)xpteg[slot] << 32) | (long long)xpteg[slot + 1];   /* Make a long long version of this */ 
                                                space = (llslot >> 12) & (maxAdrSp - 1);        /* Extract the space */
                                                llhash = (unsigned long long)space | ((unsigned long long)space << maxAdrSpb) | ((unsigned long long)space << (2 * maxAdrSpb)); /* Get the hash */
-                                               llhash = llhash & 0x0000001FFFFFFFFF;   /* Make sure we stay within supported ranges */
+                                               llhash = llhash & 0x0000001FFFFFFFFFULL;        /* Make sure we stay within supported ranges */
                                                pva =  i ^ llhash;                                      /* Get part of the vaddr */
                                                llseg = ((llslot >> 12) ^ llhash);      /* Get the segment number */
                                                api = (llslot >> 7) & 0x1F;                     /* Get the API */
@@ -937,57 +967,63 @@ void db_check_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * mo
                                                fnderr = 1;
                                                goto dcmout;
                                        }
-                               
-                                       mp = hw_find_map(pmap, llva, &lnextva);         /* Try to find the mapping for this address */
-//                                     db_printf("%08X - %017llX\n", mp, llva);
-                                       if((unsigned int)mp == mapRtBadLk) {    /* Did we lock up ok? */
-                                               db_printf("Timeout locking mapping for for virtual address %016ll8X, slot = %d\n", llva, j);    
-                                               return;
-                                       }
-                                       
-                                       if(!mp) {                                                               /* Did we find one? */
-                                               db_printf("Not mapped, slot = %d, va = %08X\n", j, (unsigned int)llva); 
-                                               fnderr = 1;
-                                               goto dcmout;
-                                       }
-                                       
-                                       if((mp->mpFlags & 0xFF000000) > 0x01000000) {   /* Is busy count too high? */
-                                               db_printf("Busy count too high, slot = %d\n", j);
-                                               fnderr = 1;
-                                       }
-                                       
-                                       if(mp->mpFlags & mpBlock) {                             /* Is this a block map? */
-                                               if(!(xpca[0] & xauto)) {                                /* Is it marked as such? */
-                                                       db_printf("mapping marked as block, PCA is not, slot = %d\n", j);
-                                                       fnderr = 1;
+
+                                       if (pmap->pmapFlags & pmapVMgsaa) {
+                                               unsigned int ret;
+                                               mapping_t mpcopy;
+                                               ret = hw_find_map_gv(pmap, llva, &mpcopy);
+                                       } else {
+                                               mp = hw_find_map(pmap, llva, &lnextva);         /* Try to find the mapping for this address */
+       //                                      db_printf("%08X - %017llX\n", mp, llva);
+                                               if((unsigned int)mp == mapRtBadLk) {    /* Did we lock up ok? */
+                                                       db_printf("Timeout locking mapping for for virtual address %016ll8X, slot = %d\n", llva, j);    
+                                                       return;
                                                }
-                                       }
-                                       else {                                                                  /* Is a block */
-                                               if(xpca[0] & xauto) {                           /* Is it marked as such? */
-                                                       db_printf("mapping not marked as block, PCA is, slot = %d\n", j);
+                                               
+                                               if(!mp) {                                                               /* Did we find one? */
+                                                       db_printf("Not mapped, slot = %d, va = %08X\n", j, (unsigned int)llva); 
                                                        fnderr = 1;
+                                                       goto dcmout;
                                                }
-                                               if(mp->mpPte != slotoff) {                      /* See if mapping PTEG offset is us */
-                                                       db_printf("mapping does not point to PTE, slot = %d\n", j);
+                                               
+                                               if((mp->mpFlags & 0xFF000000) > 0x01000000) {   /* Is busy count too high? */
+                                                       db_printf("Busy count too high, slot = %d\n", j);
                                                        fnderr = 1;
                                                }
-                                       }
-                               
-                                       wimgkk = (unsigned int)mp->mpVAddr;             /* Get last half of vaddr where keys, etc are */
-                                       wimgkk = (wimgkk ^ wimgxx) & 0x7F;              /* XOR to find differences from PTE */
-                                       if(wimgkk) {                                                    /* See if key in PTE is what we want */
-                                               db_printf("key or WIMG does not match, slot = %d\n", j);
-                                               fnderr = 1;
-                                       }
+                                               
+                                               if((mp->mpFlags & mpType) == mpBlock) {         /* Is this a block map? */
+                                                       if(!(xpca[0] & xauto)) {                                /* Is it marked as such? */
+                                                               db_printf("mapping marked as block, PCA is not, slot = %d\n", j);
+                                                               fnderr = 1;
+                                                       }
+                                               }
+                                               else {                                                                  /* Is a block */
+                                                       if(xpca[0] & xauto) {                           /* Is it marked as such? */
+                                                               db_printf("mapping not marked as block, PCA is, slot = %d\n", j);
+                                                               fnderr = 1;
+                                                       }
+                                                       if(mp->mpPte != slotoff) {                      /* See if mapping PTEG offset is us */
+                                                               db_printf("mapping does not point to PTE, slot = %d\n", j);
+                                                               fnderr = 1;
+                                                       }
+                                               }
                                        
-                                       aoff = (ppnum_t)((llva >> 12) - (mp->mpVAddr >> 12));   /* Get the offset from vaddr */
-                                       pa = aoff + mp->mpPAddr;                                /* Get the physical page number we expect */
-                                       if(pa != ppn) {                                                 /* Is physical address expected? */
-                                               db_printf("Physical address does not match, slot = %d\n", j);
-                                               fnderr = 1;
+                                               wimgkk = (unsigned int)mp->mpVAddr;             /* Get last half of vaddr where keys, etc are */
+                                               wimgkk = (wimgkk ^ wimgxx) & 0x7F;              /* XOR to find differences from PTE */
+                                               if(wimgkk) {                                                    /* See if key in PTE is what we want */
+                                                       db_printf("key or WIMG does not match, slot = %d\n", j);
+                                                       fnderr = 1;
+                                               }
+                                               
+                                               aoff = (ppnum_t)((llva >> 12) - (mp->mpVAddr >> 12));   /* Get the offset from vaddr */
+                                               pa = aoff + mp->mpPAddr;                                /* Get the physical page number we expect */
+                                               if(pa != ppn) {                                                 /* Is physical address expected? */
+                                                       db_printf("Physical address does not match, slot = %d\n", j);
+                                                       fnderr = 1;
+                                               }
+               
+                                               mapping_drop_busy(mp);                                  /* We're done with the mapping */
                                        }
-       
-                                       mapping_drop_busy(mp);                                  /* We're done with the mapping */
                                }
                                
                        }
@@ -1005,8 +1041,6 @@ dcmout:
 
 
        }
-
-       return;
 }
 
 /*
@@ -1014,8 +1048,10 @@ dcmout:
  *
   *            dp
  */
-void db_display_kmod(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_display_kmod(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+               char *modif)
+{
        kmod_info_t     *kmd;
        unsigned int strt, end;
        
@@ -1030,8 +1066,6 @@ void db_display_kmod(db_expr_t addr, int have_addr, db_expr_t count, char * modi
                        kmd->name, kmd->version);
                kmd = kmd->next;                                /* Step to it */
        }
-
-       return;
 }
 
 /*
@@ -1041,8 +1075,9 @@ void db_display_kmod(db_expr_t addr, int have_addr, db_expr_t count, char * modi
  */
 unsigned char xxgpo[36] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-void db_gsnoop(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
-
+void
+db_gsnoop(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif)
+{
        int i, j;
        unsigned char *gp, gpn[36];
 #define ngpr 34
@@ -1063,8 +1098,6 @@ void db_gsnoop(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
        db_printf("\n");
        
        for(i = 0; i < ngpr; i++) xxgpo[i] = gpn[i];    /* Save 'em */
-
-       return;
 }