Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with

different variants of the hole for different CPU types)
This commit is contained in:
martin 2013-09-11 18:27:44 +00:00
parent d31af930cb
commit 4073f8732b
2 changed files with 29 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.55 2011/10/06 06:55:34 mrg Exp $ */
/* $NetBSD: pmap.h,v 1.56 2013/09/11 18:27:44 martin Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -90,6 +90,11 @@
#ifndef _LOCORE
#ifdef _LP64
int sparc64_mmap_range_test(vaddr_t, vaddr_t);
#define MD_MMAP_RANGE_TEST(MINVA, MAXVA) sparc64_mmap_range_test(MINVA, MAXVA)
#endif
/*
* Support for big page sizes. This maps the page size to the
* page bits.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.280 2013/01/25 17:12:33 hannken Exp $ */
/* $NetBSD: pmap.c,v 1.281 2013/09/11 18:27:44 martin Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.280 2013/01/25 17:12:33 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.281 2013/09/11 18:27:44 martin Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@ -1839,6 +1839,11 @@ pmap_enter(struct pmap *pm, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
retry:
i = pseg_set(pm, va, tte.data, ptp);
if (i == -2) {
if (flags & PMAP_CANFAIL)
return (ENOMEM);
panic("pmap_enter: invalid VA (inside hole)");
}
if (i & 4) {
/* ptp used as L3 */
KASSERT(ptp != 0);
@ -3735,3 +3740,19 @@ pmap_zero_page(paddr_t pa)
dcache_flush_page_all(pa);
pmap_zero_page_phys(pa);
}
#ifdef _LP64
int
sparc64_mmap_range_test(vaddr_t addr, vaddr_t eaddr)
{
const vaddr_t hole_start = 0x000007ffffffffff;
const vaddr_t hole_end = 0xfffff80000000000;
if (addr >= hole_end)
return 0;
if (eaddr <= hole_start)
return 0;
return EINVAL;
}
#endif