Skip to contentSkip to conversation

x86-64: fix incorrect assertion in __maddr_to_virt()

PATCH New Jan Beulich 1 participant 1 message Jun 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64: fix incorrect assertion in __maddr_to_virt()

When memory map sparseness reduction is in use, machine address ranges can't validly be compared directly against the total size of the direct mapping range.

xen/include/asm-x86/x86_64/page.h +1 -1
@@ -95,7 +95,7 @@ static inline unsigned long __virt_to_ma
 
 static inline void *__maddr_to_virt(unsigned long ma)
 {
-    ASSERT(ma < DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START);
+    ASSERT(pfn_to_pdx(ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
     return (void *)(DIRECTMAP_VIRT_START +
                     ((ma & ma_va_bottom_mask) |
                      ((ma & ma_top_mask) >> pfn_pdx_hole_shift)));

When memory map sparseness reduction is in use, machine address ranges can't validly be compared directly against the total size of the direct mapping range.

xen/include/asm-x86/x86_64/page.h +1 -1
@@ -95,7 +95,7 @@ static inline unsigned long __virt_to_ma
 
 static inline void *__maddr_to_virt(unsigned long ma)
 {
-    ASSERT(ma < DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START);
+    ASSERT(pfn_to_pdx(ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
     return (void *)(DIRECTMAP_VIRT_START +
                     ((ma & ma_va_bottom_mask) |
                      ((ma & ma_top_mask) >> pfn_pdx_hole_shift)));

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel