| 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 throughout 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_64BIT) |
| 18 | /* |
| 19 | * Applies only to 32-bit architectures. |
| 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) while masking a |
| 24 | * 64-bit value such as phys_addr_t. |
| 25 | */ |
| 26 | #define PAGE_MASK (~((1 << CONFIG_PAGE_SHIFT) - 1)) |
| 27 | #else |
| 28 | #define PAGE_MASK (~(PAGE_SIZE - 1)) |
| 29 | #endif |
| 30 | |
| 31 | #endif /* __VDSO_PAGE_H */ |
| 32 | |