blob: 297bf9f5b8bc3c5a709ff811078c874ffe9b2bab [file] [log] [blame]
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -07001#ifndef _XEN_MMU_H
2
3#include <linux/linkage.h>
4#include <asm/page.h>
5
Mark McLoughlinf6433702008-04-02 15:36:36 +01006enum pt_level {
7 PT_PGD,
8 PT_PUD,
9 PT_PMD,
10 PT_PTE
11};
12
Jeremy Fitzhardingef87e4ca2007-07-17 18:37:06 -070013/*
14 * Page-directory addresses above 4GB do not fit into architectural %cr3.
15 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
16 * must use the following accessor macros to pack/unpack valid MFNs.
17 *
18 * Note that Xen is using the fact that the pagetable base is always
19 * page-aligned, and putting the 12 MSB of the address into the 12 LSB
20 * of cr3.
21 */
22#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
23#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
24
25
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070026void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
27
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070028
29void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
30void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
31void xen_exit_mmap(struct mm_struct *mm);
32
33void xen_pgd_pin(pgd_t *pgd);
Jeremy Fitzhardingef4f97b32007-07-17 18:37:05 -070034//void xen_pgd_unpin(pgd_t *pgd);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070035
Jeremy Fitzhardinge3843fc22008-05-09 12:05:57 +010036pteval_t xen_pte_val(pte_t);
37pmdval_t xen_pmd_val(pmd_t);
38pgdval_t xen_pgd_val(pgd_t);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070039
Jeremy Fitzhardinge3843fc22008-05-09 12:05:57 +010040pte_t xen_make_pte(pteval_t);
41pmd_t xen_make_pmd(pmdval_t);
42pgd_t xen_make_pgd(pgdval_t);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070043
Jeremy Fitzhardingee2426cf2008-05-31 01:24:27 +010044void xen_set_pte(pte_t *ptep, pte_t pteval);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070045void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
46 pte_t *ptep, pte_t pteval);
47void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
Jeremy Fitzhardingee2426cf2008-05-31 01:24:27 +010048void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070049void xen_set_pud(pud_t *ptr, pud_t val);
Jeremy Fitzhardingee2426cf2008-05-31 01:24:27 +010050void xen_set_pmd_hyper(pmd_t *pmdp, pmd_t pmdval);
51void xen_set_pud_hyper(pud_t *ptr, pud_t val);
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070052void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
53void xen_pmd_clear(pmd_t *pmdp);
54
Jeremy Fitzhardingee57778a2008-06-16 04:30:02 -070055pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
56void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
57 pte_t *ptep, pte_t pte);
58
Jeremy Fitzhardinge3b827c12007-07-17 18:37:04 -070059#endif /* _XEN_MMU_H */