1 /****************************************************************************** 2 * domain_page.h 3 * 4 * Allow temporary mapping of domain page frames into Xen space. 5 * 6 * Copyright (c) 2003-2006, Keir Fraser <keir@xensource.com> 7 */ 8 9 #ifndef __XEN_DOMAIN_PAGE_H__ 10 #define __XEN_DOMAIN_PAGE_H__ 11 12 #include <xen/mm.h> 13 14 /* 15 * Clear a given page frame, or copy between two of them. 16 */ 17 void clear_domain_page(mfn_t mfn); 18 void copy_domain_page(mfn_t dst, const mfn_t src); 19 20 #ifdef CONFIG_DOMAIN_PAGE 21 22 /* 23 * Map a given page frame, returning the mapped virtual address. The page is 24 * then accessible within the current VCPU until a corresponding unmap call. 25 */ 26 void *map_domain_page(mfn_t mfn); 27 28 /* 29 * Pass a VA within a page previously mapped in the context of the 30 * currently-executing VCPU via a call to map_domain_page(). 31 */ 32 void unmap_domain_page(const void *va); 33 34 /* 35 * Given a VA from map_domain_page(), return its underlying MFN. 36 */ 37 unsigned long domain_page_map_to_mfn(const void *va); 38 39 /* 40 * Similar to the above calls, except the mapping is accessible in all 41 * address spaces (not just within the VCPU that created the mapping). Global 42 * mappings can also be unmapped from any context. 43 */ 44 void *map_domain_page_global(mfn_t mfn); 45 void unmap_domain_page_global(const void *va); 46 47 #define __map_domain_page(pg) map_domain_page(_mfn(__page_to_mfn(pg))) 48 __map_domain_page_global(const struct page_info * pg)49static inline void *__map_domain_page_global(const struct page_info *pg) 50 { 51 return map_domain_page_global(_mfn(__page_to_mfn(pg))); 52 } 53 54 #else /* !CONFIG_DOMAIN_PAGE */ 55 56 #define map_domain_page(mfn) __mfn_to_virt(mfn_x(mfn)) 57 #define __map_domain_page(pg) page_to_virt(pg) 58 #define unmap_domain_page(va) ((void)(va)) 59 #define domain_page_map_to_mfn(va) virt_to_mfn((unsigned long)(va)) 60 map_domain_page_global(mfn_t mfn)61static inline void *map_domain_page_global(mfn_t mfn) 62 { 63 return mfn_to_virt(mfn_x(mfn)); 64 } 65 __map_domain_page_global(const struct page_info * pg)66static inline void *__map_domain_page_global(const struct page_info *pg) 67 { 68 return page_to_virt(pg); 69 } 70 unmap_domain_page_global(const void * va)71static inline void unmap_domain_page_global(const void *va) {}; 72 73 #endif /* !CONFIG_DOMAIN_PAGE */ 74 75 #endif /* __XEN_DOMAIN_PAGE_H__ */ 76