svn commit: r228254 - stable/8/sys/amd64/amd64

Alan Cox alc at FreeBSD.org
Sun Dec 4 06:55:28 UTC 2011


Author: alc
Date: Sun Dec  4 06:55:27 2011
New Revision: 228254
URL: http://svn.freebsd.org/changeset/base/228254

Log:
  MFC r214563,214576
    Add safety belts to pmap_demote_DMAP().

Modified:
  stable/8/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 06:09:02 2011	(r228253)
+++ stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 06:55:27 2011	(r228254)
@@ -4841,7 +4841,12 @@ pmap_demote_DMAP(vm_paddr_t base, vm_siz
 	vm_offset_t va;
 	boolean_t changed;
 
-	if (len < NBPDP) {
+	if (len == 0)
+		return;
+	KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2"));
+	KASSERT((base & (len - 1)) == 0,
+	    ("pmap_demote_DMAP: base is not a multiple of len"));
+	if (len < NBPDP && base < dmaplimit) {
 		va = PHYS_TO_DMAP(base);
 		changed = FALSE;
 		PMAP_LOCK(kernel_pmap);


More information about the svn-src-stable-8 mailing list