mm.h 894 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _TOOLS_LINUX_MM_H
  3. #define _TOOLS_LINUX_MM_H
  4. #include <linux/mmzone.h>
  5. #include <uapi/linux/const.h>
  6. #define PAGE_SHIFT 12
  7. #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
  8. #define PAGE_MASK (~(PAGE_SIZE - 1))
  9. #define PHYS_ADDR_MAX (~(phys_addr_t)0)
  10. #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
  11. #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
  12. #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
  13. #define __va(x) ((void *)((unsigned long)(x)))
  14. #define __pa(x) ((unsigned long)(x))
  15. #define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE))
  16. #define phys_to_virt phys_to_virt
  17. static inline void *phys_to_virt(unsigned long address)
  18. {
  19. return __va(address);
  20. }
  21. void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
  22. static inline void totalram_pages_inc(void)
  23. {
  24. }
  25. static inline void totalram_pages_add(long count)
  26. {
  27. }
  28. #endif