1 /*
2    This file is part of Valgrind, a dynamic binary instrumentation
3    framework.
4 
5    Copyright (C) 2012-2015 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_TMEM_H
29 #define __VKI_XEN_TMEM_H
30 
31 typedef VKI_XEN_GUEST_HANDLE(char) vki_xen_tmem_cli_va_t;
32 
33 
34 /* version of ABI */
35 #define VKI_XEN_TMEM_spec_version          1
36 
37 /* Commands to HYPERVISOR_tmem_op() */
38 #define VKI_XEN_TMEM_control               0
39 #define VKI_XEN_TMEM_new_pool              1
40 #define VKI_XEN_TMEM_destroy_pool          2
41 #define VKI_XEN_TMEM_new_page              3
42 #define VKI_XEN_TMEM_put_page              4
43 #define VKI_XEN_TMEM_get_page              5
44 #define VKI_XEN_TMEM_flush_page            6
45 #define VKI_XEN_TMEM_flush_object          7
46 #define VKI_XEN_TMEM_read                  8
47 #define VKI_XEN_TMEM_write                 9
48 #define VKI_XEN_TMEM_xchg                 10
49 /* Privileged commands to HYPERVISOR_tmem_op() */
50 #define VKI_XEN_tmem_auth                 101
51 #define VKI_XEN_tmem_restore_new          102
52 
53 /* for cmd = TMEM_CONTROL */
54 struct vki_xen_tmem_ctrl {
55     vki_uint32_t subop;
56 
57 /* Subops for HYPERVISOR_tmem_op(TMEM_CONTROL) */
58 #define VKI_XEN_TMEMC_thaw                   0
59 #define VKI_XEN_TMEMC_freeze                 1
60 #define VKI_XEN_TMEMC_flush                  2
61 #define VKI_XEN_TMEMC_destroy                3
62 #define VKI_XEN_TMEMC_list                   4
63 #define VKI_XEN_TMEMC_set_weight             5
64 #define VKI_XEN_TMEMC_set_cap                6
65 #define VKI_XEN_TMEMC_set_compress           7
66 #define VKI_XEN_TMEMC_query_freeable_mb      8
67 #define VKI_XEN_TMEMC_save_begin             10
68 #define VKI_XEN_TMEMC_save_get_version       11
69 #define VKI_XEN_TMEMC_save_get_maxpools      12
70 #define VKI_XEN_TMEMC_save_get_client_weight 13
71 #define VKI_XEN_TMEMC_save_get_client_cap    14
72 #define VKI_XEN_TMEMC_save_get_client_flags  15
73 #define VKI_XEN_TMEMC_save_get_pool_flags    16
74 #define VKI_XEN_TMEMC_save_get_pool_npages   17
75 #define VKI_XEN_TMEMC_save_get_pool_uuid     18
76 #define VKI_XEN_TMEMC_save_get_next_page     19
77 #define VKI_XEN_TMEMC_save_get_next_inv      20
78 #define VKI_XEN_TMEMC_save_end               21
79 #define VKI_XEN_TMEMC_restore_begin          30
80 #define VKI_XEN_TMEMC_restore_put_page       32
81 #define VKI_XEN_TMEMC_restore_flush_page     33
82 
83     vki_uint32_t cli_id;
84     vki_uint32_t arg1;
85     vki_uint32_t arg2;
86     vki_uint64_t oid[3];
87     vki_xen_tmem_cli_va_t buf;
88 };
89 
90 struct vki_xen_tmem_op {
91     vki_uint32_t cmd;
92     vki_int32_t pool_id;
93     union {
94         struct vki_xen_tmem_ctrl ctrl;
95     } u;
96 };
97 
98 #endif // __VKI_XEN_TMEM_H
99 
100 /*--------------------------------------------------------------------*/
101 /*--- end                                                          ---*/
102 /*--------------------------------------------------------------------*/
103