pgalloc.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/include/asm-arm/proc-armo/pgalloc.h
  3.  *
  4.  *  Copyright (C) 2001 Russell King
  5.  *
  6.  * Page table allocation/freeing primitives for 26-bit ARM processors.
  7.  */
  8. /* unfortunately, this includes linux/mm.h and the rest of the universe. */
  9. #include <linux/slab.h>
  10. extern kmem_cache_t *pte_cache;
  11. /*
  12.  * Allocate one PTE table.
  13.  *
  14.  * Note that we keep the processor copy of the PTE entries separate
  15.  * from the Linux copy.  The processor copies are offset by -PTRS_PER_PTE
  16.  * words from the Linux copy.
  17.  */
  18. static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address)
  19. {
  20. return kmem_cache_alloc(pte_cache, GFP_KERNEL);
  21. }
  22. /*
  23.  * Free one PTE table.
  24.  */
  25. static inline void pte_free_slow(pte_t *pte)
  26. {
  27. if (pte)
  28. kmem_cache_free(pte_cache, pte);
  29. }
  30. /*
  31.  * Populate the pmdp entry with a pointer to the pte.  This pmd is part
  32.  * of the mm address space.
  33.  *
  34.  * If 'mm' is the init tasks mm, then we are doing a vmalloc, and we
  35.  * need to set stuff up correctly for it.
  36.  */
  37. #define pmd_populate(mm,pmdp,pte)
  38. do {
  39. set_pmd(pmdp, __mk_pmd(pte, _PAGE_TABLE));
  40. } while (0)