Index: /trunk/include/VBox/em.h
===================================================================
--- /trunk/include/VBox/em.h	(revision 9983)
+++ /trunk/include/VBox/em.h	(revision 9984)
@@ -314,18 +314,18 @@
 EMDECL(int) EMInterpretPortIO(PVM pVM, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, uint32_t cbOp);
 
-EMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateAnd(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateInc(uint32_t *pu32Param1, size_t cb);
-EMDECL(uint32_t) EMEmulateDec(uint32_t *pu32Param1, size_t cb);
-EMDECL(uint32_t) EMEmulateOr(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(int)      EMEmulateLockOr(RTRCPTR GCPtrParam1, RTGCUINTREG32 Param2, size_t cbSize, RTGCUINTREG32 *pf);
-EMDECL(uint32_t) EMEmulateXor(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateAdd(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateSub(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateAdcWithCarrySet(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
-EMDECL(uint32_t) EMEmulateBtr(uint32_t *pu32Param1, uint32_t u32Param2);
-EMDECL(int)      EMEmulateLockBtr(RTRCPTR GCPtrParam1, RTGCUINTREG32 Param2, RTGCUINTREG32 *pf);
-EMDECL(uint32_t) EMEmulateBts(uint32_t *pu32Param1, uint32_t u32Param2);
-EMDECL(uint32_t) EMEmulateBtc(uint32_t *pu32Param1, uint32_t u32Param2);
+EMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateAnd(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateInc(void *pvParam1, size_t cb);
+EMDECL(uint32_t) EMEmulateDec(void *pvParam1, size_t cb);
+EMDECL(uint32_t) EMEmulateOr(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(int)      EMEmulateLockOr(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf);
+EMDECL(uint32_t) EMEmulateXor(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateAdd(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateSub(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateAdcWithCarrySet(void *pvParam1, uint64_t u64Param2, size_t cb);
+EMDECL(uint32_t) EMEmulateBtr(void *pvParam1, uint64_t u64Param2);
+EMDECL(int)      EMEmulateLockBtr(void *pvParam1, uint64_t u64Param2, RTGCUINTREG32 *pf);
+EMDECL(uint32_t) EMEmulateBts(void *pvParam1, uint64_t u64Param2);
+EMDECL(uint32_t) EMEmulateBtc(void *pvParam1, uint64_t u64Param2);
 EMDECL(uint32_t) EMEmulateLockCmpXchg32(RTHCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize);
 EMDECL(uint32_t) EMEmulateCmpXchg32(RTHCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize);
Index: /trunk/src/VBox/VMM/VMMAll/EMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 9983)
+++ /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 9984)
@@ -52,10 +52,10 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
-typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2_UINT32(uint32_t *pu32Param1, uint32_t val2);
-typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2(uint32_t *pu32Param1, size_t val2);
-typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM3(uint32_t *pu32Param1, uint32_t val2, size_t val3);
-typedef DECLCALLBACK(int)      FNEMULATELOCKPARAM2(RTRCPTR GCPtrParam1, RTGCUINTREG32 Val2, RTGCUINTREG32 *pf);
+typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2_UINT32(void *pvParam1, uint64_t val2);
+typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2(void *pvParam1, size_t val2);
+typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM3(void *pvParam1, uint64_t val2, size_t val3);
+typedef DECLCALLBACK(int)      FNEMULATELOCKPARAM2(void *pvParam1, uint64_t val2, RTGCUINTREG32 *pf);
 typedef FNEMULATELOCKPARAM2 *PFNEMULATELOCKPARAM2;
-typedef DECLCALLBACK(int)      FNEMULATELOCKPARAM3(RTRCPTR GCPtrParam1, RTGCUINTREG32 Val2, size_t cb, RTGCUINTREG32 *pf);
+typedef DECLCALLBACK(int)      FNEMULATELOCKPARAM3(void *pvParam1, uint64_t val2, size_t cb, RTGCUINTREG32 *pf);
 typedef FNEMULATELOCKPARAM3 *PFNEMULATELOCKPARAM3;
 
@@ -348,5 +348,5 @@
 }
 
-#if defined(IN_GC) && (defined(VBOX_STRICT) || defined(LOG_ENABLED))
+#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
 /** 
  * Get the mnemonic for the disassembled instruction.
@@ -542,5 +542,4 @@
                              PFN_EMULATE_PARAM2 pfnEmulate)
 {
-    Assert(pCpu->mode != CPUMODE_64BIT);    /** @todo check */
     OP_PARAMVAL param1;
 
@@ -556,5 +555,5 @@
 #endif
             RTGCPTR pParam1 = 0;
-            uint32_t valpar1;
+            uint64_t valpar1;
 
             if (param1.type == PARMTYPE_ADDRESS)
@@ -695,5 +694,4 @@
                                PFN_EMULATE_PARAM3 pfnEmulate)
 {
-    Assert(pCpu->mode != CPUMODE_64BIT);    /** @todo check */
     OP_PARAMVAL param1, param2;
     int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, PARAM_DEST);
@@ -725,5 +723,5 @@
 #endif
             RTGCPTR  pParam1;
-            uint32_t valpar1, valpar2;
+            uint64_t valpar1, valpar2;
 
             if (pCpu->param1.size != pCpu->param2.size)
@@ -766,5 +764,5 @@
             {
             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
-                valpar2 = param2.val.val32;
+                valpar2 = param2.val.val64;
                 break;
 
@@ -796,5 +794,4 @@
 }
 
-#ifdef IN_GC
 /**
  * LOCK XOR/OR/AND Emulation.
@@ -803,5 +800,6 @@
                                    uint32_t *pcbSize, PFNEMULATELOCKPARAM3 pfnEmulate)
 {
-    Assert(pCpu->mode != CPUMODE_64BIT);    /** @todo check */
+    void *pvParam1;
+
     OP_PARAMVAL param1, param2;
     int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, PARAM_DEST);
@@ -826,6 +824,17 @@
     /* The destination is always a virtual address */
     AssertReturn(param1.type == PARMTYPE_ADDRESS, VERR_EM_INTERPRETER);
-    RTGCPTR GCPtrPar1 = (RTGCPTR)param1.val.val32;
+
+    RTGCPTR GCPtrPar1 = param1.val.val64;
     GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, GCPtrPar1);
+#ifdef IN_GC
+    pvParam1  = (void *)GCPtrPar1;
+#else
+    rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrPar1, &pvParam1);
+    if (VBOX_FAILURE(rc))
+    {
+        AssertRC(rc);
+        return VERR_EM_INTERPRETER;
+    }
+#endif
 
 # ifdef IN_GC
@@ -838,17 +847,20 @@
     /* Register and immediate data == PARMTYPE_IMMEDIATE */
     AssertReturn(param2.type == PARMTYPE_IMMEDIATE, VERR_EM_INTERPRETER);
-    RTGCUINTREG32 ValPar2 = param2.val.val32;
+    RTGCUINTREG ValPar2 = param2.val.val64;
 
     /* Try emulate it with a one-shot #PF handler in place. */
-    Log2(("%s %RGv imm%d=%RGr\n", emGetMnemonic(pCpu), GCPtrPar1, pCpu->param2.size*8, ValPar2));
+    Log2(("%s %VGv imm%d=%RX64\n", emGetMnemonic(pCpu), GCPtrPar1, pCpu->param2.size*8, ValPar2));
 
     RTGCUINTREG32 eflags = 0;
+#ifdef IN_GC
     MMGCRamRegisterTrapHandler(pVM);
-    rc = pfnEmulate((RTRCPTR)GCPtrPar1, ValPar2, pCpu->param2.size, &eflags);
+#endif
+    rc = pfnEmulate(pvParam1, ValPar2, pCpu->param2.size, &eflags);
+#ifdef IN_GC
     MMGCRamDeregisterTrapHandler(pVM);
-
+#endif
     if (RT_FAILURE(rc))
     {
-        Log(("%s %RGv imm%d=%RGr -> emulation failed due to page fault!\n", emGetMnemonic(pCpu), GCPtrPar1, pCpu->param2.size*8, ValPar2));
+        Log(("%s %VGv imm%d=%RX64-> emulation failed due to page fault!\n", emGetMnemonic(pCpu), GCPtrPar1, pCpu->param2.size*8, ValPar2));
         return VERR_EM_INTERPRETER;
     }
@@ -861,5 +873,4 @@
     return VINF_SUCCESS;
 }
-#endif
 
 /**
@@ -869,5 +880,4 @@
                              PFN_EMULATE_PARAM3 pfnEmulate)
 {
-    Assert(pCpu->mode != CPUMODE_64BIT);    /** @todo check */
     OP_PARAMVAL param1, param2;
     int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, PARAM_DEST);
@@ -899,5 +909,5 @@
 #endif
             RTGCPTR  pParam1;
-            uint32_t valpar1, valpar2;
+            uint64_t valpar1, valpar2;
 
             if (pCpu->param1.size != pCpu->param2.size)
@@ -942,5 +952,5 @@
             {
             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
-                valpar2 = param2.val.val32;
+                valpar2 = param2.val.val64;
                 break;
 
@@ -1018,5 +1028,5 @@
 #endif
             RTGCPTR  pParam1;
-            uint32_t valpar1 = 0, valpar2;
+            uint64_t valpar1 = 0, valpar2;
             uint32_t eflags;
 
@@ -1032,5 +1042,5 @@
             {
             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
-                valpar2 = param2.val.val32;
+                valpar2 = param2.val.val64;
                 break;
 
@@ -1078,5 +1088,4 @@
 }
 
-#ifdef IN_GC
 /**
  * LOCK BTR/C/S Emulation.
@@ -1085,5 +1094,6 @@
                                   uint32_t *pcbSize, PFNEMULATELOCKPARAM2 pfnEmulate)
 {
-    Assert(pCpu->mode != CPUMODE_64BIT);    /** @todo check */
+    void *pvParam1;
+
     OP_PARAMVAL param1, param2;
     int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, PARAM_DEST);
@@ -1099,37 +1109,52 @@
         return VERR_EM_INTERPRETER;
 
-    RTGCPTR GCPtrPar1 = (RTGCPTR)param1.val.val64;
-    GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, GCPtrPar1);
-
     /* Register and immediate data == PARMTYPE_IMMEDIATE */
     AssertReturn(param2.type == PARMTYPE_IMMEDIATE, VERR_EM_INTERPRETER);
-    RTGCUINTREG32 ValPar2 = param2.val.val32;
-
-    Log2(("emInterpretLockBitTest %s: pvFault=%VGv GCPtrPar1=%RGv imm=%RGr\n", emGetMnemonic(pCpu), pvFault, GCPtrPar1, ValPar2));
+    uint64_t ValPar2 = param2.val.val64;
 
     /* Adjust the parameters so what we're dealing with is a bit within the byte pointed to. */
-    GCPtrPar1 = (RTGCPTR)((RTGCUINTPTR)GCPtrPar1 + ValPar2 / 8);
+    RTGCPTR GCPtrPar1 = param1.val.val64;
+    GCPtrPar1 = (GCPtrPar1 + ValPar2 / 8);
     ValPar2 &= 7;
-# ifdef IN_GC
+
+#ifdef IN_GC
+    GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, GCPtrPar1);
+    pvParam1  = (void *)GCPtrPar1;
+#else
+    GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, GCPtrPar1);
+    rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrPar1, &pvParam1);
+    if (VBOX_FAILURE(rc))
+    {
+        AssertRC(rc);
+        return VERR_EM_INTERPRETER;
+    }
+#endif
+
+    Log2(("emInterpretLockBitTest %s: pvFault=%VGv GCPtrPar1=%VGv imm=%RX64\n", emGetMnemonic(pCpu), pvFault, GCPtrPar1, ValPar2));
+
+#ifdef IN_GC
     Assert(TRPMHasTrap(pVM));
     AssertMsgReturn((RTGCPTR)((RTGCUINTPTR)GCPtrPar1 & ~(RTGCUINTPTR)3) == pvFault, 
                     ("GCPtrPar1=%VGv pvFault=%VGv\n", GCPtrPar1, pvFault), 
                     VERR_EM_INTERPRETER);
-# endif
+#endif
 
     /* Try emulate it with a one-shot #PF handler in place. */
     RTGCUINTREG32 eflags = 0;
+#ifdef IN_GC
     MMGCRamRegisterTrapHandler(pVM);
-    rc = pfnEmulate((RTRCPTR)GCPtrPar1, ValPar2, &eflags);
+#endif
+    rc = pfnEmulate(pvParam1, ValPar2, &eflags);
+#ifdef IN_GC
     MMGCRamDeregisterTrapHandler(pVM);
-
+#endif
     if (RT_FAILURE(rc))
     {
-        Log(("emInterpretLockBitTest %s: %RGv imm%d=%RGr -> emulation failed due to page fault!\n", 
+        Log(("emInterpretLockBitTest %s: %VGv imm%d=%RX64 -> emulation failed due to page fault!\n", 
              emGetMnemonic(pCpu), GCPtrPar1, pCpu->param2.size*8, ValPar2));
         return VERR_EM_INTERPRETER;
     }
 
-    Log2(("emInterpretLockBitTest %s: GCPtrPar1=%RGv imm=%RGr CF=%d\n", emGetMnemonic(pCpu), GCPtrPar1, ValPar2, !!(eflags & X86_EFL_CF)));
+    Log2(("emInterpretLockBitTest %s: GCPtrPar1=%VGv imm=%VX64 CF=%d\n", emGetMnemonic(pCpu), GCPtrPar1, ValPar2, !!(eflags & X86_EFL_CF)));
 
     /* Update guest's eflags and finish. */
@@ -1140,5 +1165,4 @@
     return VINF_SUCCESS;
 }
-#endif /* IN_GC */
 
 /**
@@ -1520,4 +1544,5 @@
 #endif
 
+#ifdef IN_GC
 /**
  * Interpret IRET (currently only to V86 code)
@@ -1571,5 +1596,5 @@
     return VINF_SUCCESS;
 }
-
+#endif
 
 /**
@@ -2433,5 +2458,10 @@
        )
 #else
-    if (pCpu->prefix & (PREFIX_REPNE | PREFIX_REP | PREFIX_LOCK))
+    if (    (pCpu->prefix & (PREFIX_REPNE | PREFIX_REP))
+        ||  (   (pCpu->prefix & PREFIX_LOCK)
+             && pCpu->pCurInstr->opcode != OP_OR
+             && pCpu->pCurInstr->opcode != OP_BTR
+            )
+       )
 #endif
     {
@@ -2447,5 +2477,4 @@
     switch (pCpu->pCurInstr->opcode)
     {
-#ifdef IN_GC
 # define INTERPRET_CASE_EX_LOCK_PARAM3(opcode, Instr, InstrFn, pfnEmulate, pfnEmulateLock) \
         case opcode:\
@@ -2459,8 +2488,4 @@
                 STAM_COUNTER_INC(&pVM->em.s.CTXSUFF(pStats)->CTXMID(Stat,Failed##Instr)); \
             return rc
-#else
-# define INTERPRET_CASE_EX_LOCK_PARAM3(opcode, Instr, InstrFn, pfnEmulate, pfnEmulateLock) \
-        INTERPRET_CASE_EX_PARAM3(opcode, Instr, InstrFn, pfnEmulate)
-#endif 
 #define INTERPRET_CASE_EX_PARAM3(opcode, Instr, InstrFn, pfnEmulate) \
         case opcode:\
Index: /trunk/src/VBox/VMM/VMMAll/EMAllA.asm
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/EMAllA.asm	(revision 9983)
+++ /trunk/src/VBox/VMM/VMMAll/EMAllA.asm	(revision 9984)
@@ -48,10 +48,10 @@
 ;;
 ; Emulate CMP instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]  rdi  rcx       Param 1 - First parameter (Dst).
 ; @param    [esp + 08h]  rsi  edx       Param 2 - Second parameter (Src).
-; @param    [esp + 0ch]  rdx  r8        Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ;
 align 16
@@ -66,5 +66,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -112,10 +112,10 @@
 ;;
 ; Emulate AND instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateAnd(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateAnd(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -131,5 +131,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -177,10 +177,10 @@
 ;;
 ; Emulate OR instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateOr(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateOr(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -196,5 +196,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -241,11 +241,11 @@
 ;;
 ; Emulate LOCK OR instruction.
-; EMDECL(int) EMEmulateLockOr(RTGCPTR GCPtrParam1, RTGCUINTREG Param2, size_t cbSize, RTGCUINTREG *pf);
+; EMDECL(int)      EMEmulateLockOr(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf);
 ;
 ; @returns VINF_SUCCESS on success, VERR_ACCESS_DENIED on \#PF (GC only).
 ; @param    [esp + 04h]  gcc:rdi  msc:rcx   Param 1 - First parameter - pointer to data item (the real stuff).
 ; @param    [esp + 08h]  gcc:rsi  msc:rdx   Param 2 - Second parameter- the immediate / register value.
-; @param    [esp + 0ch]  gcc:rdx  msc:r8    Param 3 - Size of the operation - 1, 2, 4 or 8 bytes.
-; @param    [esp + 10h]  gcc:rcx  msc:r9    Param 4 - Where to store the eflags on success.
+; @param    [esp + 10h]  gcc:rdx  msc:r8    Param 3 - Size of the operation - 1, 2, 4 or 8 bytes.
+; @param    [esp + 14h]  gcc:rcx  msc:r9    Param 4 - Where to store the eflags on success.
 ;                                                     only arithmetic flags are valid.
 align 16
@@ -260,5 +260,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter (MY_PTR_REG)
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -307,5 +307,5 @@
  %endif ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 10h + 4]
+    mov     eax, [esp + 14h + 4]
     pop     dword [eax]
 %endif
@@ -324,10 +324,10 @@
 ;;
 ; Emulate XOR instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateXor(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateXor(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -343,5 +343,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -388,5 +388,5 @@
 ;;
 ; Emulate INC instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateInc(uint32_t *pu32Param1, size_t cb);
+; EMDECL(uint32_t) EMEmulateInc(void *pvParam1, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags are valid.
@@ -451,5 +451,5 @@
 ;;
 ; Emulate DEC instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateDec(uint32_t *pu32Param1, size_t cb);
+; EMDECL(uint32_t) EMEmulateDec(void *pvParam1, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags are valid.
@@ -513,10 +513,10 @@
 ;;
 ; Emulate ADD instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateAdd(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateAdd(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -532,5 +532,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -577,10 +577,10 @@
 ;;
 ; Emulate ADC instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateAdcWithCarrySet(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateAdcWithCarrySet(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -596,5 +596,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -645,10 +645,10 @@
 ;;
 ; Emulate SUB instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateSub(uint32_t *pu32Param1, uint32_t u32Param2, size_t cb);
+; EMDECL(uint32_t) EMEmulateSub(void *pvParam1, uint64_t u64Param2, size_t cb);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
 ; @param    [esp + 04h]    Param 1 - First parameter - pointer to data item.
 ; @param    [esp + 08h]    Param 2 - Second parameter.
-; @param    [esp + 0ch]    Param 3 - Size of parameters, only 1/2/4 is valid.
+; @param    [esp + 10h]    Param 3 - Size of parameters, only 1/2/4/8 (64 bits host only) is valid.
 ; @uses     eax, ecx, edx
 ;
@@ -664,5 +664,5 @@
 %endif  ; !RT_OS_WINDOWS
 %else   ; !RT_ARCH_AMD64
-    mov     eax, [esp + 0ch]            ; eax = size of parameters
+    mov     eax, [esp + 10h]            ; eax = size of parameters
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
@@ -710,5 +710,5 @@
 ;;
 ; Emulate BTR instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateBtr(uint32_t *pu32Param1, uint32_t u32Param2);
+; EMDECL(uint32_t) EMEmulateBtr(void *pvParam1, uint64_t u64Param2);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
@@ -740,10 +740,10 @@
 ;;
 ; Emulate LOCK BTR instruction.
-; EMDECL(int) EMEmulateLockBtr(RTGCPTR GCPtrParam1, RTGCUINTREG Param2, uint32_t *pf);
+; EMDECL(int)      EMEmulateLockBtr(void *pvParam1, uint64_t u64Param2, RTGCUINTREG32 *pf);
 ;
 ; @returns VINF_SUCCESS on success, VERR_ACCESS_DENIED on \#PF (GC only).
 ; @param    [esp + 04h]  gcc:rdi  msc:rcx   Param 1 - First parameter - pointer to data item (the real stuff).
 ; @param    [esp + 08h]  gcc:rsi  msc:rdx   Param 2 - Second parameter- the immediate / register value. (really an 8 byte value)
-; @param    [esp + 0ch]  gcc:rdx  msc:r8    Param 3 - Where to store the eflags on success.
+; @param    [esp + 10h]  gcc:rdx  msc:r8    Param 3 - Where to store the eflags on success.
 ;
 align 16
@@ -760,5 +760,5 @@
     mov     ecx, [esp + 04h]            ; ecx = first parameter
     mov     edx, [esp + 08h]            ; edx = second parameter
-    mov     eax, [esp + 0ch]            ; eax = third parameter
+    mov     eax, [esp + 10h]            ; eax = third parameter
 %endif
 
@@ -783,5 +783,5 @@
 ;;
 ; Emulate BTC instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateBtc(uint32_t *pu32Param1, uint32_t u32Param2);
+; EMDECL(uint32_t) EMEmulateBtc(void *pvParam1, uint64_t u64Param2);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags is valid.
@@ -813,5 +813,5 @@
 ;;
 ; Emulate BTS instruction, CDECL calling conv.
-; EMDECL(uint32_t) EMEmulateBts(uint32_t *pu32Param1, uint32_t u32Param2);
+; EMDECL(uint32_t) EMEmulateBts(void *pvParam1, uint64_t u64Param2);
 ;
 ; @returns EFLAGS after the operation, only arithmetic flags are valid.
