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

[Minios-devel] [PATCH v2 08/47] 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 aa145d8..231247c 100644
--- a/include/arm/arch_mm.h
+++ b/include/arm/arch_mm.h
@@ -20,8 +20,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®.