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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
/**
* @file mabi.h
* @brief Define memflow kernel module ABI
*
* Provides all structures and ioctls for interacting with memflow's kernel module
*
*/
/// @brief structure describing a guest to host memory mapping
typedef struct vm_memslot vm_memslot_t;
/// @brief structure describing the virtual machine
typedef struct vm_info vm_info_t;
/// @brief structure describing memory layout of the mapped virtual machine
typedef struct vm_map_info vm_map_info_t;
/**
* @brief Get a file descriptor to KVM based virtual machine
*
* Returns a file descriptor to KVM VMM in the given process. If the pid is 0, handle from any VMM is returned.
* If the process does not have a KVM instance, -1 is returned.
*
* The KVM instance will not be freed until the returned fd is closed.
*/
/**
* @brief Describe the virtual machine
*
* Fills `vm_info_t` structure that describes the virtual machine. Note that the memory layout of the VM may
* change before it gets mapped in, so it is advised to use MEMFLOW_VM_MAP_INFO after mapping the VM in.
*/
/**
* @brief Map the VM and retrieve its memory layout
*
* Fills `vm_map_info_t` structure that describes the memory layout of the mapped VM. Returns a file descriptor
* to the memory mapping handle. The VM memory stays mapped in, until the fd gets closed.
*/