Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:25:34

0001 /*
0002    This file is part of Valgrind, a dynamic binary instrumentation
0003    framework.
0004 
0005    Copyright (C) 2012-2017 Citrix
0006 
0007    This program is free software; you can redistribute it and/or
0008    modify it under the terms of the GNU General Public License as
0009    published by the Free Software Foundation; either version 2 of the
0010    License, or (at your option) any later version.
0011 
0012    This program is distributed in the hope that it will be useful, but
0013    WITHOUT ANY WARRANTY; without even the implied warranty of
0014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015    General Public License for more details.
0016 
0017    You should have received a copy of the GNU General Public License
0018    along with this program; if not, see <http://www.gnu.org/licenses/>.
0019 
0020    The GNU General Public License is contained in the file COPYING.
0021 */
0022 
0023 /* Contributed by Andrew Cooper <andrew.cooper3@citrix.com>
0024    and Ian Campbell <ian.campbell@citrix.com> */
0025 
0026 #ifndef __VKI_XEN_DOMCTL_H
0027 #define __VKI_XEN_DOMCTL_H
0028 
0029 /*
0030  * The domctl interface is versioned via the interface_version
0031  * field. This structures in this header supports domctl interfaces:
0032  *
0033  * - 0x00000007: Xen 4.1
0034  * - 0x00000008: Xen 4.2
0035  * - 0x00000009: Xen 4.3 & 4.4
0036  * - 0x0000000a: Xen 4.5
0037  * - 0x0000000b: Xen 4.6
0038  * - 0x0000000c: Xen 4.7
0039  *
0040  * When adding a new subop be sure to include the variants used by all
0041  * of the above, both here and in syswrap-xen.c
0042  *
0043  * Structs which are identical in all supported versions have no
0044  * version suffix. Structs which do differ are defined multiple times
0045  * and use the suffix of the latest version to contain that particular
0046  * variant.
0047  */
0048 
0049 #define VKI_XEN_DOMCTL_createdomain                   1
0050 #define VKI_XEN_DOMCTL_destroydomain                  2
0051 #define VKI_XEN_DOMCTL_pausedomain                    3
0052 #define VKI_XEN_DOMCTL_unpausedomain                  4
0053 #define VKI_XEN_DOMCTL_getdomaininfo                  5
0054 #define VKI_XEN_DOMCTL_getmemlist                     6
0055 #define VKI_XEN_DOMCTL_getpageframeinfo               7
0056 #define VKI_XEN_DOMCTL_getpageframeinfo2              8
0057 #define VKI_XEN_DOMCTL_setvcpuaffinity                9
0058 #define VKI_XEN_DOMCTL_shadow_op                     10
0059 #define VKI_XEN_DOMCTL_max_mem                       11
0060 #define VKI_XEN_DOMCTL_setvcpucontext                12
0061 #define VKI_XEN_DOMCTL_getvcpucontext                13
0062 #define VKI_XEN_DOMCTL_getvcpuinfo                   14
0063 #define VKI_XEN_DOMCTL_max_vcpus                     15
0064 #define VKI_XEN_DOMCTL_scheduler_op                  16
0065 #define VKI_XEN_DOMCTL_setdomainhandle               17
0066 #define VKI_XEN_DOMCTL_setdebugging                  18
0067 #define VKI_XEN_DOMCTL_irq_permission                19
0068 #define VKI_XEN_DOMCTL_iomem_permission              20
0069 #define VKI_XEN_DOMCTL_ioport_permission             21
0070 #define VKI_XEN_DOMCTL_hypercall_init                22
0071 #define VKI_XEN_DOMCTL_arch_setup                    23
0072 #define VKI_XEN_DOMCTL_settimeoffset                 24
0073 #define VKI_XEN_DOMCTL_getvcpuaffinity               25
0074 #define VKI_XEN_DOMCTL_real_mode_area                26
0075 #define VKI_XEN_DOMCTL_resumedomain                  27
0076 #define VKI_XEN_DOMCTL_sendtrigger                   28
0077 #define VKI_XEN_DOMCTL_subscribe                     29
0078 #define VKI_XEN_DOMCTL_gethvmcontext                 33
0079 #define VKI_XEN_DOMCTL_sethvmcontext                 34
0080 #define VKI_XEN_DOMCTL_set_address_size              35
0081 #define VKI_XEN_DOMCTL_get_address_size              36
0082 #define VKI_XEN_DOMCTL_assign_device                 37
0083 #define VKI_XEN_DOMCTL_bind_pt_irq                   38
0084 #define VKI_XEN_DOMCTL_memory_mapping                39
0085 #define VKI_XEN_DOMCTL_ioport_mapping                40
0086 #define VKI_XEN_DOMCTL_pin_mem_cacheattr             41
0087 #define VKI_XEN_DOMCTL_set_ext_vcpucontext           42
0088 #define VKI_XEN_DOMCTL_get_ext_vcpucontext           43
0089 #define VKI_XEN_DOMCTL_set_opt_feature               44 /*Obsolete IA64 only */
0090 #define VKI_XEN_DOMCTL_test_assign_device            45
0091 #define VKI_XEN_DOMCTL_set_target                    46
0092 #define VKI_XEN_DOMCTL_deassign_device               47
0093 #define VKI_XEN_DOMCTL_unbind_pt_irq                 48
0094 #define VKI_XEN_DOMCTL_set_cpuid                     49
0095 #define VKI_XEN_DOMCTL_get_device_group              50
0096 #define VKI_XEN_DOMCTL_set_machine_address_size      51
0097 #define VKI_XEN_DOMCTL_get_machine_address_size      52
0098 #define VKI_XEN_DOMCTL_suppress_spurious_page_faults 53
0099 #define VKI_XEN_DOMCTL_debug_op                      54
0100 #define VKI_XEN_DOMCTL_gethvmcontext_partial         55
0101 #define VKI_XEN_DOMCTL_mem_event_op                  56
0102 #define VKI_XEN_DOMCTL_vm_event_op                   56 /* name change in 4.6 */
0103 #define VKI_XEN_DOMCTL_mem_sharing_op                57
0104 #define VKI_XEN_DOMCTL_disable_migrate               58
0105 #define VKI_XEN_DOMCTL_gettscinfo                    59
0106 #define VKI_XEN_DOMCTL_settscinfo                    60
0107 #define VKI_XEN_DOMCTL_getpageframeinfo3             61
0108 #define VKI_XEN_DOMCTL_setvcpuextstate               62
0109 #define VKI_XEN_DOMCTL_getvcpuextstate               63
0110 #define VKI_XEN_DOMCTL_set_access_required           64
0111 #define VKI_XEN_DOMCTL_audit_p2m                     65
0112 #define VKI_XEN_DOMCTL_set_virq_handler              66
0113 #define VKI_XEN_DOMCTL_set_broken_page_p2m           67
0114 #define VKI_XEN_DOMCTL_setnodeaffinity               68
0115 #define VKI_XEN_DOMCTL_getnodeaffinity               69
0116 #define VKI_XEN_DOMCTL_set_max_evtchn                70
0117 #define VKI_XEN_DOMCTL_cacheflush                    71
0118 #define VKI_XEN_DOMCTL_get_vcpu_msrs                 72
0119 #define VKI_XEN_DOMCTL_set_vcpu_msrs                 73
0120 #define VKI_XEN_DOMCTL_monitor_op                    77 /* new in 4.6 */
0121 #define VKI_XEN_DOMCTL_gdbsx_guestmemio            1000
0122 #define VKI_XEN_DOMCTL_gdbsx_pausevcpu             1001
0123 #define VKI_XEN_DOMCTL_gdbsx_unpausevcpu           1002
0124 #define VKI_XEN_DOMCTL_gdbsx_domstatus             1003
0125 
0126 struct vki_xen_domctl_createdomain {
0127     /* IN parameters */
0128     vki_uint32_t ssidref;
0129     vki_xen_domain_handle_t handle;
0130     vki_uint32_t flags;
0131 };
0132 
0133 struct vki_xen_domctl_getdomaininfo_00000007 {
0134     /* OUT variables. */
0135     vki_xen_domid_t  domain;
0136     vki_uint32_t flags;
0137     vki_xen_uint64_aligned_t tot_pages;
0138     vki_xen_uint64_aligned_t max_pages;
0139     vki_xen_uint64_aligned_t shr_pages;
0140     vki_xen_uint64_aligned_t paged_pages;
0141     vki_xen_uint64_aligned_t shared_info_frame;
0142     vki_xen_uint64_aligned_t cpu_time;
0143     vki_uint32_t nr_online_vcpus;
0144     vki_uint32_t max_vcpu_id;
0145     vki_uint32_t ssidref;
0146     vki_xen_domain_handle_t handle;
0147     vki_uint32_t cpupool;
0148 };
0149 typedef struct vki_xen_domctl_getdomaininfo_00000007 vki_xen_domctl_getdomaininfo_00000007_t;
0150 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000007_t);
0151 
0152 struct vki_xen_domctl_getdomaininfo_00000008 {
0153     /* OUT variables. */
0154     vki_xen_domid_t  domain;
0155     vki_uint32_t flags;
0156     vki_xen_uint64_aligned_t tot_pages;
0157     vki_xen_uint64_aligned_t max_pages;
0158     vki_xen_uint64_aligned_t shr_pages;
0159     vki_xen_uint64_aligned_t paged_pages;
0160     vki_xen_uint64_aligned_t shared_info_frame;
0161     vki_xen_uint64_aligned_t cpu_time;
0162     vki_uint32_t nr_online_vcpus;
0163     vki_uint32_t max_vcpu_id;
0164     vki_uint32_t ssidref;
0165     vki_xen_domain_handle_t handle;
0166     vki_uint32_t cpupool;
0167 };
0168 typedef struct vki_xen_domctl_getdomaininfo_00000008 vki_xen_domctl_getdomaininfo_00000008_t;
0169 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000008_t);
0170 
0171 struct vki_xen_domctl_getdomaininfo_00000009 {
0172     /* OUT variables. */
0173     vki_xen_domid_t  domain;
0174     vki_uint32_t flags;
0175     vki_xen_uint64_aligned_t tot_pages;
0176     vki_xen_uint64_aligned_t max_pages;
0177     vki_xen_uint64_aligned_t outstanding_pages;
0178     vki_xen_uint64_aligned_t shr_pages;
0179     vki_xen_uint64_aligned_t paged_pages;
0180     vki_xen_uint64_aligned_t shared_info_frame;
0181     vki_xen_uint64_aligned_t cpu_time;
0182     vki_uint32_t nr_online_vcpus;
0183     vki_uint32_t max_vcpu_id;
0184     vki_uint32_t ssidref;
0185     vki_xen_domain_handle_t handle;
0186     vki_uint32_t cpupool;
0187 };
0188 typedef struct vki_xen_domctl_getdomaininfo_00000009 vki_xen_domctl_getdomaininfo_00000009_t;
0189 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t);
0190 
0191 // x86 version only for now
0192 struct vki_xen_arch_domainconfig_00000010 {
0193     vki_uint32_t emulation_flags;
0194 };
0195 
0196 struct vki_xen_domctl_getdomaininfo_00000010 {
0197     /* OUT variables. */
0198     vki_xen_domid_t  domain;
0199     vki_uint32_t flags;
0200     vki_xen_uint64_aligned_t tot_pages;
0201     vki_xen_uint64_aligned_t max_pages;
0202     vki_xen_uint64_aligned_t outstanding_pages;
0203     vki_xen_uint64_aligned_t shr_pages;
0204     vki_xen_uint64_aligned_t paged_pages;
0205     vki_xen_uint64_aligned_t shared_info_frame;
0206     vki_xen_uint64_aligned_t cpu_time;
0207     vki_uint32_t nr_online_vcpus;
0208     vki_uint32_t max_vcpu_id;
0209     vki_uint32_t ssidref;
0210     vki_xen_domain_handle_t handle;
0211     vki_uint32_t cpupool;
0212     struct vki_xen_arch_domainconfig_00000010 arch;
0213 };
0214 typedef struct vki_xen_domctl_getdomaininfo_00000010 vki_xen_domctl_getdomaininfo_00000010_t;
0215 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000010_t);
0216 
0217 /* vki_xen_domctl_getdomaininfo_0000000a is the same as 00000009 */
0218 
0219 /* Get/set the NUMA node(s) with which the guest has affinity with. */
0220 /* XEN_DOMCTL_setnodeaffinity */
0221 /* XEN_DOMCTL_getnodeaffinity */
0222 struct vki_xen_domctl_nodeaffinity {
0223     struct vki_xenctl_bitmap nodemap;/* IN */
0224 };
0225 typedef struct vki_xen_domctl_nodeaffinity vki_xen_domctl_nodeaffinity_t;
0226 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_nodeaffinity_t);
0227 
0228 struct vki_xen_domctl_getpageframeinfo3 {
0229     vki_xen_uint64_aligned_t num; /* IN */
0230     VKI_XEN_GUEST_HANDLE_64(vki_xen_pfn_t) array; /* IN/OUT */
0231 };
0232 
0233 struct vki_xen_domctl_vcpuaffinity_00000009 {
0234     vki_uint32_t  vcpu;              /* IN */
0235     struct vki_xenctl_bitmap cpumap; /* IN/OUT */
0236 };
0237 
0238 struct vki_xen_domctl_vcpuaffinity_0000000a {
0239     vki_uint32_t  vcpu;              /* IN */
0240 #define VKI_XEN_VCPUAFFINITY_HARD   (1U<<0)
0241 #define VKI_XEN_VCPUAFFINITY_SOFT   (1U<<1)
0242     vki_uint32_t  flags;              /* IN */
0243     struct vki_xenctl_bitmap cpumap_hard; /* IN/OUT */
0244     struct vki_xenctl_bitmap cpumap_soft; /* IN/OUT */
0245 };
0246 
0247 struct vki_xen_domctl_shadow_op_stats {
0248     vki_uint32_t fault_count;
0249     vki_uint32_t dirty_count;
0250 };
0251 
0252 /* vki_xen_domctl_shadow_op.op is an utter mess for compatibily reasons. */
0253 
0254 struct vki_xen_domctl_shadow_op {
0255     vki_uint32_t op; /* IN */
0256 
0257 #define VKI_XEN_DOMCTL_SHADOW_OP_OFF               0
0258 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE           32
0259 #define VKI_XEN_DOMCTL_SHADOW_OP_CLEAN            11
0260 #define VKI_XEN_DOMCTL_SHADOW_OP_PEEK             12
0261 #define VKI_XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
0262 #define VKI_XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
0263 
0264 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
0265 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
0266 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
0267 
0268     vki_uint32_t mode;
0269 
0270 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
0271 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
0272 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
0273 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
0274 
0275     vki_uint32_t mb;
0276     VKI_XEN_GUEST_HANDLE_64(vki_uint8) dirty_bitmap;
0277     vki_xen_uint64_aligned_t pages;
0278     struct vki_xen_domctl_shadow_op_stats stats;
0279 };
0280 
0281 struct vki_xen_domctl_max_mem {
0282     /* IN variables. */
0283     vki_xen_uint64_aligned_t max_memkb;
0284 };
0285 
0286 struct vki_xen_domctl_vcpucontext {
0287     vki_uint32_t              vcpu;                  /* IN */
0288     VKI_XEN_GUEST_HANDLE_64(vki_xen_vcpu_guest_context_t) ctxt; /* IN/OUT */
0289 };
0290 
0291 struct vki_xen_domctl_getvcpuinfo {
0292     /* IN variables. */
0293     vki_uint32_t vcpu;
0294     /* OUT variables. */
0295     vki_uint8_t  online;              /* currently online (not hotplugged)? */
0296     vki_uint8_t  blocked;             /* blocked waiting for an event? */
0297     vki_uint8_t  running;             /* currently scheduled on its CPU? */
0298     vki_xen_uint64_aligned_t cpu_time;/* total cpu time consumed (ns) */
0299     vki_uint32_t cpu;                 /* current mapping   */
0300 };
0301 
0302 struct vki_xen_domctl_scheduler_op {
0303     vki_uint32_t sched_id;  /* VKI_XEN_SCHEDULER_* */
0304 #define VKI_XEN_SCHEDULER_SEDF     4
0305 #define VKI_XEN_SCHEDULER_CREDIT   5
0306 #define VKI_XEN_SCHEDULER_CREDIT2  6
0307 #define VKI_XEN_SCHEDULER_ARINC653 7
0308 #define VKI_XEN_SCHEDULER_RTDS     8
0309     vki_uint32_t cmd;       /* VKI_XEN_DOMCTL_SCHEDOP_* */
0310 #define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
0311 #define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
0312     union {
0313         struct xen_domctl_sched_sedf {
0314             vki_xen_uint64_aligned_t period;
0315             vki_xen_uint64_aligned_t slice;
0316             vki_xen_uint64_aligned_t latency;
0317             vki_uint32_t extratime;
0318             vki_uint32_t weight;
0319         } sedf;
0320         struct xen_domctl_sched_credit {
0321             vki_uint16_t weight;
0322             vki_uint16_t cap;
0323         } credit;
0324         struct xen_domctl_sched_credit2 {
0325             vki_uint16_t weight;
0326         } credit2;
0327         struct xen_domctl_sched_rtds {
0328             vki_uint32_t period;
0329             vki_uint32_t budget;
0330         } rtds;
0331     } u;
0332 };
0333 
0334 struct vki_xen_domctl_max_vcpus {
0335     vki_uint32_t max;           /* maximum number of vcpus */
0336 };
0337 
0338 /* XEN_DOMCTL_irq_permission */
0339 struct vki_xen_domctl_irq_permission {
0340     vki_uint8_t pirq;
0341     vki_uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
0342 };
0343 
0344 struct vki_xen_domctl_iomem_permission {
0345     vki_xen_uint64_aligned_t first_mfn;/* first page (physical page number) in range */
0346     vki_xen_uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
0347     vki_uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
0348 };
0349 
0350 struct vki_xen_domctl_ioport_permission {
0351     vki_uint32_t first_port;              /* IN */
0352     vki_uint32_t nr_ports;                /* IN */
0353     vki_uint8_t  allow_access;            /* IN */
0354 };
0355 
0356 struct vki_xen_domctl_hypercall_init {
0357     vki_xen_uint64_aligned_t  gmfn;           /* GMFN to be initialised */
0358 };
0359 
0360 struct vki_xen_domctl_settimeoffset {
0361     vki_int32_t time_offset_seconds;
0362 };
0363 
0364 struct vki_xen_domctl_cpuid {
0365   vki_uint32_t input[2];
0366   vki_uint32_t eax;
0367   vki_uint32_t ebx;
0368   vki_uint32_t ecx;
0369   vki_uint32_t edx;
0370 };
0371 
0372 struct vki_xen_guest_tsc_info {
0373     vki_uint32_t tsc_mode;
0374     vki_uint32_t gtsc_khz;
0375     vki_uint32_t incarnation;
0376     vki_uint32_t pad;
0377     vki_xen_uint64_aligned_t elapsed_nsec;
0378 };
0379 typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t;
0380 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t);
0381 
0382 struct vki_xen_domctl_tsc_info_00000007 {
0383     VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t) out_info; /* OUT */
0384     vki_xen_guest_tsc_info_t info; /* IN */
0385 };
0386 
0387 /* 4.6 removed the output pointer */
0388 struct vki_xen_domctl_tsc_info_0000000b {
0389     /* IN/OUT */
0390     vki_uint32_t tsc_mode;
0391     vki_uint32_t gtsc_khz;
0392     vki_uint32_t incarnation;
0393     vki_uint32_t pad;
0394     vki_xen_uint64_aligned_t elapsed_nsec;
0395 };
0396 
0397 
0398 struct vki_xen_domctl_hvmcontext {
0399     vki_uint32_t size; /* IN/OUT size of buffer */
0400     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT */
0401 };
0402 typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
0403 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
0404 
0405 struct vki_xen_domctl_hvmcontext_partial_00000007 {
0406     vki_uint32_t type; /* IN */
0407     vki_uint32_t instance; /* IN */
0408     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT buffer */
0409 };
0410 typedef struct vki_xen_domctl_hvmcontext_partial_00000007 vki_xen_domctl_hvmcontext_partial_00000007_t;
0411 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_00000007_t);
0412 
0413 struct vki_xen_domctl_hvmcontext_partial_0000000e {
0414     vki_uint32_t type; /* IN */
0415     vki_uint32_t instance; /* IN */
0416     vki_xen_uint64_aligned_t bufsz; /* IN */
0417     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* OUT buffer */
0418 };
0419 typedef struct vki_xen_domctl_hvmcontext_partial_0000000e vki_xen_domctl_hvmcontext_partial_0000000e_t;
0420 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_0000000e_t);
0421 
0422 struct vki_xen_domctl_pin_mem_cacheattr {
0423     vki_xen_uint64_aligned_t start, end; /* IN */
0424     vki_uint32_t type;                   /* IN */
0425 };
0426 
0427 struct vki_xen_domctl_ext_vcpucontext_00000008 {
0428     vki_uint32_t             vcpu; /* IN */
0429 
0430     /* IN  for XEN_DOMCTL_set_ext_vcpucontext
0431      * OUT for XEN_DOMCTL_get_ext_vcpucontext */
0432     vki_uint32_t             size;
0433 #if defined(__i386__) || defined(__x86_64__)
0434     vki_xen_uint64_aligned_t syscall32_callback_eip;
0435     vki_xen_uint64_aligned_t sysenter_callback_eip;
0436     vki_uint16_t             syscall32_callback_cs;
0437     vki_uint16_t             sysenter_callback_cs;
0438     vki_uint8_t              syscall32_disables_events;
0439     vki_uint8_t              sysenter_disables_events;
0440     vki_xen_uint64_aligned_t mcg_cap;
0441 #endif
0442 };
0443 
0444 struct vki_xen_domctl_ext_vcpucontext_00000009 {
0445     vki_uint32_t             vcpu; /* IN */
0446 
0447     /* IN  for XEN_DOMCTL_set_ext_vcpucontext
0448      * OUT for XEN_DOMCTL_get_ext_vcpucontext */
0449     vki_uint32_t             size;
0450 #if defined(__i386__) || defined(__x86_64__)
0451     vki_xen_uint64_aligned_t syscall32_callback_eip;
0452     vki_xen_uint64_aligned_t sysenter_callback_eip;
0453     vki_uint16_t             syscall32_callback_cs;
0454     vki_uint16_t             sysenter_callback_cs;
0455     vki_uint8_t              syscall32_disables_events;
0456     vki_uint8_t              sysenter_disables_events;
0457     vki_uint64_t             caps;
0458     vki_uint64_t             mci_ctl2_bank0;
0459     vki_uint64_t             mci_ctl2_bank1;
0460 #endif
0461 };
0462 
0463 /* vki_xen_domctl_ext_vcpucontext_0000000a is the same as 00000009 */
0464 
0465 struct vki_xen_domctl_vcpuextstate {
0466     vki_uint32_t         vcpu;
0467     vki_xen_uint64_aligned_t         xfeature_mask;
0468     vki_xen_uint64_aligned_t         size;
0469     VKI_XEN_GUEST_HANDLE_64(vki_uint64) buffer;
0470 };
0471 
0472 struct vki_xen_domctl_address_size {
0473     vki_uint32_t size;
0474 };
0475 
0476 /* vki_xen_domctl_assign_device_00000007 is the same up to version 0x0000000b */
0477 struct vki_xen_domctl_assign_device_00000007 {
0478     vki_uint32_t  machine_sbdf;   /* machine PCI ID of assigned device */
0479 };
0480 
0481 #define VKI_XEN_DOMCTL_DEV_PCI      0
0482 #define VKI_XEN_DOMCTL_DEV_DT       1
0483 struct vki_xen_domctl_assign_device_0000000b {
0484     vki_uint32_t dev;   /* XEN_DOMCTL_DEV_* */
0485     union {
0486         struct {
0487             vki_uint32_t machine_sbdf;   /* machine PCI ID of assigned device */
0488         } pci;
0489         struct {
0490             vki_uint32_t size; /* Length of the path */
0491             VKI_XEN_GUEST_HANDLE_64(vki_uint8) path; /* path to the device tree node */
0492         } dt;
0493     } u;
0494     /* IN */
0495 //#define XEN_DOMCTL_DEV_RDM_RELAXED      1
0496     vki_uint32_t  flag;   /* flag of assigned device */
0497 };
0498 
0499 struct vki_xen_domctl_debug_op {
0500     vki_uint32_t op;   /* IN */
0501     vki_uint32_t vcpu; /* IN */
0502 };
0503 typedef struct vki_xen_domctl_debug_op vki_xen_domctl_debug_op_t;
0504 
0505 struct vki_xen_domctl_mem_event_op_00000007 {
0506     vki_uint32_t op; /* IN */
0507     vki_uint32_t mode; /* IN */
0508     vki_uint32_t port; /* OUT */
0509 };
0510 
0511 /* only a name change in 4.6 */
0512 typedef struct vki_xen_domctl_mem_event_op_00000007 vki_xen_domctl_vm_event_op_0000000b;
0513 
0514 struct vki_xen_domctl_vm_event_op_00000012 {
0515     vki_uint32_t op; /* IN */
0516     vki_uint32_t mode; /* IN */
0517 
0518     union {
0519         struct {
0520             vki_uint32_t port; /* OUT */
0521         } enable;
0522 
0523         vki_uint32_t version;
0524     } u;
0525 };
0526 
0527 struct vki_xen_domctl_set_access_required {
0528     vki_uint8_t access_required; /* IN */
0529 };
0530 
0531 struct vki_xen_domctl_set_max_evtchn {
0532     vki_uint32_t max_port;
0533 };
0534 
0535 struct vki_xen_domctl_cacheflush {
0536     /* IN: page range to flush. */
0537     vki_xen_pfn_t start_pfn, nr_pfns;
0538 };
0539 
0540 struct vki_xen_domctl_vcpu_msr {
0541     vki_uint32_t             index;
0542     vki_uint32_t             reserved;
0543     vki_xen_uint64_aligned_t value;
0544 };
0545 typedef struct vki_xen_domctl_vcpu_msr vki_xen_domctl_vcpu_msr_t;
0546 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_vcpu_msr_t);
0547 
0548 struct vki_xen_domctl_vcpu_msrs {
0549     vki_uint32_t vcpu;
0550     vki_uint32_t msr_count;
0551     VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_vcpu_msr_t) msrs;
0552 };
0553 
0554 #define VKI_XEN_DOMCTL_MONITOR_OP_ENABLE            0
0555 #define VKI_XEN_DOMCTL_MONITOR_OP_DISABLE           1
0556 #define VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
0557 #define VKI_XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
0558 
0559 #define VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
0560 #define VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
0561 #define VKI_XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP            2
0562 #define VKI_XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT   3
0563 #define VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST         4
0564 #define VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION       5
0565 #define VKI_XEN_DOMCTL_MONITOR_EVENT_CPUID                 6
0566 #define VKI_XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL       7
0567 #define VKI_XEN_DOMCTL_MONITOR_EVENT_INTERRUPT             8
0568 #define VKI_XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS           9
0569 #define VKI_XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED    10
0570 #define VKI_XEN_DOMCTL_MONITOR_EVENT_INGUEST_PAGEFAULT     11
0571 
0572 struct vki_xen_domctl_monitor_op_0000000b {
0573     vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
0574 
0575     /*
0576      * When used with ENABLE/DISABLE this has to be set to
0577      * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
0578      * With GET_CAPABILITIES this field returns a bitmap of
0579      * events supported by the platform, in the format
0580      * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
0581      */
0582     vki_uint32_t event;
0583 
0584     /*
0585      * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
0586      */
0587     union {
0588         struct {
0589             /* Which control register */
0590             vki_uint8_t index;
0591             /* Pause vCPU until response */
0592             vki_uint8_t sync;
0593             /* Send event only on a change of value */
0594             vki_uint8_t onchangeonly;
0595         } mov_to_cr;
0596 
0597         struct {
0598             /* Enable the capture of an extended set of MSRs */
0599             vki_uint8_t extended_capture;
0600         } mov_to_msr;
0601 
0602         struct {
0603             /* Pause vCPU until response */
0604             vki_uint8_t sync;
0605         } guest_request;
0606     } u;
0607 };
0608 
0609 struct vki_xen_domctl_monitor_op_00000011 {
0610     vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
0611 
0612     /*
0613      * When used with ENABLE/DISABLE this has to be set to
0614      * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
0615      * With GET_CAPABILITIES this field returns a bitmap of
0616      * events supported by the platform, in the format
0617      * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
0618      */
0619     vki_uint32_t event;
0620 
0621     /*
0622      * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
0623      */
0624     union {
0625         struct {
0626             /* Which control register */
0627             vki_uint8_t index;
0628             /* Pause vCPU until response */
0629             vki_uint8_t sync;
0630             /* Send event only on a change of value */
0631             vki_uint8_t onchangeonly;
0632             /* Allignment padding */
0633             vki_uint8_t pad1;
0634             vki_uint32_t pad2;
0635             /*
0636              * Send event only if the changed bit in the control register
0637              * is not masked.
0638              */
0639             vki_xen_uint64_aligned_t bitmask;
0640         } mov_to_cr;
0641 
0642         struct {
0643             vki_uint32_t msr;
0644             vki_uint8_t onchangeonly;
0645         } mov_to_msr;
0646 
0647         struct {
0648             /* Pause vCPU until response */
0649             vki_uint8_t sync;
0650             vki_uint8_t allow_userspace;
0651         } guest_request;
0652 
0653         struct {
0654             /* Pause vCPU until response */
0655             vki_uint8_t sync;
0656         } debug_exception;
0657     } u;
0658 };
0659 
0660 struct vki_xen_domctl {
0661     vki_uint32_t cmd;
0662     vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
0663     vki_xen_domid_t  domain;
0664     union {
0665         struct vki_xen_domctl_createdomain      createdomain;
0666         struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
0667         struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
0668         struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
0669         //struct vki_xen_domctl_getmemlist        getmemlist;
0670         //struct vki_xen_domctl_getpageframeinfo  getpageframeinfo;
0671         //struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
0672         struct vki_xen_domctl_getpageframeinfo3 getpageframeinfo3;
0673         struct vki_xen_domctl_nodeaffinity      nodeaffinity;
0674         struct vki_xen_domctl_vcpuaffinity_00000009 vcpuaffinity_00000009;
0675         struct vki_xen_domctl_vcpuaffinity_0000000a vcpuaffinity_0000000a;
0676         struct vki_xen_domctl_shadow_op         shadow_op;
0677         struct vki_xen_domctl_max_mem           max_mem;
0678         struct vki_xen_domctl_vcpucontext       vcpucontext;
0679         struct vki_xen_domctl_getvcpuinfo       getvcpuinfo;
0680         struct vki_xen_domctl_max_vcpus         max_vcpus;
0681         struct vki_xen_domctl_scheduler_op      scheduler_op;
0682         //struct vki_xen_domctl_setdomainhandle   setdomainhandle;
0683         //struct vki_xen_domctl_setdebugging      setdebugging;
0684         struct vki_xen_domctl_irq_permission    irq_permission;
0685         struct vki_xen_domctl_iomem_permission  iomem_permission;
0686         struct vki_xen_domctl_ioport_permission ioport_permission;
0687         struct vki_xen_domctl_hypercall_init    hypercall_init;
0688         //struct vki_xen_domctl_arch_setup        arch_setup;
0689         struct vki_xen_domctl_settimeoffset     settimeoffset;
0690         //struct vki_xen_domctl_disable_migrate   disable_migrate;
0691         struct vki_xen_domctl_tsc_info_00000007   tsc_info_00000007;
0692         struct vki_xen_domctl_tsc_info_0000000b   tsc_info_0000000b;
0693         //struct vki_xen_domctl_real_mode_area    real_mode_area;
0694         struct vki_xen_domctl_hvmcontext        hvmcontext;
0695         struct vki_xen_domctl_hvmcontext_partial_0000000e hvmcontext_partial_00000007;
0696         struct vki_xen_domctl_hvmcontext_partial_0000000e hvmcontext_partial_0000000e;
0697         struct vki_xen_domctl_address_size      address_size;
0698         //struct vki_xen_domctl_sendtrigger       sendtrigger;
0699         //struct vki_xen_domctl_get_device_group  get_device_group;
0700         struct vki_xen_domctl_assign_device_00000007 assign_device_00000007;
0701         struct vki_xen_domctl_assign_device_0000000b assign_device_0000000b;
0702         //struct vki_xen_domctl_bind_pt_irq       bind_pt_irq;
0703         //struct vki_xen_domctl_memory_mapping    memory_mapping;
0704         //struct vki_xen_domctl_ioport_mapping    ioport_mapping;
0705         struct vki_xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
0706         struct vki_xen_domctl_ext_vcpucontext_00000008 ext_vcpucontext_00000008;
0707         struct vki_xen_domctl_ext_vcpucontext_00000009 ext_vcpucontext_00000009;
0708         //struct vki_xen_domctl_set_target        set_target;
0709         //struct vki_xen_domctl_subscribe         subscribe;
0710         struct vki_xen_domctl_debug_op          debug_op;
0711         struct vki_xen_domctl_mem_event_op_00000007 mem_event_op_00000007;
0712         vki_xen_domctl_vm_event_op_0000000b vm_event_op_0000000b;
0713         struct vki_xen_domctl_vm_event_op_00000012 vm_event_op_00000012;
0714         //struct vki_xen_domctl_mem_sharing_op    mem_sharing_op;
0715 #if defined(__i386__) || defined(__x86_64__)
0716         struct vki_xen_domctl_cpuid             cpuid;
0717         struct vki_xen_domctl_vcpuextstate      vcpuextstate;
0718         struct vki_xen_domctl_vcpu_msrs         vcpu_msrs;
0719 #endif
0720         struct vki_xen_domctl_set_access_required access_required;
0721         //struct vki_xen_domctl_audit_p2m         audit_p2m;
0722         //struct vki_xen_domctl_set_virq_handler  set_virq_handler;
0723         struct vki_xen_domctl_set_max_evtchn    set_max_evtchn;
0724         //struct vki_xen_domctl_gdbsx_memio       gdbsx_guest_memio;
0725         //struct vki_xen_domctl_set_broken_page_p2m set_broken_page_p2m;
0726         struct vki_xen_domctl_cacheflush        cacheflush;
0727         //struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
0728         //struct vki_xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
0729         struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
0730         struct vki_xen_domctl_monitor_op_00000011 monitor_op_00000011;
0731         vki_uint8_t                         pad[128];
0732     } u;
0733 };
0734 
0735 #endif // __VKI_XEN_DOMCTL_H
0736 
0737 /*--------------------------------------------------------------------*/
0738 /*--- end                                                          ---*/
0739 /*--------------------------------------------------------------------*/