summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/include/ipxe/xenmem.h
blob: 9b9aeda9c7f77ef80505591c90a96eaecc19e630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 */