1 #ifndef __XEN_PAGE_SIZE_H__
2 #define __XEN_PAGE_SIZE_H__
3 
4 #include <xen/const.h>
5 #include <asm/page-bits.h>
6 
7 /*
8  * It is important that the masks are signed quantities. This ensures that
9  * the compiler sign-extends a 32-bit mask to 64 bits if that is required.
10  */
11 #define PAGE_SIZE           (_AC(1,L) << PAGE_SHIFT)
12 #define PAGE_MASK           (~(PAGE_SIZE-1))
13 #define PAGE_OFFSET(ptr)    ((unsigned long)(ptr) & ~PAGE_MASK)
14 #define PAGE_ALIGN(x)       (((x) + PAGE_SIZE - 1) & PAGE_MASK)
15 
16 #define PADDR_MASK          ((_AC(1,ULL) << PADDR_BITS) - 1)
17 #define VADDR_MASK          (~_AC(0,UL) >> (BITS_PER_LONG - VADDR_BITS))
18 
19 #endif /* __XEN_PAGE_SIZE__ */
20