PATCH: reenable instr emulation

Marcus Meissner marcus at jet.franken.de
Sun Feb 15 15:22:39 CST 2004


Hi,

dr7 patch again, but with reenabling of instruction emulation.

We need it in 32bit mode (for ring0 assuming kernel drivers).

Ciao, Marcus

Changelog:
	Emulate dr7,eax move.
	Reenable instruction emulation for privileged instructions.

Index: dlls/kernel/except.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/except.c,v
retrieving revision 1.3
diff -u -r1.3 except.c
--- dlls/kernel/except.c	28 Jan 2004 21:40:01 -0000	1.3
+++ dlls/kernel/except.c	15 Feb 2004 21:20:02 -0000
@@ -446,6 +446,8 @@
             TerminateProcess( GetCurrentProcess(), 1 );
         }
 
+        if (INSTR_EmulateInstruction( epointers->ExceptionRecord, epointers->ContextRecord) == ExceptionContinueExecution)
+		return EXCEPTION_CONTINUE_EXECUTION;
         if (top_filter)
         {
             DWORD ret = top_filter( epointers );
Index: dlls/kernel/instr.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/instr.c,v
retrieving revision 1.11
diff -u -r1.11 instr.c
--- dlls/kernel/instr.c	27 Nov 2003 00:59:36 -0000	1.11
+++ dlls/kernel/instr.c	15 Feb 2004 21:20:02 -0000
@@ -559,6 +559,20 @@
 		}
 		/* fallthrough to illegal instruction */
 		break;
+	    case 0x21: /* mov drX, eax */
+                switch (instr[2])
+                {
+		case 0xf8: /* mov dr7, eax */
+                    TRACE("mov dr7,eax at 0x%08lx\n",context->Eip);
+                    context->Eax = 0;
+                    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		default: /* fallthrough to illegal instruction */
+		    ERR("Unknown DR register, eip+2 is %02x\n", instr[2]);
+		    break;
+		}
+		/* fallthrough to illegal instruction */
+		break;
             case 0xa1: /* pop fs */
                 {
                     WORD seg = *(WORD *)get_stack( context );
Index: dlls/kernel/kernel_private.h
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel_private.h,v
retrieving revision 1.11
diff -u -r1.11 kernel_private.h
--- dlls/kernel/kernel_private.h	12 Feb 2004 00:00:55 -0000	1.11
+++ dlls/kernel/kernel_private.h	15 Feb 2004 21:20:02 -0000
@@ -58,6 +58,7 @@
 
 extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
 extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum );
+extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
 
 extern BOOL NLS_IsUnicodeOnlyLcid(LCID);
 
-- 



More information about the wine-patches mailing list