Author: neel
Date: Tue Aug 20 02:09:26 2013
New Revision: 254547
URL: http://svnweb.freebsd.org/changeset/base/254547

Log:
  Fix breakage caused by r254466 in minidumpsys().
  
  r254466 increased the KVA from 512GB to 2TB which requires 4 PDP pages as
  opposed to a single one before the change. This broke minidumpsys() since
  it assumed that the entire KVA could be addressed via a single PDP page.
  
  Fix this by obtaining the address of the PDP page from the PML4 entry
  associated with the KVA being dumped.
  
  Reported by:  pho
  Submitted by: kib
  Pointy hat to:        neel

Modified:
  head/sys/amd64/amd64/minidump_machdep.c

Modified: head/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- head/sys/amd64/amd64/minidump_machdep.c     Tue Aug 20 01:14:16 2013        
(r254546)
+++ head/sys/amd64/amd64/minidump_machdep.c     Tue Aug 20 02:09:26 2013        
(r254547)
@@ -221,8 +221,8 @@ minidumpsys(struct dumperinfo *di)
        vm_offset_t va;
        int error;
        uint64_t bits;
-       uint64_t *pdp, *pd, *pt, pa;
-       int i, j, k, n, bit;
+       uint64_t *pml4, *pdp, *pd, *pt, pa;
+       int i, ii, j, k, n, bit;
        int retry_count;
        struct minidumphdr mdhdr;
 
@@ -232,7 +232,6 @@ minidumpsys(struct dumperinfo *di)
        counter = 0;
        /* Walk page table pages, set bits in vm_page_dump */
        pmapsize = 0;
-       pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
        for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
            kernel_vm_end); ) {
                /*
@@ -240,6 +239,9 @@ minidumpsys(struct dumperinfo *di)
                 * page written corresponds to 1GB of space
                 */
                pmapsize += PAGE_SIZE;
+               ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1);
+               pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii;
+               pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME);
                i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1);
                if ((pdp[i] & PG_V) == 0) {
                        va += NBPDP;
@@ -364,9 +366,11 @@ minidumpsys(struct dumperinfo *di)
 
        /* Dump kernel page directory pages */
        bzero(fakepd, sizeof(fakepd));
-       pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
        for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
            kernel_vm_end); va += NBPDP) {
+               ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1);
+               pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii;
+               pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME);
                i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1);
 
                /* We always write a page, even if it is zero */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to