diff options
author | Avi Kivity <avi@redhat.com> | 2010-01-21 08:31:48 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:04 -0500 |
commit | 3eeb3288bcbf64da90afc26389b8844df7c34912 (patch) | |
tree | 1b7bc55641015605da0b415a928ecf39aac64a2e /arch/x86/kvm/vmx.c | |
parent | 6b52d18605f580bdffaffd48c8da228c3e848deb (diff) |
KVM: Add a helper for checking if the guest is in protected mode
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fad871cbed1..2e894954069 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1845,7 +1845,7 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu, | |||
1845 | 1845 | ||
1846 | static int vmx_get_cpl(struct kvm_vcpu *vcpu) | 1846 | static int vmx_get_cpl(struct kvm_vcpu *vcpu) |
1847 | { | 1847 | { |
1848 | if (!kvm_read_cr0_bits(vcpu, X86_CR0_PE)) /* if real mode */ | 1848 | if (!is_protmode(vcpu)) |
1849 | return 0; | 1849 | return 0; |
1850 | 1850 | ||
1851 | if (vmx_get_rflags(vcpu) & X86_EFLAGS_VM) /* if virtual 8086 */ | 1851 | if (vmx_get_rflags(vcpu) & X86_EFLAGS_VM) /* if virtual 8086 */ |
@@ -2100,7 +2100,7 @@ static bool cs_ss_rpl_check(struct kvm_vcpu *vcpu) | |||
2100 | static bool guest_state_valid(struct kvm_vcpu *vcpu) | 2100 | static bool guest_state_valid(struct kvm_vcpu *vcpu) |
2101 | { | 2101 | { |
2102 | /* real mode guest state checks */ | 2102 | /* real mode guest state checks */ |
2103 | if (!kvm_read_cr0_bits(vcpu, X86_CR0_PE)) { | 2103 | if (!is_protmode(vcpu)) { |
2104 | if (!rmode_segment_valid(vcpu, VCPU_SREG_CS)) | 2104 | if (!rmode_segment_valid(vcpu, VCPU_SREG_CS)) |
2105 | return false; | 2105 | return false; |
2106 | if (!rmode_segment_valid(vcpu, VCPU_SREG_SS)) | 2106 | if (!rmode_segment_valid(vcpu, VCPU_SREG_SS)) |