diff options
author | Nadav Amit <namit@cs.technion.ac.il> | 2014-04-18 00:11:34 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2014-04-23 16:47:00 -0400 |
commit | 42bf549f3c672006ba18e97152cbc563315ba4e6 (patch) | |
tree | 425357b66a7ca7d407b1320d8ba0f011db3b1fcc | |
parent | e6e39f0438bc4b0da9334ca42337775c7a00db21 (diff) |
KVM: x86: Processor mode may be determined incorrectly
If EFER.LMA is off, cs.l does not determine execution mode.
Currently, the emulation engine assumes differently.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index e4ccc6cf4108..7cc646626afd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4888,7 +4888,7 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) | |||
4888 | ctxt->eip = kvm_rip_read(vcpu); | 4888 | ctxt->eip = kvm_rip_read(vcpu); |
4889 | ctxt->mode = (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : | 4889 | ctxt->mode = (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : |
4890 | (ctxt->eflags & X86_EFLAGS_VM) ? X86EMUL_MODE_VM86 : | 4890 | (ctxt->eflags & X86_EFLAGS_VM) ? X86EMUL_MODE_VM86 : |
4891 | cs_l ? X86EMUL_MODE_PROT64 : | 4891 | (cs_l && is_long_mode(vcpu)) ? X86EMUL_MODE_PROT64 : |
4892 | cs_db ? X86EMUL_MODE_PROT32 : | 4892 | cs_db ? X86EMUL_MODE_PROT32 : |
4893 | X86EMUL_MODE_PROT16; | 4893 | X86EMUL_MODE_PROT16; |
4894 | ctxt->guest_mode = is_guest_mode(vcpu); | 4894 | ctxt->guest_mode = is_guest_mode(vcpu); |