[PATCH] ntoskrnl.exe: Added more debugging register instruction handling.

Austin Lund austin.lund at gmail.com
Thu Jun 30 05:59:41 CDT 2011


---
 dlls/ntoskrnl.exe/instr.c |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index dd33085..1ac40e4 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -355,11 +355,26 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
         case 0x21: /* mov drX, eax */
             switch (instr[2])
             {
+            case 0xc0: /* mov dr0, eax */
+                TRACE("mov dr0,eax at 0x%08x\n",context->Eip);
+                context->Eax = context->Dr0;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
             case 0xc8: /* mov dr1, eax */
                 TRACE("mov dr1,eax at 0x%08x\n",context->Eip);
                 context->Eax = context->Dr1;
                 context->Eip += prefixlen+3;
                 return ExceptionContinueExecution;
+            case 0xd0: /* mov dr2, eax */
+                TRACE("mov dr2,eax at 0x%08x\n",context->Eip);
+                context->Eax = context->Dr2;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
+            case 0xd8: /* mov dr3, eax */
+                TRACE("mov dr3,eax at 0x%08x\n",context->Eip);
+                context->Eax = context->Dr3;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
             case 0xf8: /* mov dr7, eax */
                 TRACE("mov dr7,eax at 0x%08x\n",context->Eip);
                 context->Eax = 0x400;
@@ -369,13 +384,37 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
             ERR("Unsupported DR register, eip+2 is %02x\n", instr[2]);
             /* fallthrough to illegal instruction */
             break;
-        case 0x23: /* mov eax drX */
+        case 0x23: /* mov eax, drX */
             switch (instr[2])
             {
+            case 0xc0: /* mov eax, dr0 */
+                TRACE("mov eax,dr0 at 0x%08x\n",context->Eip);
+                context->Dr0 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
             case 0xc8: /* mov eax, dr1 */
+                TRACE("mov eax,dr1 at 0x%08x\n",context->Eip);
                 context->Dr1 = context->Eax;
                 context->Eip += prefixlen+3;
                 return ExceptionContinueExecution;
+            case 0xd0: /* mov eax, dr2 */
+                TRACE("mov eax,dr2 at 0x%08x\n",context->Eip);
+                context->Dr2 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
+            case 0xd8: /* mov eax, dr3 */
+                TRACE("mov eax,dr3 at 0x%08x\n",context->Eip);
+                context->Dr3 = context->Eax;
+                context->Eip += prefixlen+3;
+                return ExceptionContinueExecution;
+            case 0xf8: /* mov eax, dr7 (only if eax == 0x400) */
+                TRACE("mov eax,dr7 at 0x%08x\n",context->Eip);
+                if (context->Eax == 0x400)
+                {
+                    context->Eip += prefixlen+3;
+                    return ExceptionContinueExecution;
+                }
+                break;
             }
             ERR("Unsupported DR register, eip+2 is %02x\n", instr[2]);
             /* fallthrough to illegal instruction */
-- 
1.7.4.1




More information about the wine-patches mailing list