Module Name:    src
Committed By:   jym
Date:           Fri Apr 29 22:45:41 UTC 2011

Modified Files:
        src/sys/arch/xen/include: xenpmap.h

Log Message:
Apply DRY: xpmap_{mtop,ptom}() can reuse xpmap_{mtop,ptom}_masked() for
the frame number lookup.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/xen/include/xenpmap.h

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/xen/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.26 src/sys/arch/xen/include/xenpmap.h:1.27
--- src/sys/arch/xen/include/xenpmap.h:1.26	Sun Apr 17 09:50:33 2011
+++ src/sys/arch/xen/include/xenpmap.h	Fri Apr 29 22:45:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.26 2011/04/17 09:50:33 mrg Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.27 2011/04/29 22:45:41 jym Exp $	*/
 
 /*
  *
@@ -76,14 +76,6 @@
 #define pfn_to_mfn(pfn) (xpmap_phys_to_machine_mapping[(pfn)])
 
 static __inline paddr_t
-xpmap_mtop(paddr_t mpa)
-{
-	return (
-	    ((paddr_t)machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT)
-	    + XPMAP_OFFSET) | (mpa & ~PG_FRAME);
-}
-
-static __inline paddr_t
 xpmap_mtop_masked(paddr_t mpa)
 {
 	return (
@@ -92,11 +84,9 @@
 }
 
 static __inline paddr_t
-xpmap_ptom(paddr_t ppa)
+xpmap_mtop(paddr_t mpa)
 {
-	return (((paddr_t)xpmap_phys_to_machine_mapping[(ppa -
-	    XPMAP_OFFSET) >> PAGE_SHIFT]) << PAGE_SHIFT)
-		| (ppa & ~PG_FRAME);
+	return (xpmap_mtop_masked(mpa) | (mpa & ~PG_FRAME));
 }
 
 static __inline paddr_t
@@ -106,6 +96,12 @@
 	    XPMAP_OFFSET) >> PAGE_SHIFT]) << PAGE_SHIFT);
 }
 
+static __inline paddr_t
+xpmap_ptom(paddr_t ppa)
+{
+	return (xpmap_ptom_masked(ppa) | (ppa & ~PG_FRAME));
+}
+
 static inline void
 MULTI_update_va_mapping(
 	multicall_entry_t *mcl, vaddr_t va,

Reply via email to