aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/kvm_emulate.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index 48693f0d3842..2cfea49d4706 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -14,6 +14,8 @@
14#include <asm/desc_defs.h> 14#include <asm/desc_defs.h>
15 15
16struct x86_emulate_ctxt; 16struct x86_emulate_ctxt;
17enum x86_intercept;
18enum x86_intercept_stage;
17 19
18struct x86_exception { 20struct x86_exception {
19 u8 vector; 21 u8 vector;
@@ -62,6 +64,7 @@ struct x86_exception {
62#define X86EMUL_RETRY_INSTR 3 /* retry the instruction for some reason */ 64#define X86EMUL_RETRY_INSTR 3 /* retry the instruction for some reason */
63#define X86EMUL_CMPXCHG_FAILED 4 /* cmpxchg did not see expected value */ 65#define X86EMUL_CMPXCHG_FAILED 4 /* cmpxchg did not see expected value */
64#define X86EMUL_IO_NEEDED 5 /* IO is needed to complete emulation */ 66#define X86EMUL_IO_NEEDED 5 /* IO is needed to complete emulation */
67#define X86EMUL_INTERCEPTED 6 /* Intercepted by nested VMCB/VMCS */
65 68
66struct x86_emulate_ops { 69struct x86_emulate_ops {
67 /* 70 /*
@@ -160,6 +163,9 @@ struct x86_emulate_ops {
160 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata); 163 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
161 void (*get_fpu)(struct x86_emulate_ctxt *ctxt); /* disables preempt */ 164 void (*get_fpu)(struct x86_emulate_ctxt *ctxt); /* disables preempt */
162 void (*put_fpu)(struct x86_emulate_ctxt *ctxt); /* reenables preempt */ 165 void (*put_fpu)(struct x86_emulate_ctxt *ctxt); /* reenables preempt */
166 int (*intercept)(struct x86_emulate_ctxt *ctxt,
167 enum x86_intercept intercept,
168 enum x86_intercept_stage stage);
163}; 169};
164 170
165typedef u32 __attribute__((vector_size(16))) sse128_t; 171typedef u32 __attribute__((vector_size(16))) sse128_t;
@@ -203,6 +209,7 @@ struct read_cache {
203struct decode_cache { 209struct decode_cache {
204 u8 twobyte; 210 u8 twobyte;
205 u8 b; 211 u8 b;
212 u8 intercept;
206 u8 lock_prefix; 213 u8 lock_prefix;
207 u8 rep_prefix; 214 u8 rep_prefix;
208 u8 op_bytes; 215 u8 op_bytes;
@@ -244,6 +251,7 @@ struct x86_emulate_ctxt {
244 /* interruptibility state, as a result of execution of STI or MOV SS */ 251 /* interruptibility state, as a result of execution of STI or MOV SS */
245 int interruptibility; 252 int interruptibility;
246 253
254 bool guest_mode; /* guest running a nested guest */
247 bool perm_ok; /* do not check permissions if true */ 255 bool perm_ok; /* do not check permissions if true */
248 bool only_vendor_specific_insn; 256 bool only_vendor_specific_insn;
249 257
@@ -265,6 +273,18 @@ struct x86_emulate_ctxt {
265#define X86EMUL_MODE_PROT32 4 /* 32-bit protected mode. */ 273#define X86EMUL_MODE_PROT32 4 /* 32-bit protected mode. */
266#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */ 274#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */
267 275
276enum x86_intercept_stage {
277 X86_ICPT_PRE_EXCEPT,
278 X86_ICPT_POST_EXCEPT,
279 X86_ICPT_POST_MEMACCESS,
280};
281
282enum x86_intercept {
283 x86_intercept_none,
284
285 nr_x86_intercepts
286};
287
268/* Host execution mode. */ 288/* Host execution mode. */
269#if defined(CONFIG_X86_32) 289#if defined(CONFIG_X86_32)
270#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32 290#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32