No, it doesn't work. The problem seems to be in the PAGE_MASK definition
(from include/asm-x86/page.h for example):
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
What do you think about the following?
#define PAGE_SIZE64 (1ULL << PAGE_SHIFT)
#define PAGE_MASK64 (~(PAGE_SIZE64 - 1))
#define PAGE_ALIGN(addr) ({ \
typeof(addr) __size = PAGE_SIZE; \
typeof(addr) __ret = (addr) + __size - 1; \
__ret > -1UL ? __ret & PAGE_MASK64 : __ret & PAGE_MASK; \
})
-Andrea
--