Index: trunk/src/VBox/VMM/VMMR3/VMMTests.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/VMMTests.cpp	(revision 47688)
+++ trunk/src/VBox/VMM/VMMR3/VMMTests.cpp	(revision 47689)
@@ -70,4 +70,5 @@
         return rc;
 
+    Log(("vmmR3DoGCTest: %d %#x\n", enmTestcase, uVariation));
     CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
     vmmR3TestClearStack(pVCpu);
@@ -79,4 +80,21 @@
     Assert(CPUMGetHyperCR3(pVCpu) && CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu));
     rc = SUPR3CallVMMR0Fast(pVM->pVMR0, VMMR0_DO_RAW_RUN, 0);
+
+#if 1
+    /* flush the raw-mode logs. */
+# ifdef LOG_ENABLED
+    PRTLOGGERRC pLogger = pVM->vmm.s.pRCLoggerR3;
+    if (   pLogger
+        && pLogger->offScratch > 0)
+        RTLogFlushRC(NULL, pLogger);
+# endif
+# ifdef VBOX_WITH_RC_RELEASE_LOGGING
+    PRTLOGGERRC pRelLogger = pVM->vmm.s.pRCRelLoggerR3;
+    if (RT_UNLIKELY(pRelLogger && pRelLogger->offScratch > 0))
+        RTLogFlushRC(RTLogRelDefaultInstance(), pRelLogger);
+# endif
+#endif
+
+    Log(("vmmR3DoGCTest: rc=%Rrc iLastGZRc=%Rrc\n", rc, pVCpu->vmm.s.iLastGZRc));
     if (RT_LIKELY(rc == VINF_SUCCESS))
         rc = pVCpu->vmm.s.iLastGZRc;
@@ -246,5 +264,5 @@
         {
             RTPrintf("VMM: Nop test failed, rc=%Rrc not VINF_SUCCESS\n", rc);
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -260,5 +278,5 @@
         {
             RTPrintf("VMM: DR0=0x10000 test failed with rc=%Rrc!\n", rc);
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -273,5 +291,5 @@
         {
             RTPrintf("VMM: DR1=VMMGCEntry test failed with rc=%Rrc! expected VINF_EM_RAW_BREAKPOINT_HYPER\n", rc);
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -283,5 +301,5 @@
         {
             RTPrintf("VMM: failed to resume on hyper breakpoint, rc=%Rrc = KNOWN BUG\n", rc); /** @todo fix VMMR3ResumeHyper */
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -292,5 +310,5 @@
         {
             RTPrintf("VMM: DR1=VMMGCEntry test failed with rc=%Rrc! expected VINF_EM_RAW_BREAKPOINT_HYPER\n", rc);
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -305,5 +323,5 @@
             {
                 RTPrintf("\nVMM: failed to step on hyper breakpoint, rc=%Rrc\n", rc);
-                return rc;
+                return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
             }
             RTGCUINTREG Pc = CPUMGetHyperEIP(pVCpu);
@@ -329,5 +347,5 @@
         {
             RTPrintf("VMM: NOP failed, rc=%Rrc\n", rc);
-            return rc;
+            return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
         }
 
@@ -343,5 +361,5 @@
             {
                 RTPrintf("VMM: Interrupt masking failed: rc=%Rrc\n", rc);
-                return rc;
+                return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
             }
             uint64_t Ticks = ASMReadTSC() - StartTick;
Index: trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
===================================================================
--- trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac	(revision 47688)
+++ trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac	(revision 47689)
@@ -784,4 +784,6 @@
 .if_clear_out:
 %endif
+    mov     edi, eax                    ; save return code in EDI (careful with COM_DWORD_REG from here on!)
+
     ; str     [edx + CPUMCPU.Hyper.tr] - double fault only, and it won't be right then either.
     sldt    [edx + CPUMCPU.Hyper.ldtr.Sel]
@@ -791,5 +793,5 @@
 
     ; Disable debug registers if active so they cannot trigger while switching.
-    test    dword [edi + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
+    test    dword [edx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
     jz      .gth_disabled_dr7
     mov     eax, X86_DR7_INIT_VAL
@@ -800,5 +802,4 @@
     ;; Load Intermediate memory context.
     ;;
-    mov     edi, eax                    ; save return code in EDI (careful with COM_DWORD_REG from here on!)
     FIXUP SWITCHER_FIX_INTER_CR3_GC, 1
     mov     eax, 0ffffffffh
Index: trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac
===================================================================
--- trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac	(revision 47688)
+++ trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac	(revision 47689)
@@ -515,5 +515,5 @@
     mov     eax, dr3
     mov     [edx + CPUMCPU.Host.dr3], eax
-    or      dword [edi + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HOST
+    or      dword [edx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HOST
 
     ; load hyper DR0-7
@@ -530,5 +530,5 @@
     mov     eax, [edx + CPUMCPU.Hyper.dr + 8*7]
     mov     dr7, eax
-    or      dword [edi + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
+    or      dword [edx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
     jmp     htg_debug_regs_guest_done
 
@@ -682,4 +682,5 @@
     ; special registers which may change.
 vmmRCToHostAsm_SaveNoGeneralRegs:
+    mov     edi, eax                    ; save return code in EDI (careful with COM_DWORD_REG from here on!)
     ; str     [edx + CPUMCPU.Hyper.tr] - double fault only, and it won't be right then either.
     sldt    [edx + CPUMCPU.Hyper.ldtr.Sel]
@@ -689,5 +690,5 @@
 
     ; Disable debug regsiters if active so they cannot trigger while switching.
-    test    dword [edi + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
+    test    dword [edx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
     jz      .gth_disabled_dr7
     mov     eax, X86_DR7_INIT_VAL
@@ -700,5 +701,4 @@
     ;
     mov     esi, edx
-    mov     edi, eax
 
     xor     edx, edx
@@ -707,5 +707,4 @@
     wrmsr
 
-    mov     eax, edi
     mov     edx, esi
 %endif
@@ -715,5 +714,4 @@
     ;; Load Intermediate memory context.
     ;;
-    mov     edi, eax                    ; save return code in EDI (careful with COM_DWORD_REG from here on!)
     mov     ecx, [edx + CPUMCPU.Host.cr3]
     FIXUP SWITCHER_FIX_INTER_CR3_GC, 1
