hugetlbpage.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
  50. {
  51. return 0;
  52. }
  53. void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  54. pte_t *ptep, pte_t entry)
  55. {
  56. int i;
  57. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  58. set_pte_at(mm, addr, ptep, entry);
  59. ptep++;
  60. addr += PAGE_SIZE;
  61. pte_val(entry) += PAGE_SIZE;
  62. }
  63. }
  64. pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
  65. pte_t *ptep)
  66. {
  67. pte_t entry;
  68. int i;
  69. entry = *ptep;
  70. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  71. pte_clear(mm, addr, ptep);
  72. addr += PAGE_SIZE;
  73. ptep++;
  74. }
  75. return entry;
  76. }
  77. struct page *follow_huge_addr(struct mm_struct *mm,
  78. unsigned long address, int write)
  79. {
  80. return ERR_PTR(-EINVAL);
  81. }
  82. int pmd_huge(pmd_t pmd)
  83. {
  84. return 0;
  85. }
  86. struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
  87. pmd_t *pmd, int write)
  88. {
  89. return NULL;
  90. }