Index: trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2.asm	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2.asm	(revision 59789)
@@ -44,8 +44,8 @@
 %include "bs3kit-template-header.mac"
 
+BS3_EXTERN_DATA16 g_uBs3CpuDetected
 BS3_BEGIN_TEXT16
-BS3_EXTERN_TMPL Bs3InitMemory
-BS3_EXTERN_CMN  Bs3Trap32Init
 BS3_EXTERN_CMN  Bs3Shutdown
+extern          _Bs3InitAll_rm
 
 
@@ -57,9 +57,5 @@
         sub     sp, 20h                 ; reserve 20h for 64-bit calls (we're doing them MSC style, remember).
 
-        ;
-        ; Do bs3kit init.
-        ;
-        call    Bs3InitMemory           ; Initialize the memory (must be done from real mode).
-        call    Bs3Trap32Init
+        call    _Bs3InitAll_rm
 
         ;
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 59789)
@@ -132,4 +132,5 @@
 bs3kit-common-16_SOURCES  = $(VBOX_BS3KIT_COMMON_SOURCES) \
 	bs3-system-data.asm \
+	bs3-rm-InitAll.c \
 	bs3-rm-InitMemory.c \
 	bs3-cmn-hexdigits.c \
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-CpuDetectData.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-CpuDetectData.c	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-CpuDetectData.c	(revision 59789)
@@ -38,5 +38,5 @@
 #if ARCH_BITS == 16
 
-extern uint16_t BS3_DATA_NM(g_uBs3CpuDetected) = BS3CPU_TYPE_MASK | BS3CPU_F_CPUID;
+uint16_t BS3_DATA_NM(g_uBs3CpuDetected) = BS3CPU_TYPE_MASK | BS3CPU_F_CPUID | BS3CPU_F_CPUID_EXT_LEAVES | BS3CPU_F_LONG_MODE;
 
 #endif /* ARCH_BITS == 16 */
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm	(revision 59789)
@@ -203,4 +203,21 @@
         je      .return
 .NewerThanPPro:
+        ; Check for extended leaves and long mode.
+        mov     eax, 0x80000000
+        cpuid
+        sub     eax, 0x80000001         ; Minimum leaf 0x80000001
+        cmp     eax, 0x00010000         ; At most 0x10000 leaves.
+        ja      .no_ext_leaves
+
+        mov     eax, 0x80000001
+        cpuid
+        test    edx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE
+        jz      .no_long_mode
+        mov     xAX, BS3CPU_PProOrNewer | BS3CPU_F_CPUID | BS3CPU_F_CPUID_EXT_LEAVES | BS3CPU_F_LONG_MODE
+        jmp     .return
+.no_long_mode:
+        mov     xAX, BS3CPU_PProOrNewer | BS3CPU_F_CPUID | BS3CPU_F_CPUID_EXT_LEAVES
+        jmp     .return
+.no_ext_leaves:
         mov     xAX, BS3CPU_PProOrNewer | BS3CPU_F_CPUID
 
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c	(revision 59789)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c	(revision 59789)
@@ -0,0 +1,46 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Initialize all components, real mode.
+ */
+
+/*
+ * Copyright (C) 2007-2016 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
+#include "bs3kit-template-header.h"
+#include "bs3-cmn-test.h"
+
+
+BS3_DECL(void) Bs3InitAll_rm(void)
+{
+    Bs3CpuDetect_rm();
+    Bs3InitMemory_rm();
+//    if (BS3_DATA_NM(g_uBs3CpuDetected) & BS3CPU_F_LONG_MODE)
+//        Bs3Trap64Init();
+    if ((BS3_DATA_NM(g_uBs3CpuDetected) & BS3CPU_TYPE_MASK) >= BS3CPU_80386)
+        Bs3Trap32Init();
+//    if ((BS3_DATA_NM(g_uBs3CpuDetected) & BS3CPU_TYPE_MASK) >= BS3CPU_80286)
+//        Bs3Trap16Init();
+}
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 59789)
@@ -1858,4 +1858,9 @@
 
 /**
+ * Initializes all of boot sector kit \#3.
+ */
+BS3_DECL(void) Bs3InitAll_rm(void);
+
+/**
  * Initializes the REAL and TILED memory pools.
  *
@@ -1863,4 +1868,5 @@
  */
 BS3_DECL(void) Bs3InitMemory_rm(void);
+
 
 
@@ -1907,18 +1913,22 @@
 /** @name BS3CPU_XXX - CPU detected by BS3CpuDetect_c16() and friends.
  * @{ */
-#define BS3CPU_8086             UINT16_C(0x0001)    /**< Both 8086 and 8088. */
-#define BS3CPU_V20              UINT16_C(0x0002)    /**< Both NEC V20, V30 and relatives. */
-#define BS3CPU_80186            UINT16_C(0x0003)    /**< Both 80186 and 80188. */
-#define BS3CPU_80286            UINT16_C(0x0004)
-#define BS3CPU_80386            UINT16_C(0x0005)
-#define BS3CPU_80486            UINT16_C(0x0006)
-#define BS3CPU_Pentium          UINT16_C(0x0007)
-#define BS3CPU_PPro             UINT16_C(0x0008)
-#define BS3CPU_PProOrNewer      UINT16_C(0x0009)
+#define BS3CPU_8086                 UINT16_C(0x0001)    /**< Both 8086 and 8088. */
+#define BS3CPU_V20                  UINT16_C(0x0002)    /**< Both NEC V20, V30 and relatives. */
+#define BS3CPU_80186                UINT16_C(0x0003)    /**< Both 80186 and 80188. */
+#define BS3CPU_80286                UINT16_C(0x0004)
+#define BS3CPU_80386                UINT16_C(0x0005)
+#define BS3CPU_80486                UINT16_C(0x0006)
+#define BS3CPU_Pentium              UINT16_C(0x0007)
+#define BS3CPU_PPro                 UINT16_C(0x0008)
+#define BS3CPU_PProOrNewer          UINT16_C(0x0009)
 /** CPU type mask.  This is a full byte so it's possible to use byte access
  * without and AND'ing to get the type value. */
-#define BS3CPU_TYPE_MASK        UINT16_C(0x00ff)
+#define BS3CPU_TYPE_MASK            UINT16_C(0x00ff)
 /** Flag indicating that the CPUID instruction is supported by the CPU. */
-#define BS3CPU_F_CPUID          UINT16_C(0x0100)
+#define BS3CPU_F_CPUID              UINT16_C(0x0100)
+/** Flag indicating that extend CPUID leaves are available (at least two).   */
+#define BS3CPU_F_CPUID_EXT_LEAVES   UINT16_C(0x0200)
+/** Flag indicating that the CPU supports long mode. */
+#define BS3CPU_F_LONG_MODE          UINT16_C(0x0400)
 /** @} */
 
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac	(revision 59788)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac	(revision 59789)
@@ -944,15 +944,17 @@
 ;; @name BS3CPU_XXX - Bs3CpuDetect_mmm return value and g_bBs3CpuDetected.
 ;; @{
-%define BS3CPU_8086             0x0001
-%define BS3CPU_V20              0x0002
-%define BS3CPU_80186            0x0003
-%define BS3CPU_80286            0x0004
-%define BS3CPU_80386            0x0005
-%define BS3CPU_80486            0x0006
-%define BS3CPU_Pentium          0x0007
-%define BS3CPU_PPro             0x0008
-%define BS3CPU_PProOrNewer      0x0009
-%define BS3CPU_TYPE_MASK        0x00ff
-%define BS3CPU_F_CPUID          0x0100
+%define BS3CPU_8086                 0x0001
+%define BS3CPU_V20                  0x0002
+%define BS3CPU_80186                0x0003
+%define BS3CPU_80286                0x0004
+%define BS3CPU_80386                0x0005
+%define BS3CPU_80486                0x0006
+%define BS3CPU_Pentium              0x0007
+%define BS3CPU_PPro                 0x0008
+%define BS3CPU_PProOrNewer          0x0009
+%define BS3CPU_TYPE_MASK            0x00ff
+%define BS3CPU_F_CPUID              0x0100
+%define BS3CPU_F_CPUID_EXT_LEAVES   0x0200
+%define BS3CPU_F_LONG_MODE          0x0400
 ;; @}
 
