summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2010-07-29 20:02:56 +0000
committerjchandra <jchandra@FreeBSD.org>2010-07-29 20:02:56 +0000
commit70045f9c10ff50209967b50cfdd2a873310c4ca4 (patch)
tree404b0dc2b2b8aa0ab8adefcaec40bf1b5083ab05 /sys
parentad06138c4b40668c4e25503b887022134fd37006 (diff)
downloadFreeBSD-src-70045f9c10ff50209967b50cfdd2a873310c4ca4.zip
FreeBSD-src-70045f9c10ff50209967b50cfdd2a873310c4ca4.tar.gz
Prepare for 3 level page tables for MIPS.
- Move page table second level shift and mask to param.h - rename SEGOFSET to SEGMASK - fix values for 64 bit maximum kernel and user addresses.
Diffstat (limited to 'sys')
-rw-r--r--sys/mips/include/param.h5
-rw-r--r--sys/mips/include/vmparam.h27
-rw-r--r--sys/mips/mips/pmap.c14
3 files changed, 22 insertions, 24 deletions
diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h
index 7eae10a..98be25a 100644
--- a/sys/mips/include/param.h
+++ b/sys/mips/include/param.h
@@ -103,9 +103,14 @@
#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
#define PAGE_MASK (PAGE_SIZE-1)
+
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+#define SEGSHIFT 22 /* LOG2(NBSEG) */
+#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
+#define SEGMASK (NBSEG-1) /* byte offset into segment */
+
#define MAXPAGESIZES 1 /* maximum number of supported page sizes */
#define BLKDEV_IOSIZE 2048 /* xxx: Why is this 1/2 page? */
diff --git a/sys/mips/include/vmparam.h b/sys/mips/include/vmparam.h
index 385d309..8928aef 100644
--- a/sys/mips/include/vmparam.h
+++ b/sys/mips/include/vmparam.h
@@ -51,12 +51,6 @@
* is the top (end) of the user stack.
*/
#define USRTEXT (1*PAGE_SIZE)
-/*
- * USRSTACK needs to start a little below 0x8000000 because the R8000
- * and some QED CPUs perform some virtual address checks before the
- * offset is calculated.
- */
-#define USRSTACK 0x7ffff000 /* Start of user stack */
/*
* Virtual memory related constants, all in bytes
@@ -103,20 +97,23 @@
#define VM_MAX_MMAP_ADDR VM_MAXUSER_ADDRESS
#if defined(__mips_n64)
-#define VM_MAXUSER_ADDRESS (VM_MINUSER_ADDRESS + (NPDEPG * NPTEPG * PAGE_SIZE))
+#define VM_MAXUSER_ADDRESS (VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xc000000000000000)
-#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + (NPDEPG * NPTEPG * PAGE_SIZE))
+#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + (NPDEPG * NBSEG))
#else
#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x80000000)
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xC0000000)
#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFC000)
#endif
-#if 0
-#define KERNBASE (VM_MIN_KERNEL_ADDRESS)
-#else
-#define KERNBASE ((vm_offset_t)(intptr_t)(int32_t)0x80000000)
-#endif
+#define KERNBASE ((vm_offset_t)(intptr_t)(int32_t)0x80000000)
+/*
+ * USRSTACK needs to start a little below 0x8000000 because the R8000
+ * and some QED CPUs perform some virtual address checks before the
+ * offset is calculated.
+ */
+#define USRSTACK (VM_MAXUSER_ADDRESS - PAGE_SIZE)
+
/*
* Only one memory domain.
*/
@@ -205,8 +202,4 @@
*/
#define VM_NFREEORDER 9
-#define SEGSHIFT 22 /* LOG2(NBSEG) */
-#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
-#define SEGOFSET (NBSEG-1) /* byte offset into segment */
-
#endif /* !_MACHINE_VMPARAM_H_ */
diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c
index 9f5616e..59512b3 100644
--- a/sys/mips/mips/pmap.c
+++ b/sys/mips/mips/pmap.c
@@ -133,7 +133,7 @@ __FBSDID("$FreeBSD$");
#else
#define NUSERPGTBLS (pmap_segshift(VM_MAXUSER_ADDRESS))
#endif
-#define mips_segtrunc(va) ((va) & ~SEGOFSET)
+#define mips_segtrunc(va) ((va) & ~SEGMASK)
#define is_kernel_pmap(x) ((x) == kernel_pmap)
/*
@@ -2902,14 +2902,14 @@ pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
return;
if (object != NULL && (object->flags & OBJ_COLORED) != 0)
offset += ptoa(object->pg_color);
- superpage_offset = offset & SEGOFSET;
- if (size - ((NBSEG - superpage_offset) & SEGOFSET) < NBSEG ||
- (*addr & SEGOFSET) == superpage_offset)
+ superpage_offset = offset & SEGMASK;
+ if (size - ((NBSEG - superpage_offset) & SEGMASK) < NBSEG ||
+ (*addr & SEGMASK) == superpage_offset)
return;
- if ((*addr & SEGOFSET) < superpage_offset)
- *addr = (*addr & ~SEGOFSET) + superpage_offset;
+ if ((*addr & SEGMASK) < superpage_offset)
+ *addr = (*addr & ~SEGMASK) + superpage_offset;
else
- *addr = ((*addr + SEGOFSET) & ~SEGOFSET) + superpage_offset;
+ *addr = ((*addr + SEGMASK) & ~SEGMASK) + superpage_offset;
}
/*
OpenPOWER on IntegriCloud