mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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.
This commit is contained in:
parent
a9ec9e9b03
commit
fbbf115e35
3 changed files with 22 additions and 24 deletions
|
|
@ -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? */
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue