2 * Copyright (c) 2008 Brent Stephens <brents@rice.edu>
3 * Copyright (c) 2008 Diego Ongaro <diego.ongaro@rice.edu>
4 * Copyright (c) 2008 Kaushik Kumar Ram <kaushik@rice.edu>
5 * Copyright (c) 2008 Oleg Pesok <olegpesok@gmail.com>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #include <sys/types.h>
35 #define KVM_NR_INTERRUPTS 256
41 uint32_t nmsrs
; /* number of msrs in entries */
45 struct kvm_msr_entry
{
52 uint32_t nmsrs
; /* number of msrs in entries */
55 struct kvm_msr_entry entries
[0];
58 #if defined(_KERNEL) || defined(FKVM_INTERNAL)
60 FKVM_REGS_TYPE_REGS
=1,
61 FKVM_REGS_TYPE_SREGS
=2,
62 FKVM_REGS_TYPE_MSRS
=3,
95 uint8_t ftwx
; /* in fxsave format */
130 struct kvm_segment cs
;
131 struct kvm_segment ds
;
132 struct kvm_segment es
;
133 struct kvm_segment fs
;
134 struct kvm_segment gs
;
135 struct kvm_segment ss
;
136 struct kvm_segment tr
;
137 struct kvm_segment ldt
;
138 struct kvm_dtable gdt
;
139 struct kvm_dtable idt
;
147 uint64_t interrupt_bitmap
[(KVM_NR_INTERRUPTS
+ 63) / 64];
152 struct kvm_breakpoint
{
158 struct kvm_debug_guest
{
161 struct kvm_breakpoint breakpoints
[4];
167 struct kvm_cpuid_entry
{
176 #if defined(_KERNEL) || defined(FKVM_INTERNAL)
179 KVM_EXIT_UNKNOWN
= 0,
180 KVM_EXIT_EXCEPTION
= 1,
182 KVM_EXIT_HYPERCALL
= 3,
186 KVM_EXIT_IRQ_WINDOW_OPEN
= 7,
187 KVM_EXIT_SHUTDOWN
= 8,
188 KVM_EXIT_FAIL_ENTRY
= 9,
190 KVM_EXIT_SET_TPR
= 11,
191 KVM_EXIT_TPR_ACCESS
= 12,
192 KVM_EXIT_S390_SIEIC
= 13,
193 KVM_EXIT_S390_RESET
= 14,
196 KVM_EXIT_NMI_WINDOW_OPEN
= 17,
197 KVM_EXIT_CONTINUE
= 18,
202 uint8_t request_interrupt_window
;
203 uint8_t request_nmi_window
;
207 uint32_t exit_reason
;
208 uint8_t ready_for_interrupt_injection
;
210 uint8_t ready_for_nmi_injection
;
213 /* in (pre_kvm_run), out (post_kvm_run) */
218 /* KVM_EXIT_UNKNOWN */
220 uint64_t hardware_exit_reason
;
222 /* KVM_EXIT_FAIL_ENTRY */
224 uint64_t hardware_entry_failure_reason
;
226 /* KVM_EXIT_EXCEPTION */
233 #define KVM_EXIT_IO_IN 0
234 #define KVM_EXIT_IO_OUT 1
235 uint8_t in
; /* 1 = in 0 = out */
236 uint8_t size
; /* bytes */
239 uint64_t data_offset
; /* relative to kvm_run start */
240 uint64_t pio_data
; /* This is an entire page in KVM, we only need 4 bytes for now */
250 /* KVM_EXIT_TPR_ACCESS */
262 /* Fix the size of the union. */
268 #endif /* !_FKVM_H_ */