Index: /trunk/include/VBox/vmm/vm.h
===================================================================
--- /trunk/include/VBox/vmm/vm.h	(revision 60541)
+++ /trunk/include/VBox/vmm/vm.h	(revision 60542)
@@ -237,5 +237,5 @@
         struct APICCPU      s;
 # endif
-        uint8_t             padding[512];      /* multiple of 64 */
+        uint8_t             padding[640];      /* multiple of 64 */
     } apic;
 #endif
@@ -243,5 +243,5 @@
     /** Align the following members on page boundary. */
 #ifdef VBOX_WITH_NEW_APIC
-    uint8_t                 abAlignment2[2880];
+    uint8_t                 abAlignment2[2752];
 #else
     uint8_t                 abAlignment2[3392];
Index: /trunk/src/VBox/VMM/VMMAll/APICAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 60541)
+++ /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 60542)
@@ -92,5 +92,5 @@
 
 /**
- * Checks if a vector is set in an APIC Pending Interrupt Bitmap (PIB).
+ * Checks if a vector is set in an APIC Pending-Interrupt Bitmap (PIB).
  *
  * @returns true if the specified vector is set, false otherwise.
@@ -128,5 +128,5 @@
 
 /**
- * Sets the vector in an APIC Pending Interrupt Bitmap (PIB).
+ * Sets the vector in an APIC Pending-Interrupt Bitmap (PIB).
  *
  * @param   pvPib           Opaque pointer to the PIB.
@@ -140,5 +140,5 @@
 
 /**
- * Clears the vector in an APIC Pending Interrupt Bitmap (PIB).
+ * Clears the vector in an APIC Pending-Interrupt Bitmap (PIB).
  *
  * @param   pvPib           Opaque pointer to the PIB.
@@ -2155,13 +2155,13 @@
     AssertReturn(u8Pin <= 1, VERR_INVALID_PARAMETER);
     AssertReturn(u8Level <= 1, VERR_INVALID_PARAMETER);
-
     LogFlow(("APIC%u: APICLocalInterrupt\n", pVCpu->idCpu));
 
-    PCXAPICPAGE  pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
-    VBOXSTRICTRC rcStrict   = VINF_SUCCESS;
+    VBOXSTRICTRC rcStrict = VINF_SUCCESS;
 
     /* If the APIC is enabled, the interrupt is subject to LVT programming. */
     if (apicIsEnabled(pVCpu))
     {
+        PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
+
         /* Pick the LVT entry corresponding to the interrupt pin. */
         static const uint16_t s_au16LvtOffsets[] =
Index: /trunk/src/VBox/VMM/VMMR3/APIC.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/APIC.cpp	(revision 60541)
+++ /trunk/src/VBox/VMM/VMMR3/APIC.cpp	(revision 60542)
@@ -207,5 +207,5 @@
     memset((void *)&pX2ApicPage->self_ipi, 0, sizeof(pX2ApicPage->self_ipi));
 
-    /* Clear the posted interrupt bitmaps. */
+    /* Clear the pending-interrupt bitmaps. */
     PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
     memset((void *)&pApicCpu->ApicPibLevel, 0, sizeof(APICPIB));
@@ -251,15 +251,17 @@
     LogFlow(("APIC%u: APICR3Reset\n", pVCpu->idCpu));
 
-#ifdef RT_STRICT
+#ifdef VBOX_STRICT
     /* Verify that the initial APIC ID reported via CPUID matches our VMCPU ID assumption. */
-    CPUMCPUIDLEAF CpuLeaf;
-    int rc = CPUMR3CpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), &CpuLeaf, 1, 0);
-    AssertRC(rc);
-    Assert(((CpuLeaf.uEbx >> 24) & 0xff) == pVCpu->idCpu);
+    uint32_t uEax, uEbx, uEcx, uEdx;
+    uEax = uEbx = uEcx = uEdx = UINT32_MAX;
+    CPUMGetGuestCpuId(pVCpu, 1, 0, &uEax, &uEbx, &uEcx, &uEdx);
+    Assert(((uEbx >> 24) & 0xff) == pVCpu->idCpu);
 #endif
 
+    /*
+     * The state following a power-up or reset is a superset of the INIT state.
+     * See Intel spec. 10.4.7.3 "Local APIC State After an INIT Reset ('Wait-for-SIPI' State)"
+     */
     apicR3InitIpi(pVCpu);
-
-    PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
 
     /*
@@ -268,4 +270,5 @@
      * The version determines the number of LVT entries and size of the APIC ID (8 bits for P4).
      */
+    PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
 #if XAPIC_HARDWARE_VERSION == XAPIC_HARDWARE_VERSION_P4
     pXApicPage->version.u.u8MaxLvtEntry = XAPIC_MAX_LVT_ENTRIES_P4 - 1;
@@ -276,6 +279,6 @@
 #endif
 
-    /** @todo It isn't very clear where the default base address is (re)initialized,
-     *        atm we do it here in Reset. */
+    /** @todo It isn't clear in the spec. where exactly the default base address
+     *        is (re)initialized, atm we do it here in Reset. */
     apicR3ResetBaseMsr(pVCpu);
 
@@ -985,4 +988,5 @@
             SupApicPage.Phys = NIL_RTHCPHYS;
 
+            Assert(pVCpu->idCpu == idCpu);
             Assert(pApicCpu->pvApicPageR3 == NIL_RTR0PTR);
             Assert(pApicCpu->pvApicPageR0 == NIL_RTR0PTR);
@@ -1154,6 +1158,5 @@
     pApic->pApicDevRC   = PDMINS_2_DATA_RCPTR(pDevIns);
 
-    rc = apicR3InitState(pVM);
-    AssertRCReturn(rc, rc);
+    apicR3InitState(pVM);
 
     /*
Index: /trunk/src/VBox/VMM/include/APICInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/APICInternal.h	(revision 60541)
+++ /trunk/src/VBox/VMM/include/APICInternal.h	(revision 60542)
@@ -441,5 +441,5 @@
     /** @} */
 
-    /** @name The APIC pending interrupt bitmap (PIB).
+    /** @name The APIC pending-interrupt bitmap (PIB).
      * @{ */
     /** The host-context physical address of the PIB. */
@@ -519,5 +519,5 @@
     /** @} */
 
-    /** @name The pending interrupt bitmaps (PIB).
+    /** @name The pending-interrupt bitmaps (PIB).
      * @{ */
     /** The host-context physical address of the page. */
Index: /trunk/src/VBox/VMM/testcase/Makefile.kmk
===================================================================
--- /trunk/src/VBox/VMM/testcase/Makefile.kmk	(revision 60541)
+++ /trunk/src/VBox/VMM/testcase/Makefile.kmk	(revision 60542)
@@ -152,4 +152,7 @@
   tstVMStructRC_DEFS    += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
  endif
+ ifdef VBOX_WITH_NEW_APIC
+  tstVMStructRC_DEFS    += VBOX_WITH_NEW_APIC
+ endif
  tstVMStructRC_SOURCES   = tstVMStructRC.cpp
  tstVMStructRC_INCS      = \
@@ -177,4 +180,7 @@
  tstVMStructSize_DEFS  += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
 endif
+ifdef VBOX_WITH_NEW_APIC
+ tstVMStructSize_DEFS  += VBOX_WITH_NEW_APIC
+endif
 
 tstAsmStructs_TEMPLATE  = VBOXR3AUTOTST
@@ -188,4 +194,7 @@
 ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
  tstAsmStructs_DEFS    += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
+endif
+ifdef VBOX_WITH_NEW_APIC
+ tstAsmStructs_DEFS    += VBOX_WITH_NEW_APIC
 endif
 tstAsmStructs_INCS      = \
@@ -203,4 +212,7 @@
  ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
   tstAsmStructsRC_DEFS  += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
+ endif
+ ifdef VBOX_WITH_NEW_APIC
+  tstAsmStructsRC_DEFS  += VBOX_WITH_NEW_APIC
  endif
  tstAsmStructsRC_INCS    = \
@@ -482,4 +494,7 @@
   tstVMStructDTrace_DEFS  += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
  endif
+ ifdef VBOX_WITH_NEW_APIC
+  tstVMStructDTrace_DEFS  += VBOX_WITH_NEW_APIC
+ endif
 
 
@@ -523,4 +538,5 @@
 			$(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
 			$(if $(VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI),VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI,) \
+			$(if $(VBOX_WITH_NEW_APIC),VBOX_WITH_NEW_APIC,) \
 		) \
 		-f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
Index: /trunk/src/VBox/VMM/testcase/tstVMStruct.h
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStruct.h	(revision 60541)
+++ /trunk/src/VBox/VMM/testcase/tstVMStruct.h	(revision 60542)
@@ -8,5 +8,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -1364,4 +1364,28 @@
 #endif
 
+#ifdef VBOX_WITH_NEW_APIC
+    GEN_CHECK_SIZE(APIC);
+    GEN_CHECK_OFF(APIC, pApicDevR0);
+    GEN_CHECK_OFF(APIC, pApicDevR3);
+    GEN_CHECK_OFF(APIC, pApicDevRC);
+    GEN_CHECK_OFF(APIC, pvApicPibR0);
+    GEN_CHECK_OFF(APIC, pvApicPibR3);
+    GEN_CHECK_OFF(APIC, pvApicPibRC);
+    GEN_CHECK_OFF(APIC, cbApicPib);
+    GEN_CHECK_OFF(APIC, enmOriginalMode);
+    GEN_CHECK_OFF(APICCPU, pvApicPageR0);
+    GEN_CHECK_OFF(APICCPU, pvApicPageR3);
+    GEN_CHECK_OFF(APICCPU, pvApicPageRC);
+    GEN_CHECK_OFF(APICCPU, pvApicPageRC);
+    GEN_CHECK_OFF(APICCPU, cbApicPage);
+    GEN_CHECK_OFF(APICCPU, pvApicPibR0);
+    GEN_CHECK_OFF(APICCPU, pvApicPibR3);
+    GEN_CHECK_OFF(APICCPU, pvApicPibRC);
+    GEN_CHECK_OFF(APICCPU, ApicPibLevel);
+    GEN_CHECK_OFF(APICCPU, pTimerR0);
+    GEN_CHECK_OFF(APICCPU, pTimerR3);
+    GEN_CHECK_OFF(APICCPU, pTimerRC);
+    GEN_CHECK_OFF(APICCPU, TimerCritSect);
+#endif
 
     GEN_CHECK_SIZE(VM);
@@ -1425,6 +1449,10 @@
     GEN_CHECK_OFF(VM, ftm);
     GEN_CHECK_OFF(VM, rem);
+    GEN_CHECK_OFF(VM, gim);
     GEN_CHECK_OFF(VM, vm);
     GEN_CHECK_OFF(VM, cfgm);
+#ifdef VBOX_WITH_NEW_APIC
+    GEN_CHECK_OFF(VM, apic);
+#endif
     GEN_CHECK_OFF(VM, aCpus);
 
@@ -1444,5 +1472,4 @@
     GEN_CHECK_OFF(VMCPU, uAdHoc);
     GEN_CHECK_OFF(VMCPU, aStatAdHoc);
-    GEN_CHECK_OFF(VMCPU, cpum);
     GEN_CHECK_OFF(VMCPU, hm);
     GEN_CHECK_OFF(VMCPU, em);
@@ -1454,5 +1481,10 @@
     GEN_CHECK_OFF(VMCPU, iom);
     GEN_CHECK_OFF(VMCPU, dbgf);
+    GEN_CHECK_OFF(VMCPU, gim);
+#ifdef VBOX_WITH_NEW_APIC
+    GEN_CHECK_OFF(VMCPU, apic);
+#endif
     GEN_CHECK_OFF(VMCPU, pgm);
+    GEN_CHECK_OFF(VMCPU, cpum);
 
 #ifndef VBOX_FOR_DTRACE_LIB
Index: /trunk/src/VBox/VMM/testcase/tstVMStructDTrace.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStructDTrace.cpp	(revision 60541)
+++ /trunk/src/VBox/VMM/testcase/tstVMStructDTrace.cpp	(revision 60542)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -43,4 +43,7 @@
 #include "REMInternal.h"
 #include "HMInternal.h"
+#ifdef VBOX_WITH_NEW_APIC
+# include "APICInternal.h"
+#endif
 #include "VMMInternal.h"
 #include "DBGFInternal.h"
Index: /trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp	(revision 60541)
+++ /trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp	(revision 60542)
@@ -9,5 +9,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -71,4 +71,7 @@
 #include "REMInternal.h"
 #include "HMInternal.h"
+#ifdef VBOX_WITH_NEW_APIC
+# include "APICInternal.h"
+#endif
 #include "PATMInternal.h"
 #include "VMMInternal.h"
Index: /trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp	(revision 60541)
+++ /trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp	(revision 60542)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -46,5 +46,7 @@
 #include "DBGFInternal.h"
 #include "GIMInternal.h"
-#include "APICInternal.h"
+#ifdef VBOX_WITH_NEW_APIC
+# include "APICInternal.h"
+#endif
 #include "STAMInternal.h"
 #include "VMInternal.h"
