]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
Introduce paddr_t
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sun, 5 Jun 2016 12:42:08 +0000 (13:42 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Jul 2016 09:51:17 +0000 (10:51 +0100)
rather than just using uint64_t.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/page.h

index d5ff2708b79bac0305d5a960c0580ec283ba9691..117e320f340d9751e9114ea074adbfeeb405fea0 100644 (file)
@@ -11,6 +11,9 @@
 #define PAGE_SIZE               (_AC(1, L) << PAGE_SHIFT)
 #define PAGE_MASK               (~(PAGE_SIZE - 1))
 
+#define PADDR_BITS              52
+#define PADDR_MASK              ((_AC(1, ULL) << PADDR_BITS) - 1)
+
 #include "page-pae.h"
 #include "page-pse.h"
 
 
 #ifndef __ASSEMBLY__
 
+/*
+ * Always consider "physical" addresses to be 64bits wide, even in 32bit mode.
+ */
+typedef uint64_t paddr_t;
+#define PRIpaddr "016"PRIx64
+
 #if CONFIG_PAGING_LEVELS == 2 /* PSE Paging */
 
 typedef pse_intpte_t intpte_t;
@@ -125,9 +134,9 @@ static inline unsigned int l4_table_offset(unsigned long va)
 
 #if CONFIG_PAGING_LEVELS > 0
 
-static inline uint64_t pte_to_paddr(intpte_t pte)
+static inline paddr_t pte_to_paddr(intpte_t pte)
 {
-    return pte & 0x000ffffffffff000ULL;
+    return pte & PADDR_MASK & PAGE_MASK;
 }
 
 #endif /* CONFIG_PAGING_LEVELS > 0 */