Index: trunk/include/VBox/err.h
===================================================================
--- trunk/include/VBox/err.h	(revision 104511)
+++ trunk/include/VBox/err.h	(revision 104516)
@@ -3272,4 +3272,15 @@
 /** @} */
 
+/** @name Guest Compatibility Manage Status Codes.
+ * @{
+ */
+/** The intercepted situation was completely handled, continue execution. */
+#define VINF_GCM_HANDLED                            (7600)
+/** The intercepted instruction handled, advance RIP and continue execution. */
+#define VINF_GCM_HANDLED_ADVANCE_RIP                (7601)
+/** The intercepted operation was not handled, take default action. */
+#define VERR_GCM_NOT_HANDLED                        (-7602)
+/** @} */
+
 /* SED-END */
 
Index: trunk/include/VBox/vmm/cpum-common.h
===================================================================
--- trunk/include/VBox/vmm/cpum-common.h	(revision 104511)
+++ trunk/include/VBox/vmm/cpum-common.h	(revision 104516)
@@ -124,4 +124,26 @@
     } while (0)
 
+/** @def CPUM_IMPORT_EXTRN_WITH_CTX_RET
+ * Macro for making sure the state specified by @a fExtrnImport is present,
+ * calling CPUMImportGuestStateOnDemand() to get it if necessary.
+ *
+ * Will return if CPUMImportGuestStateOnDemand() fails.
+ *
+ * @param   a_pVCpu         The cross context virtual CPU structure of the calling EMT.
+ * @param   a_pCtx          Pointer to the CPU context (CPUMCTX).
+ * @param   a_fExtrnImport  Mask of CPUMCTX_EXTRN_XXX bits to get.
+ * @thread  EMT(a_pVCpu)
+ */
+#define CPUM_IMPORT_EXTRN_WITH_CTX_RET(a_pVCpu, a_pCtx, a_fExtrnImport) \
+    do { \
+        if (!((a_pCtx)->fExtrn & (a_fExtrnImport))) \
+        { /* already present, consider this likely */ } \
+        else \
+        { \
+            int rcCpumImport = CPUMImportGuestStateOnDemand(a_pVCpu, a_fExtrnImport); \
+            AssertRCReturn(rcCpumImport, rcCpumImport); \
+        } \
+    } while (0)
+
 VMM_INT_DECL(int) CPUMImportGuestStateOnDemand(PVMCPUCC pVCpu, uint64_t fExtrnImport);
 /** @} */
Index: trunk/include/VBox/vmm/gcm.h
===================================================================
--- trunk/include/VBox/vmm/gcm.h	(revision 104511)
+++ trunk/include/VBox/vmm/gcm.h	(revision 104516)
@@ -61,4 +61,46 @@
 VMM_INT_DECL(bool)          GCMIsInterceptingXcptDE(PVMCPUCC pVCpu);
 VMM_INT_DECL(int)           GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx);
+
+VMM_INT_DECL(bool)          GCMIsInterceptingXcptGP(PVMCPUCC pVCpu);
+VMM_INT_DECL(int)           GCMXcptGP(PVMCPUCC pVCpu, PCPUMCTX pCtx);
+
+VMM_INT_DECL(VBOXSTRICTRC)  GCMInterceptedIOPortRead(PVMCPUCC pVCpu, PCPUMCTX pCtx, uint16_t u16Port, uint8_t cbReg);
+VMM_INT_DECL(bool)          GCMIsInterceptingIOPortReadSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
+
+/**
+ * Checks if the given IN instruction is intercepted.
+ */
+DECLINLINE(bool) GCMIsInterceptingIOPortRead(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
+{
+    return u16Port == 0x5658 /* vmware hypervisor port */
+        && cbReg == 4
+        && GCMIsInterceptingIOPortReadSlow(pVCpu, u16Port, cbReg);
+}
+
+#if 0 /* If we need to deal with high speed vmware hypervisor calls */
+VMM_INT_DECL(bool)          GCMIsInterceptingIOPortReadStringSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
+VMM_INT_DECL(bool)          GCMIsInterceptingIOPortWriteStringSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
+
+/**
+ * Checks if the given INS instruction is intercepted.
+ */
+DECLINLINE(bool) GCMIsInterceptingIOPortReadString(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
+{
+    return u16Port == 0x5659 /* new vmware hypervisor port */
+        && cbReg == 1
+        && GCMIsInterceptingIOPortReadStringSlow(pVCpu, u16Port, cbReg);
+}
+
+/**
+ * Checks if the given OUTS instruction is intercepted.
+ */
+DECLINLINE(bool) GCMIsInterceptingIOPortWriteString(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
+{
+    return u16Port == 0x5659 /* new vmware hypervisor port */
+        && cbReg == 1
+        && GCMIsInterceptingIOPortWriteStringSlow(pVCpu, u16Port, cbReg);
+}
+#endif
+
 /** @} */
 
