page.h 814 B

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