WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] l?e_from_paddr() expects the physical address to already

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] l?e_from_paddr() expects the physical address to already be page
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 02 Jun 2005 17:36:41 +0000
Delivery-date: Thu, 02 Jun 2005 18:02:42 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1642, 2005/06/02 18:36:41+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        l?e_from_paddr() expects the physical address to already be page
        aligned. Fix map_domain_mem() to do this, and add an assertion to the
        macros to check for it in debug builds.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/x86_32/domain_page.c |    2 +-
 include/asm-x86/page.h        |   34 ++++++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 9 deletions(-)


diff -Nru a/xen/arch/x86/x86_32/domain_page.c 
b/xen/arch/x86/x86_32/domain_page.c
--- a/xen/arch/x86/x86_32/domain_page.c 2005-06-02 14:03:35 -04:00
+++ b/xen/arch/x86/x86_32/domain_page.c 2005-06-02 14:03:35 -04:00
@@ -72,7 +72,7 @@
     }
     while ( l1e_get_flags(cache[idx]) & _PAGE_PRESENT );
 
-    cache[idx] = l1e_from_paddr(pa, __PAGE_HYPERVISOR);
+    cache[idx] = l1e_from_paddr(pa & PAGE_MASK, __PAGE_HYPERVISOR);
 
     spin_unlock(&map_lock);
 
diff -Nru a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        2005-06-02 14:03:35 -04:00
+++ b/xen/include/asm-x86/page.h        2005-06-02 14:03:35 -04:00
@@ -75,14 +75,32 @@
     ((l4_pgentry_t) { ((intpte_t)(pfn) << PAGE_SHIFT) | put_pte_flags(flags) })
 
 /* Construct a pte from a physical address and access flags. */
-#define l1e_from_paddr(pa, flags)  \
-    ((l1_pgentry_t) { (pa) | put_pte_flags(flags) })
-#define l2e_from_paddr(pa, flags)  \
-    ((l2_pgentry_t) { (pa) | put_pte_flags(flags) })
-#define l3e_from_paddr(pa, flags)  \
-    ((l3_pgentry_t) { (pa) | put_pte_flags(flags) })
-#define l4e_from_paddr(pa, flags)  \
-    ((l4_pgentry_t) { (pa) | put_pte_flags(flags) })
+#ifndef __ASSEMBLY__
+static inline l1_pgentry_t l1e_from_paddr(physaddr_t pa, unsigned int flags)
+{
+    ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
+    return (l1_pgentry_t) { pa | put_pte_flags(flags) };
+}
+static inline l2_pgentry_t l2e_from_paddr(physaddr_t pa, unsigned int flags)
+{
+    ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
+    return (l2_pgentry_t) { pa | put_pte_flags(flags) };
+}
+#if CONFIG_PAGING_LEVELS >= 3
+static inline l3_pgentry_t l3e_from_paddr(physaddr_t pa, unsigned int flags)
+{
+    ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
+    return (l3_pgentry_t) { pa | put_pte_flags(flags) };
+}
+#endif
+#if CONFIG_PAGING_LEVELS >= 4
+static inline l4_pgentry_t l4e_from_paddr(physaddr_t pa, unsigned int flags)
+{
+    ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
+    return (l4_pgentry_t) { pa | put_pte_flags(flags) };
+}
+#endif
+#endif /* !__ASSEMBLY__ */
 
 /* Construct a pte from its direct integer representation. */
 #define l1e_from_intpte(intpte)    ((l1_pgentry_t) { (intpte_t)(intpte) })

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] l?e_from_paddr() expects the physical address to already be page, BitKeeper Bot <=