aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2012-12-12 12:10:49 -0500
committerGleb Natapov <gleb@redhat.com>2012-12-23 07:00:36 -0500
commit07f42f5f25dc214a33214159fc8b62b984b713eb (patch)
tree502bece6c0a8dc7da1bd668b49493681787a8941 /arch/x86/kvm/vmx.c
parent116c14c0191f3378e6567af296529ac287e85aa2 (diff)
KVM: VMX: cleanup rmode_segment_valid()
Set segment fields explicitly instead of using binary operations. No behaviour changes. Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index b3101e368079..265fdd37b240 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3380,13 +3380,16 @@ static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg)
3380 u32 ar; 3380 u32 ar;
3381 3381
3382 vmx_get_segment(vcpu, &var, seg); 3382 vmx_get_segment(vcpu, &var, seg);
3383 var.dpl = 0x3;
3384 var.g = 0;
3385 var.db = 0;
3383 ar = vmx_segment_access_rights(&var); 3386 ar = vmx_segment_access_rights(&var);
3384 3387
3385 if (var.base != (var.selector << 4)) 3388 if (var.base != (var.selector << 4))
3386 return false; 3389 return false;
3387 if (var.limit < 0xffff) 3390 if (var.limit < 0xffff)
3388 return false; 3391 return false;
3389 if (((ar | (3 << AR_DPL_SHIFT)) & ~(AR_G_MASK | AR_DB_MASK)) != 0xf3) 3392 if (ar != 0xf3)
3390 return false; 3393 return false;
3391 3394
3392 return true; 3395 return true;