]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: task switch: translate guest segment limit to virt-extension byte granular field
authorMarcelo Tosatti <mtosatti@redhat.com>
Wed, 13 Aug 2008 15:00:29 +0000 (18:00 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 20 Aug 2008 18:05:07 +0000 (11:05 -0700)
(cherry picked from commit c93cd3a58845012df2d658fecd0ac99f7008d753)

If 'g' is one then limit is 4kb granular.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/x86.c

index 1be4512cc09a5a4c5e423f1ef3eed2a52ef76f70..8ab14ab105f0b0992ad9ac1b9a688489e617fc04 100644 (file)
@@ -3168,6 +3168,10 @@ static void seg_desct_to_kvm_desct(struct desc_struct *seg_desc, u16 selector,
        kvm_desct->base |= seg_desc->base2 << 24;
        kvm_desct->limit = seg_desc->limit0;
        kvm_desct->limit |= seg_desc->limit << 16;
+       if (seg_desc->g) {
+               kvm_desct->limit <<= 12;
+               kvm_desct->limit |= 0xfff;
+       }
        kvm_desct->selector = selector;
        kvm_desct->type = seg_desc->type;
        kvm_desct->present = seg_desc->p;