diff options
author | Borislav Petkov <bp@suse.de> | 2013-09-22 10:44:52 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-30 13:54:40 -0400 |
commit | b51e974fcdabd00c8f5943ee7943c4ea788f57b6 (patch) | |
tree | 648fb34866aa3ff7cf58aa19c99a0ddbc36bf5ab | |
parent | 1ce19dc16ce9136cccb6087e4a383ec9321980d9 (diff) |
kvm, emulator: Rename VendorSpecific flag
Call it EmulateOnUD which is exactly what we're trying to do with
vendor-specific instructions.
Rename ->only_vendor_specific_insn to something shorter, while at it.
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/include/asm/kvm_emulate.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/emulate.c | 14 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
3 files changed, 9 insertions, 10 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index 92a176ad456c..24ec1216596e 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h | |||
@@ -274,7 +274,7 @@ struct x86_emulate_ctxt { | |||
274 | 274 | ||
275 | bool guest_mode; /* guest running a nested guest */ | 275 | bool guest_mode; /* guest running a nested guest */ |
276 | bool perm_ok; /* do not check permissions if true */ | 276 | bool perm_ok; /* do not check permissions if true */ |
277 | bool only_vendor_specific_insn; | 277 | bool ud; /* inject an #UD if host doesn't support insn */ |
278 | 278 | ||
279 | bool have_exception; | 279 | bool have_exception; |
280 | struct x86_exception exception; | 280 | struct x86_exception exception; |
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d554d96afbca..541801527225 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -130,7 +130,7 @@ | |||
130 | #define Mov (1<<20) | 130 | #define Mov (1<<20) |
131 | /* Misc flags */ | 131 | /* Misc flags */ |
132 | #define Prot (1<<21) /* instruction generates #UD if not in prot-mode */ | 132 | #define Prot (1<<21) /* instruction generates #UD if not in prot-mode */ |
133 | #define VendorSpecific (1<<22) /* Vendor specific instruction */ | 133 | #define EmulateOnUD (1<<22) /* Emulate if unsupported by the host */ |
134 | #define NoAccess (1<<23) /* Don't access memory (lea/invlpg/verr etc) */ | 134 | #define NoAccess (1<<23) /* Don't access memory (lea/invlpg/verr etc) */ |
135 | #define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */ | 135 | #define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */ |
136 | #define Undefined (1<<25) /* No Such Instruction */ | 136 | #define Undefined (1<<25) /* No Such Instruction */ |
@@ -3502,7 +3502,7 @@ static const struct opcode group7_rm1[] = { | |||
3502 | 3502 | ||
3503 | static const struct opcode group7_rm3[] = { | 3503 | static const struct opcode group7_rm3[] = { |
3504 | DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), | 3504 | DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), |
3505 | II(SrcNone | Prot | VendorSpecific, em_vmmcall, vmmcall), | 3505 | II(SrcNone | Prot | EmulateOnUD, em_vmmcall, vmmcall), |
3506 | DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), | 3506 | DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), |
3507 | DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa), | 3507 | DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa), |
3508 | DIP(SrcNone | Prot | Priv, stgi, check_svme), | 3508 | DIP(SrcNone | Prot | Priv, stgi, check_svme), |
@@ -3587,7 +3587,7 @@ static const struct group_dual group7 = { { | |||
3587 | II(SrcMem16 | Mov | Priv, em_lmsw, lmsw), | 3587 | II(SrcMem16 | Mov | Priv, em_lmsw, lmsw), |
3588 | II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg), | 3588 | II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg), |
3589 | }, { | 3589 | }, { |
3590 | I(SrcNone | Priv | VendorSpecific, em_vmcall), | 3590 | I(SrcNone | Priv | EmulateOnUD, em_vmcall), |
3591 | EXT(0, group7_rm1), | 3591 | EXT(0, group7_rm1), |
3592 | N, EXT(0, group7_rm3), | 3592 | N, EXT(0, group7_rm3), |
3593 | II(SrcNone | DstMem | Mov, em_smsw, smsw), N, | 3593 | II(SrcNone | DstMem | Mov, em_smsw, smsw), N, |
@@ -3810,7 +3810,7 @@ static const struct opcode opcode_table[256] = { | |||
3810 | static const struct opcode twobyte_table[256] = { | 3810 | static const struct opcode twobyte_table[256] = { |
3811 | /* 0x00 - 0x0F */ | 3811 | /* 0x00 - 0x0F */ |
3812 | G(0, group6), GD(0, &group7), N, N, | 3812 | G(0, group6), GD(0, &group7), N, N, |
3813 | N, I(ImplicitOps | VendorSpecific, em_syscall), | 3813 | N, I(ImplicitOps | EmulateOnUD, em_syscall), |
3814 | II(ImplicitOps | Priv, em_clts, clts), N, | 3814 | II(ImplicitOps | Priv, em_clts, clts), N, |
3815 | DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, | 3815 | DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, |
3816 | N, D(ImplicitOps | ModRM), N, N, | 3816 | N, D(ImplicitOps | ModRM), N, N, |
@@ -3830,8 +3830,8 @@ static const struct opcode twobyte_table[256] = { | |||
3830 | IIP(ImplicitOps, em_rdtsc, rdtsc, check_rdtsc), | 3830 | IIP(ImplicitOps, em_rdtsc, rdtsc, check_rdtsc), |
3831 | II(ImplicitOps | Priv, em_rdmsr, rdmsr), | 3831 | II(ImplicitOps | Priv, em_rdmsr, rdmsr), |
3832 | IIP(ImplicitOps, em_rdpmc, rdpmc, check_rdpmc), | 3832 | IIP(ImplicitOps, em_rdpmc, rdpmc, check_rdpmc), |
3833 | I(ImplicitOps | VendorSpecific, em_sysenter), | 3833 | I(ImplicitOps | EmulateOnUD, em_sysenter), |
3834 | I(ImplicitOps | Priv | VendorSpecific, em_sysexit), | 3834 | I(ImplicitOps | Priv | EmulateOnUD, em_sysexit), |
3835 | N, N, | 3835 | N, N, |
3836 | N, N, N, N, N, N, N, N, | 3836 | N, N, N, N, N, N, N, N, |
3837 | /* 0x40 - 0x4F */ | 3837 | /* 0x40 - 0x4F */ |
@@ -4268,7 +4268,7 @@ done_prefixes: | |||
4268 | if (ctxt->d == 0 || (ctxt->d & NotImpl)) | 4268 | if (ctxt->d == 0 || (ctxt->d & NotImpl)) |
4269 | return EMULATION_FAILED; | 4269 | return EMULATION_FAILED; |
4270 | 4270 | ||
4271 | if (!(ctxt->d & VendorSpecific) && ctxt->only_vendor_specific_insn) | 4271 | if (!(ctxt->d & EmulateOnUD) && ctxt->ud) |
4272 | return EMULATION_FAILED; | 4272 | return EMULATION_FAILED; |
4273 | 4273 | ||
4274 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) | 4274 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d00d88455fef..15f9540a2b1f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5108,8 +5108,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, | |||
5108 | ctxt->have_exception = false; | 5108 | ctxt->have_exception = false; |
5109 | ctxt->perm_ok = false; | 5109 | ctxt->perm_ok = false; |
5110 | 5110 | ||
5111 | ctxt->only_vendor_specific_insn | 5111 | ctxt->ud = emulation_type & EMULTYPE_TRAP_UD; |
5112 | = emulation_type & EMULTYPE_TRAP_UD; | ||
5113 | 5112 | ||
5114 | r = x86_decode_insn(ctxt, insn, insn_len); | 5113 | r = x86_decode_insn(ctxt, insn, insn_len); |
5115 | 5114 | ||