From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/3] KVM: task switch: translate guest segment limit to virt-extension byte granular field
Date: Sat, 19 Jul 2008 19:08:07 -0300 [thread overview]
Message-ID: <20080719220932.835992589@localhost.localdomain> (raw)
In-Reply-To: 20080719220806.152409866@localhost.localdomain
[-- Attachment #1: vmx-seg-limti --]
[-- Type: text/plain, Size: 995 bytes --]
If 'g' is one then limit is 4kb granular.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: kvm-vmx-checks/arch/x86/kvm/x86.c
===================================================================
--- kvm-vmx-checks.orig/arch/x86/kvm/x86.c
+++ kvm-vmx-checks/arch/x86/kvm/x86.c
@@ -3195,6 +3195,10 @@ static void seg_desct_to_kvm_desct(struc
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;
@@ -3222,8 +3226,12 @@ static void get_segment_descritptor_dtab
if (kvm_seg.unusable)
dtable->limit = 0;
- else
- dtable->limit = kvm_seg.limit;
+ else {
+ if (kvm_seg.g)
+ dtable->limit = kvm_seg.limit >> 12;
+ else
+ dtable->limit = kvm_seg.limit;
+ }
dtable->base = kvm_seg.base;
}
else
--
next prev parent reply other threads:[~2008-07-19 22:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-19 22:08 [patch 0/3] task switch fixes Marcelo Tosatti
2008-07-19 22:08 ` Marcelo Tosatti [this message]
2008-07-20 9:22 ` [patch 1/3] KVM: task switch: translate guest segment limit to virt-extension byte granular field Avi Kivity
2008-07-20 16:43 ` Marcelo Tosatti
2008-07-21 8:14 ` Avi Kivity
2008-07-19 22:08 ` [patch 2/3] KVM: task switch: check task busy state Marcelo Tosatti
2008-07-19 22:08 ` [patch 3/3] KVM: task switch: check for segment base translation failure Marcelo Tosatti
2008-07-20 9:24 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080719220932.835992589@localhost.localdomain \
--to=mtosatti@redhat.com \
--cc=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox