[PATCH] ntoskrnl.exe: emulate some more mov eax -> drX

Marcus Meissner marcus at jet.franken.de
Sun Sep 7 13:22:33 CDT 2014


Needed by a copy protection module. Just proceeding works so far.
---
 dlls/ntoskrnl.exe/instr.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index dd33085..29b38e8 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -366,18 +366,39 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
                 context->Eip += prefixlen+3;
                 return ExceptionContinueExecution;
             }
-            ERR("Unsupported DR register, eip+2 is %02x\n", instr[2]);
+            ERR("Unsupported DR register -> EAX, eip+2 is %02x\n", instr[2]);
             /* fallthrough to illegal instruction */
             break;
         case 0x23: /* mov eax drX */
             switch (instr[2])
             {
+            case 0xc0: /* mov eax, dr0 */
+		FIXME("Driver wants to set DR0 to %08x\n", context->Eax);
+                context->Dr0 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
             case 0xc8: /* mov eax, dr1 */
+		FIXME("Driver wants to set DR1 to %08x\n", context->Eax);
                 context->Dr1 = context->Eax;
                 context->Eip += prefixlen+3;
                 return ExceptionContinueExecution;
+            case 0xd0: /* mov eax, dr2 */
+		FIXME("Driver wants to set DR2 to %08x\n", context->Eax);
+                context->Dr2 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
+            case 0xd8: /* mov eax, dr3 */
+		FIXME("Driver wants to set DR3 to %08x\n", context->Eax);
+                context->Dr3 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
+            case 0xf8: /* mov eax, dr7 */
+		FIXME("Driver wants to set DR7 to %08x\n", context->Eax);
+                context->Dr7 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
             }
-            ERR("Unsupported DR register, eip+2 is %02x\n", instr[2]);
+            ERR("Unsupported EAX -> DR register, eip+2 is %02x\n", instr[2]);
             /* fallthrough to illegal instruction */
             break;
         }
-- 
1.8.4.5




More information about the wine-patches mailing list