Index: trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c	(revision 60295)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c	(revision 60296)
@@ -489,4 +489,5 @@
     BS3_DATA_NM(Bs3GdteTestPage00) = BS3_DATA_NM(Bs3Gdt)[uSysR0Cs >> X86_SEL_SHIFT];
     BS3_DATA_NM(Bs3GdteTestPage00).Gen.u1Present = 0;
+    BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type &= ~X86_SEL_TYPE_ACCESSED;
     paIdt[0x80 << cIdteShift].Gate.u16Sel = BS3_SEL_TEST_PAGE_00;
 
@@ -494,4 +495,6 @@
     Bs3TrapSetJmpAndRestore(&Ctx80, &TrapCtx);
     bs3CpuBasic2_CompareNpCtx(&TrapCtx, &Ctx80, BS3_SEL_TEST_PAGE_00);
+    if (BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type & X86_SEL_TYPE_ACCESSED)
+        bs3CpuBasic2_FailedF("selector was accessed");
     g_uLine++;
 
@@ -503,10 +506,15 @@
         Bs3TrapSetJmpAndRestore(&CtxTmp, &TrapCtx);
         bs3CpuBasic2_CompareGpCtx(&TrapCtx, &CtxTmp, (0x80 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT);
+        if (BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type & X86_SEL_TYPE_ACCESSED)
+            bs3CpuBasic2_FailedF("selector was accessed");
         g_uLine++;
     }
 
     /* CS.DPL mismatch takes precedence over CS.PRESENT = 0. */
+    BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type &= ~X86_SEL_TYPE_ACCESSED;
     Bs3TrapSetJmpAndRestore(&Ctx80, &TrapCtx);
     bs3CpuBasic2_CompareNpCtx(&TrapCtx, &Ctx80, BS3_SEL_TEST_PAGE_00);
+    if (BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type & X86_SEL_TYPE_ACCESSED)
+        bs3CpuBasic2_FailedF("CS selector was accessed");
     g_uLine++;
     for (iDpl = 1; iDpl < 4; iDpl++)
@@ -515,4 +523,6 @@
         Bs3TrapSetJmpAndRestore(&Ctx80, &TrapCtx);
         bs3CpuBasic2_CompareGpCtx(&TrapCtx, &Ctx80, BS3_SEL_TEST_PAGE_00);
+        if (BS3_DATA_NM(Bs3GdteTestPage00).Gen.u4Type & X86_SEL_TYPE_ACCESSED)
+            bs3CpuBasic2_FailedF("CS selector was accessed");
         g_uLine++;
     }
@@ -540,4 +550,7 @@
     }
 
+    /* Fix CS again. */
+    BS3_DATA_NM(Bs3GdteTestPage00) = BS3_DATA_NM(Bs3Gdt)[uSysR0Cs >> X86_SEL_SHIFT];
+
     /* Test SS. */
     if (!BS3_MODE_IS_64BIT_SYS(g_bTestMode))
@@ -547,9 +560,7 @@
         X86DESC const     SavedGate83 = paIdt[0x83 << cIdteShift];
 
-        /* Fix CS again. */
-        BS3_DATA_NM(Bs3GdteTestPage00) = BS3_DATA_NM(Bs3Gdt)[uSysR0Cs >> X86_SEL_SHIFT];
-
         /* Make the handler execute in ring-2. */
         BS3_DATA_NM(Bs3GdteTestPage02) = BS3_DATA_NM(Bs3Gdt)[(uSysR0Cs + (2 << BS3_SEL_RING_SHIFT)) >> X86_SEL_SHIFT];
+        BS3_DATA_NM(Bs3GdteTestPage02).Gen.u4Type &= ~X86_SEL_TYPE_ACCESSED;
         paIdt[0x83 << cIdteShift].Gate.u16Sel = BS3_SEL_TEST_PAGE_02 | 2;
 
@@ -558,4 +569,6 @@
         Bs3TrapSetJmpAndRestore(&CtxTmp, &TrapCtx);
         bs3CpuBasic2_CompareIntCtx1(&TrapCtx, &CtxTmp, 0x83);
+        if (!(BS3_DATA_NM(Bs3GdteTestPage02).Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+            bs3CpuBasic2_FailedF("CS selector was not access");
         g_uLine++;
 
@@ -601,4 +614,6 @@
                 {
                     *puTssSs2 = BS3_SEL_TEST_PAGE_03 | iRpl;
+                    BS3_DATA_NM(Bs3GdteTestPage02).Gen.u4Type &= ~X86_SEL_TYPE_ACCESSED;
+                    BS3_DATA_NM(Bs3GdteTestPage03).Gen.u4Type &= ~X86_SEL_TYPE_ACCESSED;
                     Bs3TrapSetJmpAndRestore(&CtxTmp, &TrapCtx);
                     if (iRpl != 2 || iRpl != iDpl || k >= 4)
@@ -612,4 +627,14 @@
                             bs3CpuBasic2_FailedF("uHandlerSs=%#x expected %#x\n", TrapCtx.uHandlerSs, BS3_SEL_TEST_PAGE_03 | 2);
                     }
+                    if (!(BS3_DATA_NM(Bs3GdteTestPage02).Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+                        bs3CpuBasic2_FailedF("CS selector was not access");
+                    if (   TrapCtx.bXcpt == 0x83
+                        || (TrapCtx.bXcpt == X86_XCPT_SS && k == 2) )
+                    {
+                        if (!(BS3_DATA_NM(Bs3GdteTestPage03).Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+                            bs3CpuBasic2_FailedF("SS selector was not accessed");
+                    }
+                    else if (BS3_DATA_NM(Bs3GdteTestPage03).Gen.u4Type & X86_SEL_TYPE_ACCESSED)
+                        bs3CpuBasic2_FailedF("SS selector was accessed");
                     g_uLine++;
 
