xref: /qemu/target/i386/hvf/x86_descr.h (revision 27458df871097d7fc14b19d9e01c35d29737b9b3)
1c97d6d2cSSergio Andres Gomez Del Real /*
2c97d6d2cSSergio Andres Gomez Del Real  * Copyright (C) 2016 Veertu Inc,
3c97d6d2cSSergio Andres Gomez Del Real  * Copyright (C) 2017 Google Inc,
4c97d6d2cSSergio Andres Gomez Del Real  *
5c97d6d2cSSergio Andres Gomez Del Real  * This program is free software; you can redistribute it and/or
6996feed4SSergio Andres Gomez Del Real  * modify it under the terms of the GNU Lesser General Public
7996feed4SSergio Andres Gomez Del Real  * License as published by the Free Software Foundation; either
88af82b8eSChetan Pant  * version 2.1 of the License, or (at your option) any later version.
9c97d6d2cSSergio Andres Gomez Del Real  *
10c97d6d2cSSergio Andres Gomez Del Real  * This program is distributed in the hope that it will be useful,
11c97d6d2cSSergio Andres Gomez Del Real  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12996feed4SSergio Andres Gomez Del Real  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13996feed4SSergio Andres Gomez Del Real  * Lesser General Public License for more details.
14c97d6d2cSSergio Andres Gomez Del Real  *
15996feed4SSergio Andres Gomez Del Real  * You should have received a copy of the GNU Lesser General Public
16996feed4SSergio Andres Gomez Del Real  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
17c97d6d2cSSergio Andres Gomez Del Real  */
18c97d6d2cSSergio Andres Gomez Del Real 
19f9fea777SPaolo Bonzini #ifndef HVF_X86_DESCR_H
20177d9e0dSMarkus Armbruster #define HVF_X86_DESCR_H
21c97d6d2cSSergio Andres Gomez Del Real 
22*27458df8SWei Liu #include "emulate/x86.h"
23c97d6d2cSSergio Andres Gomez Del Real 
24c97d6d2cSSergio Andres Gomez Del Real typedef struct vmx_segment {
25c97d6d2cSSergio Andres Gomez Del Real     uint16_t sel;
26c97d6d2cSSergio Andres Gomez Del Real     uint64_t base;
27c97d6d2cSSergio Andres Gomez Del Real     uint64_t limit;
28c97d6d2cSSergio Andres Gomez Del Real     uint64_t ar;
29c97d6d2cSSergio Andres Gomez Del Real } vmx_segment;
30c97d6d2cSSergio Andres Gomez Del Real 
31c97d6d2cSSergio Andres Gomez Del Real /* deal with vmstate descriptors */
32f8436a16SPhilippe Mathieu-Daudé void vmx_read_segment_descriptor(CPUState *cpu,
336701d81dSPaolo Bonzini                                  struct vmx_segment *desc, enum X86Seg seg);
34c97d6d2cSSergio Andres Gomez Del Real void vmx_write_segment_descriptor(CPUState *cpu, struct vmx_segment *desc,
356701d81dSPaolo Bonzini                                   enum X86Seg seg);
36c97d6d2cSSergio Andres Gomez Del Real 
3725409172SWei Liu x86_segment_selector vmx_read_segment_selector(CPUState *cpu,
386701d81dSPaolo Bonzini                                                enum X86Seg seg);
39f8436a16SPhilippe Mathieu-Daudé void vmx_write_segment_selector(CPUState *cpu,
4025409172SWei Liu                                 x86_segment_selector selector,
416701d81dSPaolo Bonzini                                 enum X86Seg seg);
42c97d6d2cSSergio Andres Gomez Del Real 
43f8436a16SPhilippe Mathieu-Daudé uint64_t vmx_read_segment_base(CPUState *cpu, enum X86Seg seg);
44f8436a16SPhilippe Mathieu-Daudé void vmx_write_segment_base(CPUState *cpu, enum X86Seg seg,
45c97d6d2cSSergio Andres Gomez Del Real                             uint64_t base);
46c97d6d2cSSergio Andres Gomez Del Real 
47f8436a16SPhilippe Mathieu-Daudé void x86_segment_descriptor_to_vmx(CPUState *cpu,
4825409172SWei Liu                                    x86_segment_selector selector,
49c97d6d2cSSergio Andres Gomez Del Real                                    struct x86_segment_descriptor *desc,
50c97d6d2cSSergio Andres Gomez Del Real                                    struct vmx_segment *vmx_desc);
51c97d6d2cSSergio Andres Gomez Del Real 
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);
54f8436a16SPhilippe Mathieu-Daudé void vmx_segment_to_x86_descriptor(CPUState *cpu,
55c97d6d2cSSergio Andres Gomez Del Real                                    struct vmx_segment *vmx_desc,
56c97d6d2cSSergio Andres Gomez Del Real                                    struct x86_segment_descriptor *desc);
57f9fea777SPaolo Bonzini 
58f9fea777SPaolo Bonzini #endif
59