mmu.h 1.8 KB
Newer Older
J
Jeremy Fitzhardinge 已提交
1 2 3 4 5
#ifndef _XEN_MMU_H

#include <linux/linkage.h>
#include <asm/page.h>

6 7 8 9 10 11 12
enum pt_level {
	PT_PGD,
	PT_PUD,
	PT_PMD,
	PT_PTE
};

J
Jeremy Fitzhardinge 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * Page-directory addresses above 4GB do not fit into architectural %cr3.
 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
 * must use the following accessor macros to pack/unpack valid MFNs.
 *
 * Note that Xen is using the fact that the pagetable base is always
 * page-aligned, and putting the 12 MSB of the address into the 12 LSB
 * of cr3.
 */
#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))


J
Jeremy Fitzhardinge 已提交
26 27 28 29 30 31 32 33
void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);


void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
void xen_exit_mmap(struct mm_struct *mm);

void xen_pgd_pin(pgd_t *pgd);
34
//void xen_pgd_unpin(pgd_t *pgd);
J
Jeremy Fitzhardinge 已提交
35

36 37 38
pteval_t xen_pte_val(pte_t);
pmdval_t xen_pmd_val(pmd_t);
pgdval_t xen_pgd_val(pgd_t);
J
Jeremy Fitzhardinge 已提交
39

40 41 42
pte_t xen_make_pte(pteval_t);
pmd_t xen_make_pmd(pmdval_t);
pgd_t xen_make_pgd(pgdval_t);
J
Jeremy Fitzhardinge 已提交
43

44
void xen_set_pte(pte_t *ptep, pte_t pteval);
J
Jeremy Fitzhardinge 已提交
45 46 47
void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
		    pte_t *ptep, pte_t pteval);
void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
48
void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
J
Jeremy Fitzhardinge 已提交
49
void xen_set_pud(pud_t *ptr, pud_t val);
50 51
void xen_set_pmd_hyper(pmd_t *pmdp, pmd_t pmdval);
void xen_set_pud_hyper(pud_t *ptr, pud_t val);
J
Jeremy Fitzhardinge 已提交
52 53 54
void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
void xen_pmd_clear(pmd_t *pmdp);

55 56 57 58
pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
void  xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
				  pte_t *ptep, pte_t pte);

J
Jeremy Fitzhardinge 已提交
59
#endif	/* _XEN_MMU_H */