Alexandre Julliard : winedos: Add the possibility of refusing to emulate some interrupts.

Alexandre Julliard julliard at winehq.org
Mon Dec 24 14:21:30 CST 2007


Module: wine
Branch: master
Commit: 201fc77fd6876b737a8f7a5745e614604bac19a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=201fc77fd6876b737a8f7a5745e614604bac19a6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Dec 23 13:55:12 2007 +0100

winedos: Add the possibility of refusing to emulate some interrupts.

---

 dlls/kernel32/instr.c          |    4 ++--
 dlls/kernel32/kernel_private.h |    2 +-
 dlls/winedos/dosexe.h          |    2 +-
 dlls/winedos/interrupts.c      |   10 +++++++---
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c
index 97a1d14..87e486d 100644
--- a/dlls/kernel32/instr.c
+++ b/dlls/kernel32/instr.c
@@ -773,8 +773,8 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
             if (winedos.EmulateInterruptPM)
             {
                 context->Eip += prefixlen + 2;
-                winedos.EmulateInterruptPM( context, instr[1] );
-                return ExceptionContinueExecution;
+                if (winedos.EmulateInterruptPM( context, instr[1] )) return ExceptionContinueExecution;
+                context->Eip -= prefixlen + 2;  /* restore eip */
             }
             break;  /* Unable to emulate it */
 
diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h
index dd7c916..8d69707 100644
--- a/dlls/kernel32/kernel_private.h
+++ b/dlls/kernel32/kernel_private.h
@@ -135,7 +135,7 @@ extern struct winedos_exports
     BOOL     (*FreeDosBlock)(void* ptr);
     UINT     (*ResizeDosBlock)(void *ptr, UINT size, BOOL exact);
     /* for instr.c */
-    void (WINAPI *EmulateInterruptPM)( CONTEXT86 *context, BYTE intnum );
+    BOOL (WINAPI *EmulateInterruptPM)( CONTEXT86 *context, BYTE intnum );
     void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
     DWORD (WINAPI *inport)( int port, int size );
     void (WINAPI *outport)( int port, int size, DWORD val );
diff --git a/dlls/winedos/dosexe.h b/dlls/winedos/dosexe.h
index 7b77470..a641849 100644
--- a/dlls/winedos/dosexe.h
+++ b/dlls/winedos/dosexe.h
@@ -473,7 +473,7 @@ extern void WINAPI EMS_Ioctl_Handler(CONTEXT86*);
 
 /* interrupts.c */
 extern void WINAPI DOSVM_CallBuiltinHandler( CONTEXT86 *, BYTE );
-extern void WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *, BYTE );
+extern BOOL WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *, BYTE );
 extern BOOL WINAPI DOSVM_EmulateInterruptRM( CONTEXT86 *, BYTE );
 extern FARPROC16   DOSVM_GetPMHandler16( BYTE );
 extern FARPROC48   DOSVM_GetPMHandler48( BYTE );
diff --git a/dlls/winedos/interrupts.c b/dlls/winedos/interrupts.c
index b482ab0..f254f5a 100644
--- a/dlls/winedos/interrupts.c
+++ b/dlls/winedos/interrupts.c
@@ -45,6 +45,7 @@ static void WINAPI DOSVM_Int2aHandler(CONTEXT86*);
 static void WINAPI DOSVM_Int41Handler(CONTEXT86*);
 static void WINAPI DOSVM_Int4bHandler(CONTEXT86*);
 static void WINAPI DOSVM_Int5cHandler(CONTEXT86*);
+static void WINAPI DOSVM_DefaultHandler(CONTEXT86*);
 
 static FARPROC16     DOSVM_Vectors16[256];
 static FARPROC48     DOSVM_Vectors48[256];
@@ -75,7 +76,8 @@ static const INTPROC DOSVM_VectorsBuiltin[] =
   /* 58 */ 0,                  0,                  0,                  0,
   /* 5C */ DOSVM_Int5cHandler, 0,                  0,                  0,
   /* 60 */ 0,                  0,                  0,                  0,
-  /* 64 */ 0,                  0,                  0,                  DOSVM_Int67Handler
+  /* 64 */ 0,                  0,                  0,                  DOSVM_Int67Handler,
+  /* 68 */ DOSVM_DefaultHandler
 };
 
 
@@ -257,7 +259,7 @@ static void DOSVM_PushFlags( CONTEXT86 *context, BOOL islong, BOOL isstub )
  * Pushes interrupt frame to stack and changes instruction 
  * pointer to interrupt handler.
  */
-void WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *context, BYTE intnum ) 
+BOOL WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *context, BYTE intnum ) 
 {
     TRACE_(relay)("Call DOS int 0x%02x ret=%04x:%08x\n"
                   "  eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
@@ -326,12 +328,14 @@ void WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *context, BYTE intnum )
     }
     else if (wine_ldt_is_system(context->SegCs))
     {
-        DOSVM_CallBuiltinHandler( context, intnum );
+        INTPROC proc = DOSVM_GetBuiltinHandler( intnum );
+        if (!proc) return FALSE;
     }
     else
     {
         DOSVM_HardwareInterruptPM( context, intnum );
     }
+    return TRUE;
 }
 
 




More information about the wine-cvs mailing list