From: Andrew Cooper Date: Wed, 1 Jun 2016 13:34:41 +0000 (+0100) Subject: Helpers to pack and unpack a frame in a PSE36 superpage X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d5303a665fa726b74025fba63f734e3f996ae450;p=xtf.git Helpers to pack and unpack a frame in a PSE36 superpage Signed-off-by: Andrew Cooper --- diff --git a/include/arch/x86/page-pse.h b/include/arch/x86/page-pse.h index 1ffba1e..517cdc7 100644 --- a/include/arch/x86/page-pse.h +++ b/include/arch/x86/page-pse.h @@ -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 */