Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2010 03:49:18 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204296 - head/sys/powerpc/aim
Message-ID:  <201002250349.o1P3nIYS094166@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Thu Feb 25 03:49:17 2010
New Revision: 204296
URL: http://svn.freebsd.org/changeset/base/204296

Log:
  Provide an implementation of pmap_dev_direct_mapped() on OEA64. This is
  required in order to be able to mmap the running kernel, which is turn
  required to avoid fstat returning gibberish.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Thu Feb 25 00:46:51 2010	(r204295)
+++ head/sys/powerpc/aim/mmu_oea64.c	Thu Feb 25 03:49:17 2010	(r204296)
@@ -2410,7 +2410,22 @@ moea64_clear_bit(vm_page_t m, u_int64_t 
 boolean_t
 moea64_dev_direct_mapped(mmu_t mmu, vm_offset_t pa, vm_size_t size)
 {
-	return (EFAULT);
+	struct pvo_entry *pvo;
+	vm_offset_t ppa;
+	int error = 0;
+
+	PMAP_LOCK(kernel_pmap);
+	for (ppa = pa & ~ADDR_POFF; ppa < pa + size; ppa += PAGE_SIZE) {
+		pvo = moea64_pvo_find_va(kernel_pmap, ppa, NULL);
+		if (pvo == NULL ||
+		    (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) != ppa) {
+			error = EFAULT;
+			break;
+		}
+	}
+	PMAP_UNLOCK(kernel_pmap);
+
+	return (error);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002250349.o1P3nIYS094166>