summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/include/ipxe/xenmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/ipxe/src/include/ipxe/xenmem.h')
-rw-r--r--qemu/roms/ipxe/src/include/ipxe/xenmem.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/qemu/roms/ipxe/src/include/ipxe/xenmem.h b/qemu/roms/ipxe/src/include/ipxe/xenmem.h
new file mode 100644
index 000000000..9b9aeda9c
--- /dev/null
+++ b/qemu/roms/ipxe/src/include/ipxe/xenmem.h
@@ -0,0 +1,46 @@
+#ifndef _IPXE_XENMEM_H
+#define _IPXE_XENMEM_H
+
+/** @file
+ *
+ * Xen memory operations
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <ipxe/xen.h>
+#include <xen/memory.h>
+
+/**
+ * Add page to physical address space
+ *
+ * @v xen Xen hypervisor
+ * @v add Page mapping descriptor
+ * @ret xenrc Xen status code
+ */
+static inline __attribute__ (( always_inline )) int
+xenmem_add_to_physmap ( struct xen_hypervisor *xen,
+ struct xen_add_to_physmap *add ) {
+
+ return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
+ XENMEM_add_to_physmap, virt_to_phys ( add ) );
+}
+
+/**
+ * Remove page from physical address space
+ *
+ * @v xen Xen hypervisor
+ * @v remove Page mapping descriptor
+ * @ret xenrc Xen status code
+ */
+static inline __attribute__ (( always_inline )) int
+xenmem_remove_from_physmap ( struct xen_hypervisor *xen,
+ struct xen_remove_from_physmap *remove ) {
+
+ return xen_hypercall_2 ( xen, __HYPERVISOR_memory_op,
+ XENMEM_remove_from_physmap,
+ virt_to_phys ( remove ) );
+}
+
+#endif /* _IPXE_XENMEM_H */