KVM: task switch: translate guest segment limit to virt-extension byte granular field
authorMarcelo Tosatti <mtosatti@redhat.com>
Sat, 19 Jul 2008 22:08:07 +0000 (19:08 -0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 27 Jul 2008 08:34:10 +0000 (11:34 +0300)
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>
arch/x86/kvm/x86.c

index 27c6ece91da6d1b82f38e98226396eeca50d3de1..5916191420c714d7e9b43ca9b1bf995672f88eab 100644 (file)
@@ -3184,6 +3184,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;