1 #ifndef _IPXE_XENMEM_H
2 #define _IPXE_XENMEM_H
3
4 /** @file
5 *
6 * Xen memory operations
7 *
8 */
9
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12 #include <ipxe/xen.h>
13 #include <xen/memory.h>
14
15 /**
16 * Add page to physical address space
17 *
18 * @v xen Xen hypervisor
19 * @v add Page mapping descriptor
20 * @ret xenrc Xen status code
21 */
22 static inline __attribute__ (( always_inline )) int
xenmem_add_to_physmap(struct xen_hypervisor * xen,struct xen_add_to_physmap * add)23 xenmem_add_to_physmap ( struct xen_hypervisor *xen,
24 struct xen_add_to_physmap *add ) {
25
26 return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
27 XENMEM_add_to_physmap, virt_to_phys ( add ) );
28 }
29
30 /**
31 * Remove page from physical address space
32 *
33 * @v xen Xen hypervisor
34 * @v remove Page mapping descriptor
35 * @ret xenrc Xen status code
36 */
37 static inline __attribute__ (( always_inline )) int
xenmem_remove_from_physmap(struct xen_hypervisor * xen,struct xen_remove_from_physmap * remove)38 xenmem_remove_from_physmap ( struct xen_hypervisor *xen,
39 struct xen_remove_from_physmap *remove ) {
40
41 return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
42 XENMEM_remove_from_physmap,
43 virt_to_phys ( remove ) );
44 }
45
46 #endif /* _IPXE_XENMEM_H */
47