summaryrefslogtreecommitdiff
path: root/target-i386/kvm.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-12-27 15:56:44 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-01-21 14:05:22 -0200
commitacaa75507b34f7b588924a09c76c6848d209e08c (patch)
tree84471d3b336a0b42f58b39aa05a0ca2e6ecdbb60 /target-i386/kvm.c
parent7cc2cc3e2608b182f1e0fc7ecae6e3b1fa4f46e0 (diff)
downloadqemu-acaa75507b34f7b588924a09c76c6848d209e08c.tar.gz
qemu-acaa75507b34f7b588924a09c76c6848d209e08c.tar.bz2
qemu-acaa75507b34f7b588924a09c76c6848d209e08c.zip
kvm: x86: Fix DPL write back of segment registers
The DPL is stored in the flags and not in the selector. In fact, the RPL may differ from the DPL at some point in time, and so we were corrupting the guest state so far. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r--target-i386/kvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 9a4bf98831..ee7bdf8012 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -602,7 +602,7 @@ static void set_seg(struct kvm_segment *lhs, const SegmentCache *rhs)
lhs->limit = rhs->limit;
lhs->type = (flags >> DESC_TYPE_SHIFT) & 15;
lhs->present = (flags & DESC_P_MASK) != 0;
- lhs->dpl = rhs->selector & 3;
+ lhs->dpl = (flags >> DESC_DPL_SHIFT) & 3;
lhs->db = (flags >> DESC_B_SHIFT) & 1;
lhs->s = (flags & DESC_S_MASK) != 0;
lhs->l = (flags >> DESC_L_SHIFT) & 1;