Index: /trunk/include/VBox/cdefs.h
===================================================================
--- /trunk/include/VBox/cdefs.h	(revision 107199)
+++ /trunk/include/VBox/cdefs.h	(revision 107200)
@@ -83,4 +83,17 @@
 #endif
 
+/** @def VBOXSTRICTRC_STRICT_ENABLED
+ * Indicates that VBOXSTRICTRC is in strict mode.
+ */
+#if defined(__cplusplus) \
+ && ARCH_BITS == 64    /* cdecl requires classes and structs as hidden params. */ \
+ && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
+ &&  (   defined(RT_STRICT) \
+      || defined(VBOX_STRICT) \
+      || defined(DEBUG) \
+      || defined(DOXYGEN_RUNNING) )
+# define VBOXSTRICTRC_STRICT_ENABLED 1
+#endif
+
 
 /*
@@ -92,4 +105,5 @@
 #define VBOX_STRICT_GUEST
 #define VBOX_NO_STRICT_GUEST
+#define VBOXSTRICTRC_STRICT_ENABLED
 #define IN_DBG
 #define IN_DIS
Index: /trunk/include/VBox/types.h
===================================================================
--- /trunk/include/VBox/types.h	(revision 107199)
+++ /trunk/include/VBox/types.h	(revision 107200)
@@ -267,17 +267,4 @@
     VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
 } VMSTATE;
-
-/** @def VBOXSTRICTRC_STRICT_ENABLED
- * Indicates that VBOXSTRICTRC is in strict mode.
- */
-#if defined(__cplusplus) \
- && ARCH_BITS == 64    /* cdecl requires classes and structs as hidden params. */ \
- && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
- &&  (   defined(RT_STRICT) \
-      || defined(VBOX_STRICT) \
-      || defined(DEBUG) \
-      || defined(DOXYGEN_RUNNING) )
-# define VBOXSTRICTRC_STRICT_ENABLED 1
-#endif
 
 /** We need RTERR_STRICT_RC.  */
Index: /trunk/src/VBox/VMM/VMMAll/IEMAllN8veHlpA-arm64.S
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IEMAllN8veHlpA-arm64.S	(revision 107199)
+++ /trunk/src/VBox/VMM/VMMAll/IEMAllN8veHlpA-arm64.S	(revision 107200)
@@ -81,5 +81,5 @@
         add     x29, sp, #(IEMNATIVE_FRAME_SAVE_REG_SIZE - 16)
         /* Allocate the variable area from SP. */
-        sub     sp, sp, #IEMNATIVE_FRAME_VAR_SIZE
+        sub     sp, sp, #(IEMNATIVE_FRAME_VAR_SIZE + IEMNATIVE_FRAME_ALIGN_SIZE)
         /* Load the fixed register values from parameters. */
         mov     IEMNATIVE_REG_FIXED_PVMCPU_ASM,   x0
Index: /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h	(revision 107199)
+++ /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h	(revision 107200)
@@ -4150,6 +4150,6 @@
      * Load the two or three hidden arguments.
      */
-#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)
-    off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
+#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64))
+    off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict */
     off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
     off = iemNativeEmitLoadGpr8Imm(pReNative, off, IEMNATIVE_CALL_ARG2_GREG, cbInstr);
@@ -4168,6 +4168,6 @@
      */
     off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)pfnCImpl);
-#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)
-    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict (see above) */
+#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64))
+    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict (see above) */
 #endif
     fGstShwFlush = iemNativeCImplFlagsToGuestShadowFlushMask(pReNative->fCImpl, fGstShwFlush | RT_BIT_64(kIemNativeGstReg_Pc));
Index: /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 107199)
+++ /trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 107200)
@@ -6713,5 +6713,5 @@
      * Load the parameters.
      */
-#if defined(RT_OS_WINDOWS) && defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_ARCH_AMD64)
+#if defined(RT_OS_WINDOWS) && defined(VBOXSTRICTRC_STRICT_ENABLED) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64))
     /* Special code the hidden VBOXSTRICTRC pointer. */
     off = iemNativeEmitLoadGprFromGpr(  pReNative, off, IEMNATIVE_CALL_ARG1_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
@@ -6720,8 +6720,16 @@
         off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG3_GREG, uParam0);
     if (cAddParams > 1)
+# if IEMNATIVE_CALL_ARG_GREG_COUNT >= 5
+        off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG4_GREG, uParam1);
+# else
         off = iemNativeEmitStoreImm64ByBp(pReNative, off, IEMNATIVE_FP_OFF_STACK_ARG0, uParam1);
+# endif
     if (cAddParams > 2)
+# if IEMNATIVE_CALL_ARG_GREG_COUNT >= 6
+        off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG5_GREG, uParam2);
+# else
         off = iemNativeEmitStoreImm64ByBp(pReNative, off, IEMNATIVE_FP_OFF_STACK_ARG1, uParam2);
-    off = iemNativeEmitLeaGprByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
+# endif
+    off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict */
 
 #else
@@ -6746,6 +6754,6 @@
     off = iemNativeEmitCallImm(pReNative, off, pfnCImpl);
 
-#if defined(RT_ARCH_AMD64) && defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS)
-    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict (see above) */
+#if defined(RT_OS_WINDOWS) && defined(VBOXSTRICTRC_STRICT_ENABLED) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64))
+    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict (see above) */
 #endif
 
@@ -6807,5 +6815,5 @@
         off = iemNativeEmitStoreGprByBp(pReNative, off, IEMNATIVE_FP_OFF_STACK_ARG0, X86_GREG_x10);
     }
-    off = iemNativeEmitLeaGprByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
+    off = iemNativeEmitLeaGprByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict */
 #  endif /* VBOXSTRICTRC_STRICT_ENABLED */
 # else
@@ -6822,5 +6830,5 @@
 
 # if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS)
-    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict (see above) */
+    off = iemNativeEmitLoadGprByBpU32(pReNative, off, X86_GREG_xAX, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict (see above) */
 # endif
 
@@ -6829,4 +6837,5 @@
      * ARM64:
      */
+# if !defined(RT_OS_WINDOWS) || !defined(VBOXSTRICTRC_STRICT_ENABLED)
     off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
     if (cParams > 0)
@@ -6836,6 +6845,20 @@
     if (cParams > 2)
         off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG3_GREG, pCallEntry->auParams[2]);
+# else
+    off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
+    if (cParams > 0)
+        off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG2_GREG, pCallEntry->auParams[0]);
+    if (cParams > 1)
+        off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG3_GREG, pCallEntry->auParams[1]);
+    if (cParams > 2)
+        off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG4_GREG, pCallEntry->auParams[2]);
+    off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict */
+# endif
 
     off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)g_apfnIemThreadedFunctions[pCallEntry->enmFunction]);
+
+# if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS)
+    off = iemNativeEmitLoadGprByBpU32(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_FP_OFF_VBOXSTRICRC); /* rcStrict (see above) */
+# endif
 
 #else
@@ -7042,9 +7065,9 @@
     uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 10);
 
-    /* ldp x19, x20, [sp #IEMNATIVE_FRAME_VAR_SIZE]! ; Unallocate the variable space and restore x19+x20. */
-    AssertCompile(IEMNATIVE_FRAME_VAR_SIZE < 64*8);
+    /* ldp x19, x20, [sp #(IEMNATIVE_FRAME_VAR_SIZE+IEMNATIVE_FRAME_ALIGN_SIZE)]! ; Unallocate the variable space and restore x19+x20. */
+    AssertCompile(IEMNATIVE_FRAME_VAR_SIZE + IEMNATIVE_FRAME_ALIGN_SIZE < 64*8);
     pu32CodeBuf[off++] = Armv8A64MkInstrStLdPair(true /*fLoad*/, 2 /*64-bit*/, kArm64InstrStLdPairType_PreIndex,
                                                  ARMV8_A64_REG_X19, ARMV8_A64_REG_X20, ARMV8_A64_REG_SP,
-                                                 IEMNATIVE_FRAME_VAR_SIZE / 8);
+                                                 (IEMNATIVE_FRAME_VAR_SIZE + IEMNATIVE_FRAME_ALIGN_SIZE) / 8);
     /* Restore x21 thru x28 + BP and LR (ret address) (SP remains unchanged in the kSigned variant). */
     pu32CodeBuf[off++] = Armv8A64MkInstrStLdPair(true /*fLoad*/, 2 /*64-bit*/, kArm64InstrStLdPairType_Signed,
Index: /trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
===================================================================
--- /trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 107199)
+++ /trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 107200)
@@ -39,4 +39,5 @@
 
 #include <iprt/assertcompile.h> /* for RT_IN_ASSEMBLER mode */
+#include <VBox/cdefs.h>         /* for VBOXSTRICTRC_STRICT_ENABLED */
 
 /** @def IEMNATIVE_WITH_TB_DEBUG_INFO
@@ -159,9 +160,21 @@
 /** Frame pointer (RBP) relative offset of the fourth incoming shadow argument. */
 #  define IEMNATIVE_FP_OFF_IN_SHADOW_ARG3   (40)
+/** The offset to VBOXSTRICTRC on the stack. */
+#  define IEMNATIVE_FP_OFF_VBOXSTRICRC      IEMNATIVE_FP_OFF_IN_SHADOW_ARG0
 # endif
 
 #elif RT_ARCH_ARM64
-/** No alignment padding needed for arm64. */
-# define IEMNATIVE_FRAME_ALIGN_SIZE         0
+/** No alignment padding needed for arm64.
+ * @note HACK ALERT! We abuse this for keeping VBOXSTRICTRC on windows, since
+ *       it isn't allowed to be returned by register. */
+# define IEMNATIVE_FRAME_ALIGN_SIZE        0
+# ifdef VBOXSTRICTRC_STRICT_ENABLED
+#  ifdef RT_OS_WINDOWS
+#   undef  IEMNATIVE_FRAME_ALIGN_SIZE
+#   define IEMNATIVE_FRAME_ALIGN_SIZE       16
+/** The offset to VBOXSTRICTRC on the stack. */
+#   define IEMNATIVE_FP_OFF_VBOXSTRICRC     (IEMNATIVE_FP_OFF_LAST_PUSH - IEMNATIVE_FRAME_ALIGN_SIZE)
+#  endif
+# endif
 /** No stack argument slots, got 8 registers for arguments will suffice. */
 # define IEMNATIVE_FRAME_STACK_ARG_COUNT    0
@@ -2791,5 +2804,5 @@
 /** Number of hidden arguments for CIMPL calls.
  * @note We're sufferning from the usual VBOXSTRICTRC fun on Windows. */
-#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)
+#if defined(VBOXSTRICTRC_STRICT_ENABLED) && defined(RT_OS_WINDOWS) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64))
 # define IEM_CIMPL_HIDDEN_ARGS 3
 #else
