pgtable-nopmd.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _PGTABLE_NOPMD_H
  2. #define _PGTABLE_NOPMD_H
  3. #ifndef __ASSEMBLY__
  4. #include <asm-generic/pgtable-nopud.h>
  5. struct mm_struct;
  6. #define __PAGETABLE_PMD_FOLDED
  7. /*
  8. * Having the pmd type consist of a pud gets the size right, and allows
  9. * us to conceptually access the pud entry that this pmd is folded into
  10. * without casting.
  11. */
  12. typedef struct { pud_t pud; } pmd_t;
  13. #define PMD_SHIFT PUD_SHIFT
  14. #define PTRS_PER_PMD 1
  15. #define PMD_SIZE (1UL << PMD_SHIFT)
  16. #define PMD_MASK (~(PMD_SIZE-1))
  17. /*
  18. * The "pud_xxx()" functions here are trivial for a folded two-level
  19. * setup: the pmd is never bad, and a pmd always exists (as it's folded
  20. * into the pud entry)
  21. */
  22. static inline int pud_none(pud_t pud) { return 0; }
  23. static inline int pud_bad(pud_t pud) { return 0; }
  24. static inline int pud_present(pud_t pud) { return 1; }
  25. static inline void pud_clear(pud_t *pud) { }
  26. #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud))
  27. #define pud_populate(mm, pmd, pte) do { } while (0)
  28. /*
  29. * (pmds are folded into puds so this doesn't get actually called,
  30. * but the define is needed for a generic inline function.)
  31. */
  32. #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
  33. static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
  34. {
  35. return (pmd_t *)pud;
  36. }
  37. #define pmd_val(x) (pud_val((x).pud))
  38. #define __pmd(x) ((pmd_t) { __pud(x) } )
  39. #define pud_page(pud) (pmd_page((pmd_t){ pud }))
  40. #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
  41. /*
  42. * allocating and freeing a pmd is trivial: the 1-entry pmd is
  43. * inside the pud, so has no extra memory associated with it.
  44. */
  45. #define pmd_alloc_one(mm, address) NULL
  46. static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
  47. {
  48. }
  49. #define __pmd_free_tlb(tlb, x, a) do { } while (0)
  50. #undef pmd_addr_end
  51. #define pmd_addr_end(addr, end) (end)
  52. #endif /* __ASSEMBLY__ */
  53. #endif /* _PGTABLE_NOPMD_H */