xref: /linux/include/vdso/page.h (revision efe8419ae78d65e83edc31aad74b605c12e7d60c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __VDSO_PAGE_H
3 #define __VDSO_PAGE_H
4 
5 #include <uapi/linux/const.h>
6 
7 /*
8  * PAGE_SHIFT determines the page size.
9  *
10  * Note: This definition is required because PAGE_SHIFT is used
11  * in several places throuout the codebase.
12  */
13 #define PAGE_SHIFT      CONFIG_PAGE_SHIFT
14 
15 #define PAGE_SIZE	(_AC(1,UL) << CONFIG_PAGE_SHIFT)
16 
17 #if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_64BIT)
18 /*
19  * Applies only to 32-bit architectures with a 64-bit phys_addr_t.
20  *
21  * Subtle: (1 << CONFIG_PAGE_SHIFT) is an int, not an unsigned long.
22  * So if we assign PAGE_MASK to a larger type it gets extended the
23  * way we want (i.e. with 1s in the high bits)
24  */
25 #define PAGE_MASK	(~((1 << CONFIG_PAGE_SHIFT) - 1))
26 #else
27 #define PAGE_MASK	(~(PAGE_SIZE - 1))
28 #endif
29 
30 #endif	/* __VDSO_PAGE_H */
31