2 * arch/sh/mm/hugetlbpage.c
4 * SuperH HugeTLB page support.
6 * Cloned from sparc64 by Paul Mundt.
8 * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
11 #include <linux/config.h>
12 #include <linux/init.h>
15 #include <linux/hugetlb.h>
16 #include <linux/pagemap.h>
17 #include <linux/smp_lock.h>
18 #include <linux/slab.h>
19 #include <linux/sysctl.h>
22 #include <asm/pgalloc.h>
24 #include <asm/tlbflush.h>
25 #include <asm/cacheflush.h>
27 pte_t
*huge_pte_alloc(struct mm_struct
*mm
, unsigned long addr
)
33 pgd
= pgd_offset(mm
, addr
);
35 pmd
= pmd_alloc(mm
, pgd
, addr
);
37 pte
= pte_alloc_map(mm
, pmd
, addr
);
42 pte_t
*huge_pte_offset(struct mm_struct
*mm
, unsigned long addr
)
48 pgd
= pgd_offset(mm
, addr
);
50 pmd
= pmd_offset(pgd
, addr
);
52 pte
= pte_offset_map(pmd
, addr
);
57 #define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0)
59 void set_huge_pte_at(struct mm_struct
*mm
, unsigned long addr
,
60 pte_t
*ptep
, pte_t entry
)
64 for (i
= 0; i
< (1 << HUGETLB_PAGE_ORDER
); i
++) {
65 set_pte_at(mm
, addr
, ptep
, entry
);
68 pte_val(entry
) += PAGE_SIZE
;
72 pte_t
huge_ptep_get_and_clear(struct mm_struct
*mm
, unsigned long addr
,
80 for (i
= 0; i
< (1 << HUGETLB_PAGE_ORDER
); i
++) {
81 pte_clear(mm
, addr
, ptep
);
90 * This function checks for proper alignment of input addr and len parameters.
92 int is_aligned_hugepage_range(unsigned long addr
, unsigned long len
)
94 if (len
& ~HPAGE_MASK
)
96 if (addr
& ~HPAGE_MASK
)
101 struct page
*follow_huge_addr(struct mm_struct
*mm
,
102 unsigned long address
, int write
)
104 return ERR_PTR(-EINVAL
);
107 int pmd_huge(pmd_t pmd
)
112 struct page
*follow_huge_pmd(struct mm_struct
*mm
, unsigned long address
,
113 pmd_t
*pmd
, int write
)