[PATCH] KVM: Make the GET_SREGS and SET_SREGS ioctls symmetric
authorUri Lublin <uril@qumranet.com>
Wed, 13 Dec 2006 08:34:00 +0000 (00:34 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 13 Dec 2006 17:05:47 +0000 (09:05 -0800)
This makes the SET_SREGS ioctl behave symmetrically to the GET_SREGS ioctl wrt
the segment access rights flag.

Signed-off-by: Uri Lublin <uril@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/kvm/vmx.c

index ad97014aa6ebd75b493ea95ac5f4d4de0a04d7c1..fc01c4b08fd577f499a0c45b610e22557c0d5f7a 100644 (file)
@@ -884,6 +884,8 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
                ar |= (var->db & 1) << 14;
                ar |= (var->g & 1) << 15;
        }
+       if (ar == 0) /* a 0 value means unusable */
+               ar = AR_UNUSABLE_MASK;
        vmcs_write32(sf->ar_bytes, ar);
 }