aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-06-13 09:30:53 -0400
committerAvi Kivity <avi@redhat.com>2012-07-09 07:19:05 -0400
commit869be99c7579c857885643ba2aed87ced339c6a2 (patch)
tree6690d8025a94deb5634c29dfebe2ede2897d143f /arch/x86/kvm
parente919464b53ea29aed46ff10f7d6416268678bdb9 (diff)
KVM: x86 emulator: make loading TR set the busy bit
Guest software doesn't actually depend on it, but vmx will refuse us entry if we don't. Set the bit in both the cached segment and memory, just to be nice. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/emulate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 99e3df2bf880..92a1adde0b44 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1335,7 +1335,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1335static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, 1335static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1336 u16 selector, int seg) 1336 u16 selector, int seg)
1337{ 1337{
1338 struct desc_struct seg_desc; 1338 struct desc_struct seg_desc, old_desc;
1339 u8 dpl, rpl, cpl; 1339 u8 dpl, rpl, cpl;
1340 unsigned err_vec = GP_VECTOR; 1340 unsigned err_vec = GP_VECTOR;
1341 u32 err_code = 0; 1341 u32 err_code = 0;
@@ -1422,6 +1422,12 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1422 case VCPU_SREG_TR: 1422 case VCPU_SREG_TR:
1423 if (seg_desc.s || (seg_desc.type != 1 && seg_desc.type != 9)) 1423 if (seg_desc.s || (seg_desc.type != 1 && seg_desc.type != 9))
1424 goto exception; 1424 goto exception;
1425 old_desc = seg_desc;
1426 seg_desc.type |= 2; /* busy */
1427 ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc,
1428 sizeof(seg_desc), &ctxt->exception);
1429 if (ret != X86EMUL_CONTINUE)
1430 return ret;
1425 break; 1431 break;
1426 case VCPU_SREG_LDTR: 1432 case VCPU_SREG_LDTR:
1427 if (seg_desc.s || seg_desc.type != 2) 1433 if (seg_desc.s || seg_desc.type != 2)