1 /*
2    This file is part of Valgrind, a dynamic binary instrumentation
3    framework.
4 
5    Copyright (C) 2012-2017 Citrix
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20    02111-1307, USA.
21 
22    The GNU General Public License is contained in the file COPYING.
23 */
24 
25 /* Contributed by Andrew Cooper <andrew.cooper3@citrix.com>
26    and Ian Campbell <ian.campbell@citrix.com> */
27 
28 #ifndef __VKI_XEN_MEMORY_H
29 #define __VKI_XEN_MEMORY_H
30 
31 #define VKI_XENMEM_increase_reservation 0
32 #define VKI_XENMEM_decrease_reservation 1
33 #define VKI_XENMEM_maximum_ram_page     2
34 #define VKI_XENMEM_current_reservation  3
35 #define VKI_XENMEM_maximum_reservation  4
36 #define VKI_XENMEM_machphys_mfn_list    5
37 #define VKI_XENMEM_populate_physmap     6
38 #define VKI_XENMEM_add_to_physmap       7
39 #define VKI_XENMEM_memory_map           9
40 #define VKI_XENMEM_machine_memory_map   10
41 #define VKI_XENMEM_exchange             11
42 #define VKI_XENMEM_machphys_mapping     12
43 #define VKI_XENMEM_set_memory_map       13
44 #define VKI_XENMEM_maximum_gpfn         14
45 #define VKI_XENMEM_remove_from_physmap  15
46 #define VKI_XENMEM_set_pod_target       16
47 #define VKI_XENMEM_get_pod_target       17
48 #define VKI_XENMEM_get_sharing_freed_pages    18
49 #define VKI_XENMEM_get_sharing_shared_pages   19
50 #define VKI_XENMEM_access_op                  21
51 #define VKI_XENMEM_claim_pages                24
52 #define VKI_XENMEM_machphys_compat_mfn_list   25
53 
54 struct vki_xen_memory_map {
55     unsigned int nr_entries;
56     VKI_XEN_GUEST_HANDLE(void) buffer;
57 };
58 
59 struct vki_xen_foreign_memory_map {
60     vki_xen_domid_t domid;
61     struct vki_xen_memory_map map;
62 };
63 
64 struct xen_memory_reservation {
65     VKI_XEN_GUEST_HANDLE(vki_xen_pfn_t) extent_start;
66     vki_xen_ulong_t    nr_extents;
67     unsigned int   extent_order;
68     unsigned int   mem_flags;
69     vki_xen_domid_t domid;
70 };
71 
72 struct vki_xen_machphys_mfn_list {
73     unsigned int max_extents; /* IN */
74     VKI_XEN_GUEST_HANDLE(vki_xen_pfn_t) extent_start; /* OUT */
75     unsigned int nr_extents; /* OUT */
76 };
77 
78 struct vki_xen_add_to_physmap {
79     vki_xen_domid_t domid;
80     vki_uint16_t size;
81 
82 #define VKI_XENMAPSPACE_shared_info  0
83 #define VKI_XENMAPSPACE_grant_table  1
84 #define VKI_XENMAPSPACE_gmfn         2
85 #define VKI_XENMAPSPACE_gmfn_range   3
86 #define VKI_XENMAPSPACE_gmfn_foreign 4
87 
88     unsigned int space;
89     vki_xen_ulong_t idx;
90     vki_xen_pfn_t gpfn;
91 };
92 
93 struct vki_xen_remove_from_physmap {
94     vki_xen_domid_t domid;
95     vki_xen_pfn_t gpfn;
96 };
97 
98 struct vki_xen_mem_event_op {
99     vki_uint8_t     op;
100     vki_xen_domid_t     domain;
101     vki_uint64_t    buffer;
102     vki_uint64_t    gfn;
103 };
104 
105 #endif // __VKI_XEN_MEMORY_H
106 
107 /*--------------------------------------------------------------------*/
108 /*--- end                                                          ---*/
109 /*--------------------------------------------------------------------*/
110