hugetlbpage.c 1.5 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * arch/sh/mm/hugetlbpage.c
 *
 * SuperH HugeTLB page support.
 *
 * Cloned from sparc64 by Paul Mundt.
 *
 * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
 */

#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/hugetlb.h>
#include <linux/pagemap.h>
#include <linux/sysctl.h>

#include <asm/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>

24 25
pte_t *huge_pte_alloc(struct mm_struct *mm,
			unsigned long addr, unsigned long sz)
L
Linus Torvalds 已提交
26 27
{
	pgd_t *pgd;
P
Paul Mundt 已提交
28
	pud_t *pud;
L
Linus Torvalds 已提交
29 30 31 32 33
	pmd_t *pmd;
	pte_t *pte = NULL;

	pgd = pgd_offset(mm, addr);
	if (pgd) {
P
Paul Mundt 已提交
34 35 36 37
		pud = pud_alloc(mm, pgd, addr);
		if (pud) {
			pmd = pmd_alloc(mm, pud, addr);
			if (pmd)
38
				pte = pte_alloc_map(mm, NULL, pmd, addr);
P
Paul Mundt 已提交
39
		}
L
Linus Torvalds 已提交
40
	}
P
Paul Mundt 已提交
41

L
Linus Torvalds 已提交
42 43 44
	return pte;
}

D
David Gibson 已提交
45
pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
L
Linus Torvalds 已提交
46 47
{
	pgd_t *pgd;
P
Paul Mundt 已提交
48
	pud_t *pud;
L
Linus Torvalds 已提交
49 50 51 52 53
	pmd_t *pmd;
	pte_t *pte = NULL;

	pgd = pgd_offset(mm, addr);
	if (pgd) {
P
Paul Mundt 已提交
54 55 56 57 58 59
		pud = pud_offset(pgd, addr);
		if (pud) {
			pmd = pmd_offset(pud, addr);
			if (pmd)
				pte = pte_offset_map(pmd, addr);
		}
D
David Gibson 已提交
60
	}
L
Linus Torvalds 已提交
61

P
Paul Mundt 已提交
62
	return pte;
L
Linus Torvalds 已提交
63 64
}

65 66 67 68 69
int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
{
	return 0;
}

L
Linus Torvalds 已提交
70 71 72 73 74 75 76 77 78 79 80
struct page *follow_huge_addr(struct mm_struct *mm,
			      unsigned long address, int write)
{
	return ERR_PTR(-EINVAL);
}

int pmd_huge(pmd_t pmd)
{
	return 0;
}

A
Andi Kleen 已提交
81 82 83 84 85
int pud_huge(pud_t pud)
{
	return 0;
}

L
Linus Torvalds 已提交
86 87 88 89 90
struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
			     pmd_t *pmd, int write)
{
	return NULL;
}