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 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
58 pte_t *ptep, pte_t entry)
62 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
63 set_pte_at(mm, addr, ptep, entry);
66 pte_val(entry) += PAGE_SIZE;
70 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
78 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
79 pte_clear(mm, addr, ptep);
87 struct page *follow_huge_addr(struct mm_struct *mm,
88 unsigned long address, int write)
90 return ERR_PTR(-EINVAL);
93 int pmd_huge(pmd_t pmd)
98 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
99 pmd_t *pmd, int write)