x86_emulate: Check single-step status at instruction start rather than end.
authorKeir Fraser <keir.fraser@citrix.com>
Sat, 24 May 2008 07:54:59 +0000 (08:54 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Sat, 24 May 2008 07:54:59 +0000 (08:54 +0100)
This fixes booting of FreeDOS with HIMEM.SYS enabled.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index bd318974c02acd3cf97b835a9f37babb675143e6..4c45ec0bceeddebd5b38d6037c909e319b2c9471 100644 (file)
@@ -2105,12 +2105,14 @@ x86_emulate(
         break;
     }
 
+    /* Inject #DB if single-step tracing was enabled at instruction start. */
+    if ( (ctxt->regs->eflags & EFLG_TF) && (rc == X86EMUL_OKAY) &&
+         (ops->inject_hw_exception != NULL) )
+        rc = ops->inject_hw_exception(EXC_DB, -1, ctxt) ? : X86EMUL_EXCEPTION;
+
     /* Commit shadow register state. */
     _regs.eflags &= ~EFLG_RF;
     *ctxt->regs = _regs;
-    if ( (_regs.eflags & EFLG_TF) && (rc == X86EMUL_OKAY) &&
-         (ops->inject_hw_exception != NULL) )
-        rc = ops->inject_hw_exception(EXC_DB, -1, ctxt) ? : X86EMUL_EXCEPTION;
 
  done:
     return rc;