pgalloc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
  3. * Copyright 2003 PathScale, Inc.
  4. * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
  5. * Licensed under the GPL
  6. */
  7. #ifndef __UM_PGALLOC_H
  8. #define __UM_PGALLOC_H
  9. #include "linux/mm.h"
  10. #include "asm/fixmap.h"
  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. /*
  18. * Allocate and free page tables.
  19. */
  20. extern pgd_t *pgd_alloc(struct mm_struct *);
  21. extern void pgd_free(pgd_t *pgd);
  22. extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
  23. extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
  24. static inline void pte_free_kernel(pte_t *pte)
  25. {
  26. free_page((unsigned long) pte);
  27. }
  28. static inline void pte_free(struct page *pte)
  29. {
  30. __free_page(pte);
  31. }
  32. #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
  33. #ifdef CONFIG_3_LEVEL_PGTABLES
  34. extern __inline__ void pmd_free(pmd_t *pmd)
  35. {
  36. free_page((unsigned long)pmd);
  37. }
  38. #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
  39. #endif
  40. #define check_pgt_cache() do { } while (0)
  41. #endif
  42. /*
  43. * Overrides for Emacs so that we follow Linus's tabbing style.
  44. * Emacs will notice this stuff at the end of the file and automatically
  45. * adjust the settings for this buffer only. This must remain at the end
  46. * of the file.
  47. * ---------------------------------------------------------------------------
  48. * Local variables:
  49. * c-file-style: "linux"
  50. * End:
  51. */