diff options
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 48c7f9f8a08f..6a429eefc533 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <asm/kvm_emulate.h> | 33 | #include <asm/kvm_emulate.h> |
34 | 34 | ||
35 | #include "x86.h" | ||
35 | #include "mmu.h" /* for is_long_mode() */ | 36 | #include "mmu.h" /* for is_long_mode() */ |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -1515,7 +1516,7 @@ emulate_syscall(struct x86_emulate_ctxt *ctxt) | |||
1515 | 1516 | ||
1516 | /* syscall is not available in real mode */ | 1517 | /* syscall is not available in real mode */ |
1517 | if (c->lock_prefix || ctxt->mode == X86EMUL_MODE_REAL | 1518 | if (c->lock_prefix || ctxt->mode == X86EMUL_MODE_REAL |
1518 | || !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE)) | 1519 | || !is_protmode(ctxt->vcpu)) |
1519 | return -1; | 1520 | return -1; |
1520 | 1521 | ||
1521 | setup_syscalls_segments(ctxt, &cs, &ss); | 1522 | setup_syscalls_segments(ctxt, &cs, &ss); |
@@ -1568,8 +1569,7 @@ emulate_sysenter(struct x86_emulate_ctxt *ctxt) | |||
1568 | return -1; | 1569 | return -1; |
1569 | 1570 | ||
1570 | /* inject #GP if in real mode or paging is disabled */ | 1571 | /* inject #GP if in real mode or paging is disabled */ |
1571 | if (ctxt->mode == X86EMUL_MODE_REAL || | 1572 | if (ctxt->mode == X86EMUL_MODE_REAL || !is_protmode(ctxt->vcpu)) { |
1572 | !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE)) { | ||
1573 | kvm_inject_gp(ctxt->vcpu, 0); | 1573 | kvm_inject_gp(ctxt->vcpu, 0); |
1574 | return -1; | 1574 | return -1; |
1575 | } | 1575 | } |
@@ -1634,8 +1634,7 @@ emulate_sysexit(struct x86_emulate_ctxt *ctxt) | |||
1634 | return -1; | 1634 | return -1; |
1635 | 1635 | ||
1636 | /* inject #GP if in real mode or paging is disabled */ | 1636 | /* inject #GP if in real mode or paging is disabled */ |
1637 | if (ctxt->mode == X86EMUL_MODE_REAL | 1637 | if (ctxt->mode == X86EMUL_MODE_REAL || !is_protmode(ctxt->vcpu)) { |
1638 | || !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE)) { | ||
1639 | kvm_inject_gp(ctxt->vcpu, 0); | 1638 | kvm_inject_gp(ctxt->vcpu, 0); |
1640 | return -1; | 1639 | return -1; |
1641 | } | 1640 | } |