Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/include Apply DRY: xpmap_{mtop, ptom}() can reus...



details:   https://anonhg.NetBSD.org/src/rev/40763f85c148
branches:  trunk
changeset: 764662:40763f85c148
user:      jym <jym%NetBSD.org@localhost>
date:      Fri Apr 29 22:45:41 2011 +0000

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

No functional change.

diffstat:

 sys/arch/xen/include/xenpmap.h |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (51 lines):

diff -r 8cc94b087a33 -r 40763f85c148 sys/arch/xen/include/xenpmap.h
--- a/sys/arch/xen/include/xenpmap.h    Fri Apr 29 22:21:36 2011 +0000
+++ b/sys/arch/xen/include/xenpmap.h    Fri Apr 29 22:45:41 2011 +0000
@@ -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,



Home | Main Index | Thread Index | Old Index