kernel32: Emulate some instructions working with cr4.

Alexander Morozov amorozov at etersoft.ru
Thu Mar 5 03:51:48 CST 2009


Changelog
   Emulate some instructions working with cr4.
-------------- next part --------------
From fead8b1323da3bae71fa9db11f89a16b78197764 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Wed, 25 Feb 2009 14:32:11 +0300
Subject: [PATCH] kernel32: Emulate some instructions working with cr4.

---
 dlls/kernel32/instr.c |   71 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c
index 7fdc4cd..22db200 100644
--- a/dlls/kernel32/instr.c
+++ b/dlls/kernel32/instr.c
@@ -524,19 +524,54 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
         case 0x0f: /* extended instruction */
             switch(instr[1])
             {
-	    case 0x22: /* mov eax, crX */
+	    case 0x22: /* mov eXX, crX */
                 switch (instr[2])
                 {
-		case 0xc0:
+		case 0xc0: /* mov eax, cr0 */
 			ERR("mov eax,cr0 at 0x%08x, EAX=0x%08x\n",
                             context->Eip,context->Eax );
                         context->Eip += prefixlen+3;
 			return ExceptionContinueExecution;
+		case 0xe0: /* mov eax, cr4 */
+			ERR("mov eax,cr4 at 0x%08x, EAX=0x%08x\n",
+                            context->Eip,context->Eax);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe1: /* mov ecx, cr4 */
+			ERR("mov ecx,cr4 at 0x%08x, ECX=0x%08x\n",
+                            context->Eip,context->Ecx);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe2: /* mov edx, cr4 */
+			ERR("mov edx,cr4 at 0x%08x, EDX=0x%08x\n",
+                            context->Eip,context->Edx);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe3: /* mov ebx, cr4 */
+			ERR("mov ebx,cr4 at 0x%08x, EBX=0x%08x\n",
+                            context->Eip,context->Ebx);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe5: /* mov ebp, cr4 */
+			ERR("mov ebp,cr4 at 0x%08x, EBP=0x%08x\n",
+                            context->Eip,context->Ebp);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe6: /* mov esi, cr4 */
+			ERR("mov esi,cr4 at 0x%08x, ESI=0x%08x\n",
+                            context->Eip,context->Esi);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
+		case 0xe7: /* mov edi, cr4 */
+			ERR("mov edi,cr4 at 0x%08x, EDI=0x%08x\n",
+                            context->Eip,context->Edi);
+			context->Eip += prefixlen+3;
+			return ExceptionContinueExecution;
 		default:
 			break; /*fallthrough to bad instruction handling */
 		}
 		break; /*fallthrough to bad instruction handling */
-	    case 0x20: /* mov crX, eax */
+	    case 0x20: /* mov crX, eXX */
                 switch (instr[2])
                 {
 		case 0xe0: /* mov cr4, eax */
@@ -555,6 +590,36 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
                     context->Eax = 0;
                     context->Eip += prefixlen+3;
 		    return ExceptionContinueExecution;
+		case 0xe1: /* mov cr4, ecx */
+		    ERR("mov cr4,ecx at 0x%08x\n",context->Eip);
+		    context->Ecx = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		case 0xe2: /* mov cr4, edx */
+		    ERR("mov cr4,edx at 0x%08x\n",context->Eip);
+		    context->Edx = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		case 0xe3: /* mov cr4, ebx */
+		    ERR("mov cr4,ebx at 0x%08x\n",context->Eip);
+		    context->Ebx = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		case 0xe5: /* mov cr4, ebp */
+		    ERR("mov cr4,ebp at 0x%08x\n",context->Eip);
+		    context->Ebp = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		case 0xe6: /* mov cr4, esi */
+		    ERR("mov cr4,esi at 0x%08x\n",context->Eip);
+		    context->Esi = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
+		case 0xe7: /* mov cr4, edi */
+		    ERR("mov cr4,edi at 0x%08x\n",context->Eip);
+		    context->Edi = 0;
+		    context->Eip += prefixlen+3;
+		    return ExceptionContinueExecution;
 		case 0xc0: /* mov cr0, eax */
                     ERR("mov cr0,eax at 0x%08x\n",context->Eip);
                     context->Eax = 0x10; /* FIXME: set more bits ? */
-- 
1.6.1.3.GIT



More information about the wine-patches mailing list