x86 hvm: Fix task-switch operation ordering.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 30 May 2008 15:44:13 +0000 (16:44 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 30 May 2008 15:44:13 +0000 (16:44 +0100)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hvm/hvm.c

index f637933899eb53151c605ff8125dfa23f4fa16a5..d6c56d8efeef01e68b49fb8cd8b0a8e1d4e2ccb6 100644 (file)
@@ -1402,14 +1402,14 @@ void hvm_task_switch(
          hvm_load_segment_selector(v, x86_seg_ldtr, tss.ldt) )
         exn_raised = 1;
 
-    if ( (tss.trace & 1) && !exn_raised )
-        hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0);
-
     rc = hvm_copy_to_guest_virt(
         tr.base, &tss, sizeof(tss), PFEC_page_present);
     if ( rc == HVMCOPY_bad_gva_to_gfn )
         exn_raised = 1;
 
+    if ( (tss.trace & 1) && !exn_raised )
+        hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0);
+
     tr.attr.fields.type = 0xb; /* busy 32-bit tss */
     hvm_set_segment_register(v, x86_seg_tr, &tr);