169e0a03cSPaolo Bonzini /* 269e0a03cSPaolo Bonzini * Copyright (C) 2016 Veertu Inc, 369e0a03cSPaolo Bonzini * Copyright (C) 2017 Google Inc, 469e0a03cSPaolo Bonzini * 569e0a03cSPaolo Bonzini * This program is free software; you can redistribute it and/or 669e0a03cSPaolo Bonzini * modify it under the terms of the GNU Lesser General Public 769e0a03cSPaolo Bonzini * License as published by the Free Software Foundation; either 88af82b8eSChetan Pant * version 2.1 of the License, or (at your option) any later version. 969e0a03cSPaolo Bonzini * 1069e0a03cSPaolo Bonzini * This program is distributed in the hope that it will be useful, 1169e0a03cSPaolo Bonzini * but WITHOUT ANY WARRANTY; without even the implied warranty of 1269e0a03cSPaolo Bonzini * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1369e0a03cSPaolo Bonzini * Lesser General Public License for more details. 1469e0a03cSPaolo Bonzini * 1569e0a03cSPaolo Bonzini * You should have received a copy of the GNU Lesser General Public 1669e0a03cSPaolo Bonzini * License along with this program; if not, see <http://www.gnu.org/licenses/>. 1769e0a03cSPaolo Bonzini */ 1869e0a03cSPaolo Bonzini 19f9fea777SPaolo Bonzini #ifndef HVF_X86_DESCR_H 20177d9e0dSMarkus Armbruster #define HVF_X86_DESCR_H 2169e0a03cSPaolo Bonzini 2269e0a03cSPaolo Bonzini #include "x86.h" 2369e0a03cSPaolo Bonzini 2469e0a03cSPaolo Bonzini typedef struct vmx_segment { 2569e0a03cSPaolo Bonzini uint16_t sel; 2669e0a03cSPaolo Bonzini uint64_t base; 2769e0a03cSPaolo Bonzini uint64_t limit; 2869e0a03cSPaolo Bonzini uint64_t ar; 2969e0a03cSPaolo Bonzini } vmx_segment; 3069e0a03cSPaolo Bonzini 3169e0a03cSPaolo Bonzini /* deal with vmstate descriptors */ 32*f8436a16SPhilippe Mathieu-Daudé void vmx_read_segment_descriptor(CPUState *cpu, 336701d81dSPaolo Bonzini struct vmx_segment *desc, enum X86Seg seg); 3469e0a03cSPaolo Bonzini void vmx_write_segment_descriptor(CPUState *cpu, struct vmx_segment *desc, 356701d81dSPaolo Bonzini enum X86Seg seg); 3669e0a03cSPaolo Bonzini 37*f8436a16SPhilippe Mathieu-Daudé x68_segment_selector vmx_read_segment_selector(CPUState *cpu, 386701d81dSPaolo Bonzini enum X86Seg seg); 39*f8436a16SPhilippe Mathieu-Daudé void vmx_write_segment_selector(CPUState *cpu, 4069e0a03cSPaolo Bonzini x68_segment_selector selector, 416701d81dSPaolo Bonzini enum X86Seg seg); 4269e0a03cSPaolo Bonzini 43*f8436a16SPhilippe Mathieu-Daudé uint64_t vmx_read_segment_base(CPUState *cpu, enum X86Seg seg); 44*f8436a16SPhilippe Mathieu-Daudé void vmx_write_segment_base(CPUState *cpu, enum X86Seg seg, 4569e0a03cSPaolo Bonzini uint64_t base); 4669e0a03cSPaolo Bonzini 47*f8436a16SPhilippe Mathieu-Daudé void x86_segment_descriptor_to_vmx(CPUState *cpu, 4869e0a03cSPaolo Bonzini x68_segment_selector selector, 4969e0a03cSPaolo Bonzini struct x86_segment_descriptor *desc, 5069e0a03cSPaolo Bonzini struct vmx_segment *vmx_desc); 5169e0a03cSPaolo Bonzini 526701d81dSPaolo Bonzini uint32_t vmx_read_segment_limit(CPUState *cpu, enum X86Seg seg); 536701d81dSPaolo Bonzini uint32_t vmx_read_segment_ar(CPUState *cpu, enum X86Seg seg); 54*f8436a16SPhilippe Mathieu-Daudé void vmx_segment_to_x86_descriptor(CPUState *cpu, 5569e0a03cSPaolo Bonzini struct vmx_segment *vmx_desc, 5669e0a03cSPaolo Bonzini struct x86_segment_descriptor *desc); 57f9fea777SPaolo Bonzini 58f9fea777SPaolo Bonzini #endif 59