Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jun 2005 20:30:05 GMT
From:      Paul Saab <ps@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79108 for review
Message-ID:  <200506282030.j5SKU57a001347@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79108

Change 79108 by ps@butter.corp on 2005/06/28 20:29:41

	Support 2MB pages in PAE mode.
	Submitted by:	peter

Affected files ...

.. //depot/projects/hammer/lib/libkvm/kvm_i386.c#6 edit

Differences ...

==== //depot/projects/hammer/lib/libkvm/kvm_i386.c#6 (text+ko) ====

@@ -75,7 +75,8 @@
 
 #define	PG_FRAME_PAE	(~((uint64_t)PAGE_MASK))
 #define	PDRSHIFT_PAE	21
-#define NPTEPG_PAE	(PAGE_SIZE/sizeof(uint64_t))
+#define	NPTEPG_PAE	(PAGE_SIZE/sizeof(uint64_t))
+#define	NBPDR_PAE	(1<<PDRSHIFT_PAE)
 
 struct vmstate {
 	void		*mmapbase;
@@ -360,21 +361,21 @@
 
 	if ((u_long)pde & PG_PS) {
 	      /*
-	       * No second-level page table; ptd describes one 4MB page.
+	       * No second-level page table; ptd describes one 2MB page.
 	       * (We assume that the kernel wouldn't set PG_PS without enabling
 	       * it cr0, and that the kernel doesn't support 36-bit physical
 	       * addresses).
 	       */
-#define	PAGE4M_MASK	(NBPDR - 1)
-#define	PG_FRAME4M	(~PAGE4M_MASK)
-		pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
+#define	PAGE2M_MASK	(NBPDR_PAE - 1)
+#define	PG_FRAME2M	(~PAGE2M_MASK)
+		pde_pa = ((u_long)pde & PG_FRAME2M) + (va & PAGE2M_MASK);
 		s = _kvm_pa2off(kd, pde_pa, &ofs);
 		if (s <= sizeof pde) {
 			_kvm_syserr(kd, kd->program, "_kvm_vatop_pae: pde_pa not found");
 			goto invalid;
 		}
 		*pa = ofs;
-		return (NBPDR - (va & PAGE4M_MASK));
+		return (NBPDR_PAE - (va & PAGE2M_MASK));
 	}
 
 	pteindex = (va >> PAGE_SHIFT) & (NPTEPG_PAE-1);



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