hugetlbpage.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/slab.h>
  16. #include <linux/sysctl.h>
  17. #include <asm/mman.h>
  18. #include <asm/pgalloc.h>
  19. #include <asm/tlb.h>
  20. #include <asm/tlbflush.h>
  21. #include <asm/cacheflush.h>
  22. pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
  23. {
  24. pgd_t *pgd;
  25. pmd_t *pmd;
  26. pte_t *pte = NULL;
  27. pgd = pgd_offset(mm, addr);
  28. if (pgd) {
  29. pmd = pmd_alloc(mm, pgd, addr);
  30. if (pmd)
  31. pte = pte_alloc_map(mm, pmd, addr);
  32. }
  33. return pte;
  34. }
  35. pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
  36. {
  37. pgd_t *pgd;
  38. pmd_t *pmd;
  39. pte_t *pte = NULL;
  40. pgd = pgd_offset(mm, addr);
  41. if (pgd) {
  42. pmd = pmd_offset(pgd, addr);
  43. if (pmd)
  44. pte = pte_offset_map(pmd, addr);
  45. }
  46. return pte;
  47. }
  48. int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
  49. {
  50. return 0;
  51. }
  52. void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  53. pte_t *ptep, pte_t entry)
  54. {
  55. int i;
  56. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  57. set_pte_at(mm, addr, ptep, entry);
  58. ptep++;
  59. addr += PAGE_SIZE;
  60. pte_val(entry) += PAGE_SIZE;
  61. }
  62. }
  63. pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
  64. pte_t *ptep)
  65. {
  66. pte_t entry;
  67. int i;
  68. entry = *ptep;
  69. for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
  70. pte_clear(mm, addr, ptep);
  71. addr += PAGE_SIZE;
  72. ptep++;
  73. }
  74. return entry;
  75. }
  76. struct page *follow_huge_addr(struct mm_struct *mm,
  77. unsigned long address, int write)
  78. {
  79. return ERR_PTR(-EINVAL);
  80. }
  81. int pmd_huge(pmd_t pmd)
  82. {
  83. return 0;
  84. }
  85. struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
  86. pmd_t *pmd, int write)
  87. {
  88. return NULL;
  89. }