/arch/um/include/asm/pgalloc.h

http://github.com/mirrors/linux · C Header · 47 lines · 26 code · 12 blank · 9 comment · 1 complexity · 549ffbbbe6fe08899f1a3cee1900d721 MD5 · raw file

  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
  4. * Copyright 2003 PathScale, Inc.
  5. * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
  6. */
  7. #ifndef __UM_PGALLOC_H
  8. #define __UM_PGALLOC_H
  9. #include <linux/mm.h>
  10. #include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
  11. #define pmd_populate_kernel(mm, pmd, pte) \
  12. set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
  13. #define pmd_populate(mm, pmd, pte) \
  14. set_pmd(pmd, __pmd(_PAGE_TABLE + \
  15. ((unsigned long long)page_to_pfn(pte) << \
  16. (unsigned long long) PAGE_SHIFT)))
  17. #define pmd_pgtable(pmd) pmd_page(pmd)
  18. /*
  19. * Allocate and free page tables.
  20. */
  21. extern pgd_t *pgd_alloc(struct mm_struct *);
  22. extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
  23. #define __pte_free_tlb(tlb,pte, address) \
  24. do { \
  25. pgtable_pte_page_dtor(pte); \
  26. tlb_remove_page((tlb),(pte)); \
  27. } while (0)
  28. #ifdef CONFIG_3_LEVEL_PGTABLES
  29. static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
  30. {
  31. free_page((unsigned long)pmd);
  32. }
  33. #define __pmd_free_tlb(tlb,x, address) tlb_remove_page((tlb),virt_to_page(x))
  34. #endif
  35. #endif