mmu.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _XEN_MMU_H
  2. #include <linux/linkage.h>
  3. #include <asm/page.h>
  4. /*
  5. * Page-directory addresses above 4GB do not fit into architectural %cr3.
  6. * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
  7. * must use the following accessor macros to pack/unpack valid MFNs.
  8. *
  9. * Note that Xen is using the fact that the pagetable base is always
  10. * page-aligned, and putting the 12 MSB of the address into the 12 LSB
  11. * of cr3.
  12. */
  13. #define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
  14. #define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
  15. void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
  16. void xen_set_pte(pte_t *ptep, pte_t pteval);
  17. void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
  18. pte_t *ptep, pte_t pteval);
  19. void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
  20. void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
  21. void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
  22. void xen_exit_mmap(struct mm_struct *mm);
  23. void xen_pgd_pin(pgd_t *pgd);
  24. //void xen_pgd_unpin(pgd_t *pgd);
  25. #ifdef CONFIG_X86_PAE
  26. unsigned long long xen_pte_val(pte_t);
  27. unsigned long long xen_pmd_val(pmd_t);
  28. unsigned long long xen_pgd_val(pgd_t);
  29. pte_t xen_make_pte(unsigned long long);
  30. pmd_t xen_make_pmd(unsigned long long);
  31. pgd_t xen_make_pgd(unsigned long long);
  32. void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
  33. pte_t *ptep, pte_t pteval);
  34. void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
  35. void xen_set_pud(pud_t *ptr, pud_t val);
  36. void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
  37. void xen_pmd_clear(pmd_t *pmdp);
  38. #else
  39. unsigned long xen_pte_val(pte_t);
  40. unsigned long xen_pmd_val(pmd_t);
  41. unsigned long xen_pgd_val(pgd_t);
  42. pte_t xen_make_pte(unsigned long);
  43. pmd_t xen_make_pmd(unsigned long);
  44. pgd_t xen_make_pgd(unsigned long);
  45. #endif
  46. #endif /* _XEN_MMU_H */