[PATCH 1/2] Fix debug exceptions from VM86

Petr Tesarik hat at tesarici.cz
Mon Mar 27 02:12:02 CST 2006


Hi,

when I applied my last patch, I still experienced problems running
VM86 code in a debugger. This involved many issues:

1. save_vm86_context() didn't set the ContextFlags (which was not a
   problem before).

2. we can't call raise_trap_exception() for VM86, as this routine ends
   with a call to NtSetContextThread(), but that call can't return to
   VM86.

3. the TF bit must not be reset in the exception context;

4. it should be reset by the DOS VM in winedos

This patch fixes points 1 through 3.

ChangeLog:

* Set ContextFlags accordingly in save_vm86_context()
* Raise debug exceptions correctly for debug exceptions
* Do not clear TF bit for VM86-generated debug exceptions
-------------- next part --------------
Index: signal_i386.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/signal_i386.c,v
retrieving revision 1.120
diff -u -r1.120 signal_i386.c
--- signal_i386.c	21 Feb 2006 11:05:56 -0000	1.120
+++ signal_i386.c	27 Mar 2006 08:10:10 -0000
@@ -531,6 +531,7 @@
  */
 static void save_vm86_context( CONTEXT *context, const struct vm86plus_struct *vm86 )
 {
+    context->ContextFlags = CONTEXT_FULL;
     context->Eax    = vm86->regs.eax;
     context->Ebx    = vm86->regs.ebx;
     context->Ecx    = vm86->regs.ecx;
@@ -1528,7 +1529,7 @@
         case VM86_TRAP: /* return due to DOS-debugger request */
             switch(VM86_ARG(res))
             {
-            case TRAP_x86_TRCTRAP:  /* Single-step exception, single step flag is cleared by raise_trap_exception */
+            case TRAP_x86_TRCTRAP:  /* Single-step exception */
                 rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
                 break;
             case TRAP_x86_BPTFLT:   /* Breakpoint exception */
@@ -1538,8 +1539,7 @@
                 rec.ExceptionCode = EXCEPTION_BREAKPOINT;
                 break;
             }
-            raise_trap_exception( &rec, context );
-            continue;
+            break;
         case VM86_INTx: /* int3/int x instruction (ARG = x) */
             rec.ExceptionCode = EXCEPTION_VM86_INTx;
             rec.NumberParameters = 1;


More information about the wine-patches mailing list