Module Name:    src
Committed By:   martin
Date:           Wed Sep 11 18:27:44 UTC 2013

Modified Files:
        src/sys/arch/sparc64/include: pmap.h
        src/sys/arch/sparc64/sparc64: pmap.c

Log Message:
Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with
different variants of the hole for different CPU types)


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sparc64/include/pmap.h
cvs rdiff -u -r1.280 -r1.281 src/sys/arch/sparc64/sparc64/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/include/pmap.h
diff -u src/sys/arch/sparc64/include/pmap.h:1.55 src/sys/arch/sparc64/include/pmap.h:1.56
--- src/sys/arch/sparc64/include/pmap.h:1.55	Thu Oct  6 06:55:34 2011
+++ src/sys/arch/sparc64/include/pmap.h	Wed Sep 11 18:27:44 2013
@@ -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.

Index: src/sys/arch/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.280 src/sys/arch/sparc64/sparc64/pmap.c:1.281
--- src/sys/arch/sparc64/sparc64/pmap.c:1.280	Fri Jan 25 17:12:33 2013
+++ src/sys/arch/sparc64/sparc64/pmap.c	Wed Sep 11 18:27:44 2013
@@ -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, 
 
  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

Reply via email to