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

[Minios-devel] [PATCH v3 08/43] arm64: fix the wrong mask for to_virt/to_phys



In the arm64, the mask 0xffffffff will truncate the value, and
to_virt/to_phys will get wrong results.

This patch fixes it.

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 include/arm/arch_mm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h
index c66856c..f77a210 100644
--- a/include/arm/arch_mm.h
+++ b/include/arm/arch_mm.h
@@ -15,8 +15,8 @@ extern paddr_t physical_address_offset;
 
 #define DEF_PAGE_PROT     0
 
-#define to_phys(x)                 (((paddr_t)(x)+physical_address_offset) & 
0xffffffff)
-#define to_virt(x)                 ((void *)(((x)-physical_address_offset) & 
0xffffffff))
+#define to_phys(x)                 (((paddr_t)(x)+physical_address_offset) & 
(~0UL))
+#define to_virt(x)                 ((void *)(((x)-physical_address_offset) & 
(~0UL)))
 
 #define PFN_UP(x)                  (unsigned long)(((x) + PAGE_SIZE-1) >> 
PAGE_SHIFT)
 #define PFN_DOWN(x)                (unsigned long)((x) >> PAGE_SHIFT)
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.