[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 hvm: Correctly emulate task switches into vm86 mode.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1242695524 -3600
# Node ID 13a4f4e6d0a36ae60b406a2385830c646873db37
# Parent  e421fd04e15039c4f5204a1d128af550aa9bc578
x86 hvm: Correctly emulate task switches into vm86 mode.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff -r e421fd04e150 -r 13a4f4e6d0a3 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue May 19 02:09:36 2009 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Tue May 19 02:12:04 2009 +0100
@@ -1193,12 +1193,24 @@ static void hvm_unmap_entry(void *p)
 }
 
 static int hvm_load_segment_selector(
-    struct vcpu *v, enum x86_segment seg, uint16_t sel)
+    enum x86_segment seg, uint16_t sel)
 {
     struct segment_register desctab, cs, segr;
     struct desc_struct *pdesc, desc;
     u8 dpl, rpl, cpl;
     int fault_type = TRAP_invalid_tss;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    struct vcpu *v = current;
+
+    if ( regs->eflags & EF_VM )
+    {
+        segr.sel = sel;
+        segr.base = (uint32_t)sel << 4;
+        segr.limit = 0xffffu;
+        segr.attr.bytes = 0xf3;
+        hvm_set_segment_register(v, seg, &segr);
+        return 0;
+    }
 
     /* NULL selector? */
     if ( (sel & 0xfffc) == 0 )
@@ -1445,13 +1457,13 @@ void hvm_task_switch(
     }
 
     exn_raised = 0;
-    if ( hvm_load_segment_selector(v, x86_seg_ldtr, tss.ldt) ||
-         hvm_load_segment_selector(v, x86_seg_es, tss.es) ||
-         hvm_load_segment_selector(v, x86_seg_cs, tss.cs) ||
-         hvm_load_segment_selector(v, x86_seg_ss, tss.ss) ||
-         hvm_load_segment_selector(v, x86_seg_ds, tss.ds) ||
-         hvm_load_segment_selector(v, x86_seg_fs, tss.fs) ||
-         hvm_load_segment_selector(v, x86_seg_gs, tss.gs) )
+    if ( hvm_load_segment_selector(x86_seg_ldtr, tss.ldt) ||
+         hvm_load_segment_selector(x86_seg_es, tss.es) ||
+         hvm_load_segment_selector(x86_seg_cs, tss.cs) ||
+         hvm_load_segment_selector(x86_seg_ss, tss.ss) ||
+         hvm_load_segment_selector(x86_seg_ds, tss.ds) ||
+         hvm_load_segment_selector(x86_seg_fs, tss.fs) ||
+         hvm_load_segment_selector(x86_seg_gs, tss.gs) )
         exn_raised = 1;
 
     rc = hvm_copy_to_guest_virt(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.