hugetlbpage.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * arch/sh64/mm/hugetlbpage.c
  3. *
  4. * SuperH HugeTLB page support.
  5. *
  6. * Cloned from sparc64 by Paul Mundt.
  7. *
  8. * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
  9. */
  10. #include <linux/init.h>
  11. #include <linux/fs.h>
  12. #include <linux/mm.h>
  13. #include <linux/hugetlb.h>
  14. #include <linux/pagemap.h>
  15. #include <linux/smp_lock.h>
  16. #include <linux/slab.h>
  17. #include <linux/sysctl.h>
  18. #include <asm/mman.h>
  19. #include <asm/pgalloc.h>
  20. #include <asm/tlb.h>
  21. #include <asm/tlbflush.h>
  22. #include <asm/cacheflush.h>
  23. pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
  24. {
  25. pgd_t *pgd;
  26. pmd_t *pmd;
  27. pte_t *pte = NULL;
  28. pgd = pgd_offset(mm, addr);
  29. if (pgd) {
  30. pmd = pmd_alloc(mm, pgd, addr);
  31. if (pmd)
  32. pte = pte_alloc_map(mm, pmd, addr);
  33. }
  34. return pte;
  35. }
  36. pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
  37. {
  38. pgd_t *pgd;
  39. pmd_t *pmd;
  40. pte_t *pte = NULL;
  41. pgd = pgd_offset(mm, addr);
  42. if (pgd) {
  43. pmd = pmd_offset(pgd, addr);
  44. if (pmd)
  45. pte = pte_offset_map(pmd, addr);
  46. }
  47. return pte;
  48. }
  49. void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  50. pte_t *ptep, pte_t entry)
  51. {
  52. int i;
  53. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  54. set_pte_at(mm, addr, ptep, entry);
  55. ptep++;
  56. addr += PAGE_SIZE;
  57. pte_val(entry) += PAGE_SIZE;
  58. }
  59. }
  60. pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
  61. pte_t *ptep)
  62. {
  63. pte_t entry;
  64. int i;
  65. entry = *ptep;
  66. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  67. pte_clear(mm, addr, ptep);
  68. addr += PAGE_SIZE;
  69. ptep++;
  70. }
  71. return entry;
  72. }
  73. struct page *follow_huge_addr(struct mm_struct *mm,
  74. unsigned long address, int write)
  75. {
  76. return ERR_PTR(-EINVAL);
  77. }
  78. int pmd_huge(pmd_t pmd)
  79. {
  80. return 0;
  81. }
  82. struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
  83. pmd_t *pmd, int write)
  84. {
  85. return NULL;
  86. }