Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2013 02:09:26 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254547 - head/sys/amd64/amd64
Message-ID:  <201308200209.r7K29QHY061210@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308200209.r7K29QHY061210>