]> xenbits.xensource.com Git - xtf.git/commitdiff
Helpers to pack and unpack a frame in a PSE36 superpage
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 Jun 2016 13:34:41 +0000 (14:34 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Jul 2016 09:51:17 +0000 (10:51 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/page-pse.h

index 1ffba1ec4d59f2776189140ed9a9f105eca26b4b..517cdc76dd94c560dd7a79a3656440c435507bfd 100644 (file)
@@ -36,6 +36,16 @@ static inline unsigned int pse_l2_table_offset(unsigned long va)
     return (va >> PSE_L2_PT_SHIFT) & (PSE_L2_PT_ENTRIES - 1);
 }
 
+static inline uint32_t fold_pse36(uint64_t val)
+{
+    return (val & ~(0x1ffULL << 13)) | ((val & (0x1ffULL << 32)) >> (32 - 13));
+}
+
+static inline uint64_t unfold_pse36(uint32_t val)
+{
+    return (val & ~(0x1ffULL << 13)) | ((val & (0x1ffULL << 13)) << (32 - 13));
+}
+
 #endif /* __ASSEMBLY__ */
 #endif /* XTF_X86_PAGE_PSE_H */