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_HVM_H
0027 #define __VKI_XEN_HVM_H
0028 
0029 /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
0030 #define VKI_XEN_HVMOP_set_param           0
0031 #define VKI_XEN_HVMOP_get_param           1
0032 struct vki_xen_hvm_param {
0033     vki_xen_domid_t  domid;    /* IN */
0034     vki_uint32_t index;    /* IN */
0035     vki_uint64_t value;    /* IN/OUT */
0036 };
0037 
0038 #define VKI_XEN_HVMOP_set_pci_intx_level  2
0039 struct vki_xen_hvm_set_pci_intx_level {
0040     vki_xen_domid_t  domid;
0041     vki_uint8_t  domain, bus, device, intx;
0042     vki_uint8_t  level;
0043 };
0044 typedef struct vki_xen_hvm_set_pci_intx_level vki_xen_hvm_set_pci_intx_level_t;
0045 
0046 #define VKI_XEN_HVMOP_set_isa_irq_level 3
0047 struct vki_xen_hvm_set_isa_irq_level {
0048     vki_xen_domid_t  domid;
0049     vki_uint8_t  isa_irq;
0050     vki_uint8_t  level;
0051 };
0052 typedef struct vki_xen_hvm_set_isa_irq_level vki_xen_hvm_set_isa_irq_level_t;
0053 
0054 #define VKI_XEN_HVMOP_set_pci_link_route 4
0055 struct vki_xen_hvm_set_pci_link_route {
0056     vki_xen_domid_t  domid;
0057     vki_uint8_t  link;
0058     vki_uint8_t  isa_irq;
0059 };
0060 typedef struct vki_xen_hvm_set_pci_link_route vki_xen_hvm_set_pci_link_route_t;
0061 
0062 #define VKI_XEN_HVMOP_track_dirty_vram 6
0063 struct vki_xen_hvm_track_dirty_vram {
0064     vki_xen_domid_t  domid;                          /* IN  */
0065     vki_xen_uint64_aligned_t first_pfn;              /* IN  */
0066     vki_xen_uint64_aligned_t nr;                     /* IN  */
0067     VKI_XEN_GUEST_HANDLE_64(vki_uint8) dirty_bitmap; /* OUT */
0068 };
0069 typedef struct vki_xen_hvm_track_dirty_vram vki_xen_hvm_track_dirty_vram_t;
0070 
0071 #define VKI_XEN_HVMOP_set_mem_type 8
0072 struct vki_xen_hvm_set_mem_type {
0073     vki_xen_domid_t  domid;
0074     vki_uint16_t hvmmem_type;
0075     vki_uint32_t nr;
0076     vki_uint64_t first_pfn;
0077 };
0078 typedef struct vki_xen_hvm_set_mem_type vki_xen_hvm_set_mem_type_t;
0079 
0080 #define VKI_XEN_HVMOP_set_mem_access        12
0081 struct vki_xen_hvm_set_mem_access {
0082     vki_xen_domid_t domid;
0083     vki_uint16_t hvmmem_access;
0084     vki_uint32_t nr;
0085     vki_uint64_t first_pfn;
0086 };
0087 typedef struct vki_xen_hvm_set_mem_access vki_xen_hvm_set_mem_access_t;
0088 
0089 #define VKI_XEN_HVMOP_get_mem_access        13
0090 struct vki_xen_hvm_get_mem_access {
0091     vki_xen_domid_t domid;
0092     vki_uint16_t hvmmem_access; /* OUT */
0093     vki_uint64_t pfn;
0094 };
0095 typedef struct vki_xen_hvm_get_mem_access vki_xen_hvm_get_mem_access_t;
0096 
0097 #define VKI_XEN_HVMOP_inject_trap            14
0098 struct vki_xen_hvm_inject_trap {
0099     vki_xen_domid_t domid;
0100     vki_uint32_t vcpuid;
0101     vki_uint32_t vector;
0102     vki_uint32_t type;
0103     vki_uint32_t error_code;
0104     vki_uint32_t insn_len;
0105     vki_uint64_t cr2;
0106 };
0107 typedef struct vki_xen_hvm_inject_trap vki_xen_hvm_inject_trap_t;
0108 
0109 #define VKI_XEN_HVMOP_altp2m 25
0110 #define VKI_XEN_HVMOP_altp2m_get_domain_state     1
0111 #define VKI_XEN_HVMOP_altp2m_set_domain_state     2
0112 #define VKI_XEN_HVMOP_altp2m_vcpu_enable_notify   3
0113 #define VKI_XEN_HVMOP_altp2m_create_p2m           4
0114 #define VKI_XEN_HVMOP_altp2m_destroy_p2m          5
0115 #define VKI_XEN_HVMOP_altp2m_switch_p2m           6
0116 #define VKI_XEN_HVMOP_altp2m_set_mem_access       7
0117 #define VKI_XEN_HVMOP_altp2m_change_gfn           8
0118 struct vki_xen_hvm_altp2m_domain_state {
0119     /* IN or OUT variable on/off */
0120     vki_uint8_t state;
0121 };
0122 typedef struct vki_xen_hvm_altp2m_domain_state vki_xen_hvm_altp2m_domain_state_t;
0123 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_domain_state_t);
0124 
0125 struct vki_xen_hvm_altp2m_vcpu_enable_notify {
0126     vki_uint32_t vcpu_id;
0127     vki_uint32_t pad;
0128     /* #VE info area gfn */
0129     vki_uint64_t gfn;
0130 };
0131 typedef struct vki_xen_hvm_altp2m_vcpu_enable_notify vki_xen_hvm_altp2m_vcpu_enable_notify_t;
0132 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_vcpu_enable_notify_t);
0133 
0134 struct vki_xen_hvm_altp2m_view {
0135     /* IN/OUT variable */
0136     vki_uint16_t view;
0137     /* Create view only: default access type
0138      * NOTE: currently ignored */
0139     vki_uint16_t hvmmem_default_access; /* xenmem_access_t */
0140 };
0141 typedef struct vki_xen_hvm_altp2m_view vki_xen_hvm_altp2m_view_t;
0142 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_view_t);
0143 
0144 struct vki_xen_hvm_altp2m_set_mem_access {
0145     /* view */
0146     vki_uint16_t view;
0147     /* Memory type */
0148     vki_uint16_t hvmmem_access; /* xenmem_access_t */
0149     vki_uint32_t pad;
0150     /* gfn */
0151     vki_uint64_t gfn;
0152 };
0153 typedef struct vki_xen_hvm_altp2m_set_mem_access vki_xen_hvm_altp2m_set_mem_access_t;
0154 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_set_mem_access_t);
0155 
0156 struct vki_xen_hvm_altp2m_change_gfn {
0157     /* view */
0158     vki_uint16_t view;
0159     vki_uint16_t pad1;
0160     vki_uint32_t pad2;
0161     /* old gfn */
0162     vki_uint64_t old_gfn;
0163     /* new gfn, INVALID_GFN (~0UL) means revert */
0164     vki_uint64_t new_gfn;
0165 };
0166 typedef struct vki_xen_hvm_altp2m_change_gfn vki_xen_hvm_altp2m_change_gfn_t;
0167 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_change_gfn_t);
0168 
0169 struct vki_xen_hvm_altp2m_op {
0170     vki_uint32_t version;   /* HVMOP_ALTP2M_INTERFACE_VERSION */
0171     vki_uint32_t cmd;
0172     vki_xen_domid_t domain;
0173     vki_uint16_t pad1;
0174     vki_uint32_t pad2;
0175     union {
0176         struct vki_xen_hvm_altp2m_domain_state       domain_state;
0177         struct vki_xen_hvm_altp2m_vcpu_enable_notify enable_notify;
0178         struct vki_xen_hvm_altp2m_view               view;
0179         struct vki_xen_hvm_altp2m_set_mem_access     set_mem_access;
0180         struct vki_xen_hvm_altp2m_change_gfn         change_gfn;
0181         vki_uint8_t pad[64];
0182     } u;
0183 };
0184 typedef struct vki_xen_hvm_altp2m_op vki_xen_hvm_altp2m_op_t;
0185 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_hvm_altp2m_op_t);
0186 
0187 #endif // __VKI_XEN_HVM_H
0188 
0189 /*--------------------------------------------------------------------*/
0190 /*--- end                                                          ---*/
0191 /*--------------------------------------------------------------------*/