2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
|
|
|
|
* Copyright 2003 PathScale, Inc.
|
|
|
|
* Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
|
|
|
|
* Licensed under the GPL
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UM_PGALLOC_H
|
|
|
|
#define __UM_PGALLOC_H
|
|
|
|
|
|
|
|
#include "linux/mm.h"
|
|
|
|
#include "asm/fixmap.h"
|
|
|
|
|
|
|
|
#define pmd_populate_kernel(mm, pmd, pte) \
|
|
|
|
set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
|
|
|
|
|
|
|
|
#define pmd_populate(mm, pmd, pte) \
|
|
|
|
set_pmd(pmd, __pmd(_PAGE_TABLE + \
|
|
|
|
((unsigned long long)page_to_pfn(pte) << \
|
|
|
|
(unsigned long long) PAGE_SHIFT)))
|
2008-02-08 05:22:04 -07:00
|
|
|
#define pmd_pgtable(pmd) pmd_page(pmd)
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate and free page tables.
|
|
|
|
*/
|
|
|
|
extern pgd_t *pgd_alloc(struct mm_struct *);
|
2008-02-04 23:29:14 -07:00
|
|
|
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
|
2008-02-08 05:22:04 -07:00
|
|
|
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2008-02-04 23:29:14 -07:00
|
|
|
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
free_page((unsigned long) pte);
|
|
|
|
}
|
|
|
|
|
2008-02-08 05:22:04 -07:00
|
|
|
static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2008-02-08 05:22:04 -07:00
|
|
|
pgtable_page_dtor(pte);
|
2005-04-16 16:20:36 -06:00
|
|
|
__free_page(pte);
|
|
|
|
}
|
|
|
|
|
2008-02-08 05:22:04 -07:00
|
|
|
#define __pte_free_tlb(tlb,pte) \
|
|
|
|
do { \
|
|
|
|
pgtable_page_dtor(pte); \
|
|
|
|
tlb_remove_page((tlb),(pte)); \
|
|
|
|
} while (0)
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#ifdef CONFIG_3_LEVEL_PGTABLES
|
2005-09-03 16:57:52 -06:00
|
|
|
|
2008-02-04 23:29:14 -07:00
|
|
|
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
|
2005-09-03 16:57:52 -06:00
|
|
|
{
|
|
|
|
free_page((unsigned long)pmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
|
2005-04-16 16:20:36 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define check_pgt_cache() do { } while (0)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Overrides for Emacs so that we follow Linus's tabbing style.
|
|
|
|
* Emacs will notice this stuff at the end of the file and automatically
|
|
|
|
* adjust the settings for this buffer only. This must remain at the end
|
|
|
|
* of the file.
|
|
|
|
* ---------------------------------------------------------------------------
|
|
|
|
* Local variables:
|
|
|
|
* c-file-style: "linux"
|
|
|
|
* End:
|
|
|
|
*/
|