summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-12-08 21:48:27 +0000
committeralc <alc@FreeBSD.org>2007-12-08 21:48:27 +0000
commit785a20bb5fff39f5100fc5a4f623d5bb6f56c3bb (patch)
treedf8ffeb3cf2242acb105963fc1207e6ea57f5cf0 /sys
parent23d5cf544319f342ce0b8b5cfe762cea59ead3c3 (diff)
downloadFreeBSD-src-785a20bb5fff39f5100fc5a4f623d5bb6f56c3bb.zip
FreeBSD-src-785a20bb5fff39f5100fc5a4f623d5bb6f56c3bb.tar.gz
Use 1GB virtual pages to implement the direct map on architectures that
support this feature. Wrap a nearby line that is too long. MFC after: 6 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/pmap.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 18aa5c5..40c710c 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -422,7 +422,8 @@ create_pagetables(vm_paddr_t *firstaddr)
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
ndmpdp = 4;
DMPDPphys = allocpages(firstaddr, NDMPML4E);
- DMPDphys = allocpages(firstaddr, ndmpdp);
+ if ((amd_feature & AMDID_PAGE1GB) == 0)
+ DMPDphys = allocpages(firstaddr, ndmpdp);
dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT;
/* Fill in the underlying page table pages */
@@ -448,21 +449,31 @@ create_pagetables(vm_paddr_t *firstaddr)
/* And connect up the PD to the PDP */
for (i = 0; i < NKPDPE; i++) {
- ((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys + (i << PAGE_SHIFT);
+ ((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys +
+ (i << PAGE_SHIFT);
((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U;
}
-
- /* Now set up the direct map space using 2MB pages */
- for (i = 0; i < NPDEPG * ndmpdp; i++) {
- ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT;
- ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G;
- }
-
- /* And the direct map space's PDP */
- for (i = 0; i < ndmpdp; i++) {
- ((pdp_entry_t *)DMPDPphys)[i] = DMPDphys + (i << PAGE_SHIFT);
- ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_U;
+ /* Now set up the direct map space using either 2MB or 1GB pages */
+ if ((amd_feature & AMDID_PAGE1GB) == 0) {
+ for (i = 0; i < NPDEPG * ndmpdp; i++) {
+ ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT;
+ ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS |
+ PG_G;
+ }
+ /* And the direct map space's PDP */
+ for (i = 0; i < ndmpdp; i++) {
+ ((pdp_entry_t *)DMPDPphys)[i] = DMPDphys +
+ (i << PAGE_SHIFT);
+ ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_U;
+ }
+ } else {
+ for (i = 0; i < ndmpdp; i++) {
+ ((pdp_entry_t *)DMPDPphys)[i] =
+ (vm_paddr_t)i << PDPSHIFT;
+ ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS |
+ PG_G;
+ }
}
/* And recursively map PML4 to itself in order to get PTmap */
OpenPOWER on IntegriCloud