Index: /trunk/include/VBox/settings.h
===================================================================
--- /trunk/include/VBox/settings.h	(revision 60409)
+++ /trunk/include/VBox/settings.h	(revision 60410)
@@ -940,4 +940,5 @@
     uint32_t            ulCpuExecutionCap;      // requires settings version 1.11 (VirtualBox 3.3)
     uint32_t            uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
+    com::Utf8Str        strCpuProfile;          // requires settings version 1.16 (VirtualBox 5.1)
 
     CpuIdLeafsList      llCpuIdLeafs;
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 60409)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 60410)
@@ -36,4 +36,5 @@
 
 #include <VBox/log.h>
+#include <VBox/version.h>
 #include <iprt/stream.h>
 #include <iprt/time.h>
@@ -445,4 +446,20 @@
     } while (0)
 
+    /** @def SHOW_STRING_PROP_MAJ
+     * For not breaking the output in a dot release we don't show default values. */
+#define SHOW_STRING_PROP_MAJ(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szUnless, a_uMajorVer) \
+    do \
+    { \
+        Bstr bstr; \
+        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
+        if ((a_uMajorVer) <= VBOX_VERSION_MAJOR || !bstr.equals(a_szUnless)) \
+        { \
+            if (details == VMINFO_MACHINEREADABLE)\
+                outputMachineReadableString(a_szMachine, &bstr); \
+            else \
+                RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
+        } \
+    } while (0)
+
 #define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     do \
@@ -564,4 +581,5 @@
     SHOW_ULONG_PROP(       machine, CPUExecutionCap,            "cpuexecutioncap",      "CPU exec cap",     "%%");
     SHOW_BOOLEAN_PROP(     machine, HPETEnabled,                "hpet",                 "HPET");
+    SHOW_STRING_PROP_MAJ(  machine, CPUProfile,                 "cpu-profile",          "CPUProfile",       "host", 6);
 
     ChipsetType_T chipsetType;
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 60409)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 60410)
@@ -72,4 +72,5 @@
     MODIFYVM_CPUS,
     MODIFYVM_CPUHOTPLUG,
+    MODIFYVM_CPU_PROFILE,
     MODIFYVM_PLUGCPU,
     MODIFYVM_UNPLUGCPU,
@@ -217,4 +218,7 @@
 static const RTGETOPTDEF g_aModifyVMOptions[] =
 {
+/** @todo Convert to dash separated names like --triple-fault-reset! Please
+ *        do that for all new options as we don't need more character soups
+ *        around VirtualBox - typedefs more than covers that demand! */
     { "--name",                     MODIFYVM_NAME,                      RTGETOPT_REQ_STRING },
     { "--groups",                   MODIFYVM_GROUPS,                    RTGETOPT_REQ_STRING },
@@ -244,4 +248,5 @@
     { "--cpus",                     MODIFYVM_CPUS,                      RTGETOPT_REQ_UINT32 },
     { "--cpuhotplug",               MODIFYVM_CPUHOTPLUG,                RTGETOPT_REQ_BOOL_ONOFF },
+    { "--cpu-profile",              MODIFYVM_CPU_PROFILE,               RTGETOPT_REQ_STRING },
     { "--plugcpu",                  MODIFYVM_PLUGCPU,                   RTGETOPT_REQ_UINT32 },
     { "--unplugcpu",                MODIFYVM_UNPLUGCPU,                 RTGETOPT_REQ_UINT32 },
@@ -774,4 +779,10 @@
             }
 
+            case MODIFYVM_CPU_PROFILE:
+            {
+                CHECK_ERROR(sessionMachine, COMSETTER(CPUProfile)(Bstr(ValueUnion.psz).raw()));
+                break;
+            }
+
             case MODIFYVM_PLUGCPU:
             {
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 60409)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 60410)
@@ -4323,10 +4323,15 @@
   <interface
     name="IMachine" extends="$unknown"
-    uuid="e1aa7812-ec46-4612-d9d5-0a3d4703b3ab"
+    uuid="95565a66-622a-4ad0-4eed-9bb83c91c5be"
     wsmap="managed"
     wrap-hint-server-addinterfaces="IInternalMachineControl"
     wrap-hint-server="manualaddinterfaces"
-    reservedMethods="8" reservedAttributes="12"
-    >
+    reservedMethods="8" reservedAttributes="10"
+    >
+    <!-- Note! This interface is not compatible between 5.0 and 5.1 as it had too many
+               methods/attributes for midl and the reservedAttributes had to be
+               decreased.  Max methods+attributes is 256, so in 6.0 this interface must
+               be refactored a little!  In the mean time, take from reservedMethods and
+               reservedAttributes and update the UUID like always. -->
     <desc>
       The IMachine interface represents a virtual machine, or guest, created
@@ -5170,4 +5175,14 @@
       <desc>
         Debug parameters for the paravirtualized guest interface provider.
+      </desc>
+    </attribute>
+
+    <attribute name="CPUProfile" type="wstring">
+      <desc>
+        Experimental feature to select the guest CPU profile.  The default
+        is "host", which indicates the host CPU.  All other names are subject
+        to change.
+
+        The profiles are found in src/VBox/VMM/VMMR3/cpus/.
       </desc>
     </attribute>
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 60409)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 60410)
@@ -290,4 +290,5 @@
         ULONG               mCpuExecutionCap;
         uint32_t            mCpuIdPortabilityLevel;
+        Utf8Str             mCpuProfile;
         BOOL                mAccelerate3DEnabled;
         BOOL                mHPETEnabled;
@@ -875,4 +876,6 @@
     HRESULT getCPUIDPortabilityLevel(ULONG *aCPUIDPortabilityLevel);
     HRESULT setCPUIDPortabilityLevel(ULONG aCPUIDPortabilityLevel);
+    HRESULT getCPUProfile(com::Utf8Str &aCPUProfile);
+    HRESULT setCPUProfile(const com::Utf8Str &aCPUProfile);
     HRESULT getMemorySize(ULONG *aMemorySize);
     HRESULT setMemorySize(ULONG aMemorySize);
Index: /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 60409)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 60410)
@@ -876,4 +876,15 @@
 
         /*
+         * EM values (before CPUM as it may need to set IemExecutesAll).
+         */
+        PCFGMNODE pEM;
+        InsertConfigNode(pRoot, "EM", &pEM);
+
+        /* Triple fault behavior. */
+        BOOL fTripleFaultReset = false;
+        hrc = pMachine->GetCPUProperty(CPUPropertyType_TripleFaultReset, &fTripleFaultReset); H();
+        InsertConfigInteger(pEM, "TripleFaultReset", fTripleFaultReset);
+
+        /*
          * CPUM values.
          */
@@ -957,5 +968,5 @@
         /* CPU Portability level, */
         ULONG uCpuIdPortabilityLevel = 0;
-        hrc = pMachine->COMGETTER(CPUIDPortabilityLevel)(&uCpuIdPortabilityLevel);            H();
+        hrc = pMachine->COMGETTER(CPUIDPortabilityLevel)(&uCpuIdPortabilityLevel);          H();
         InsertConfigInteger(pCPUM, "PortableCpuIdLevel", uCpuIdPortabilityLevel);
 
@@ -964,4 +975,22 @@
         hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE);                   H();
         InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
+
+        /* CPUM profile name. */
+        hrc = pMachine->COMGETTER(CPUProfile)(bstr.asOutParam());                           H();
+        InsertConfigString(pRoot, "GuestCPUName", bstr);
+
+        /*
+         * Temporary(?) hack to make sure we emulate the ancient 16-bit CPUs
+         * correctly.   There are way to many #UDs we'll miss using VT-x,
+         * raw-mode or qemu for the 186 and 286, while we'll get undefined opcodes
+         * dead wrong on 8086 (see http://www.os2museum.com/wp/undocumented-8086-opcodes/).
+         */
+        if (   bstr.equals("80286")
+            || bstr.equals("80186")
+            || bstr.equals("V30")
+            || bstr.equals("V20")
+            || bstr.equals("8086")
+            || bstr.equals("8088") )
+            InsertConfigInteger(pEM, "IemExecutesAll", true);
 
         /*
@@ -1033,13 +1062,4 @@
         }
         InsertConfigInteger(pRoot, "HMEnabled", fHMEnabled);
-
-        /* /EM/xzy */
-        PCFGMNODE pEM;
-        InsertConfigNode(pRoot, "EM", &pEM);
-
-        /* Triple fault behavior. */
-        BOOL fTripleFaultReset = false;
-        hrc = pMachine->GetCPUProperty(CPUPropertyType_TripleFaultReset, &fTripleFaultReset); H();
-        InsertConfigInteger(pEM, "TripleFaultReset", fTripleFaultReset);
 
         /* /HM/xzy */
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 60409)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 60410)
@@ -197,4 +197,5 @@
     mCpuExecutionCap = 100; /* Maximum CPU execution cap by default. */
     mCpuIdPortabilityLevel = 0;
+    mCpuProfile = "host";
 
     /* default boot order: floppy - DVD - HDD */
@@ -1633,4 +1634,28 @@
 }
 
+HRESULT Machine::getCPUProfile(com::Utf8Str &aCPUProfile)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    aCPUProfile = mHWData->mCpuProfile;
+    return S_OK;
+}
+
+HRESULT Machine::setCPUProfile(const com::Utf8Str &aCPUProfile)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableStateDep);
+    if (SUCCEEDED(hrc))
+    {
+        i_setModified(IsModified_MachineData);
+        mHWData.backup();
+        /* Empty equals 'host'. */
+        if (aCPUProfile.isNotEmpty())
+            mHWData->mCpuProfile = aCPUProfile;
+        else
+            mHWData->mCpuProfile = "host";
+    }
+    return hrc;
+}
+
 HRESULT Machine::getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled)
 {
@@ -8847,4 +8872,5 @@
         mHWData->mCpuExecutionCap             = data.ulCpuExecutionCap;
         mHWData->mCpuIdPortabilityLevel       = data.uCpuIdPortabilityLevel;
+        mHWData->mCpuProfile                  = data.strCpuProfile;
 
         // cpu
@@ -10182,4 +10208,5 @@
         data.ulCpuExecutionCap      = mHWData->mCpuExecutionCap;
         data.uCpuIdPortabilityLevel = mHWData->mCpuIdPortabilityLevel;
+        data.strCpuProfile          = mHWData->mCpuProfile;
 
         data.llCpus.clear();
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 60409)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 60410)
@@ -2061,4 +2061,5 @@
           ulCpuExecutionCap(100),
           uCpuIdPortabilityLevel(0),
+          strCpuProfile("host"),
           ulMemorySizeMB((uint32_t)-1),
           graphicsControllerType(GraphicsControllerType_VBoxVGA),
@@ -2135,4 +2136,5 @@
                   && (ulCpuExecutionCap         == h.ulCpuExecutionCap)
                   && (uCpuIdPortabilityLevel    == h.uCpuIdPortabilityLevel)
+                  && strCpuProfile              == h.strCpuProfile
                   && (fHPETEnabled              == h.fHPETEnabled)
                   && (llCpus                    == h.llCpus)
@@ -2170,5 +2172,5 @@
                   && (llSharedFolders           == h.llSharedFolders)
                   && (clipboardMode             == h.clipboardMode)
-                  && (dndMode           == h.dndMode)
+                  && (dndMode                   == h.dndMode)
                   && (ulMemoryBalloonSize       == h.ulMemoryBalloonSize)
                   && (fPageFusionEnabled        == h.fPageFusionEnabled)
@@ -2938,4 +2940,5 @@
             }
             pelmHwChild->getAttributeValue("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
+            pelmHwChild->getAttributeValue("CpuProfile", hw.strCpuProfile);
 
             if ((pelmCPUChild = pelmHwChild->findChildElement("TripleFaultReset")))
@@ -4248,4 +4251,6 @@
     if (hw.uCpuIdPortabilityLevel != 0)
         pelmCPU->setAttribute("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
+    if (!hw.strCpuProfile.equals("host") && hw.strCpuProfile.isNotEmpty())
+        pelmCPU->setAttribute("CpuProfile", hw.strCpuProfile);
 
     /* Always save this setting as we have changed the default in 4.0 (on for large memory 64-bit systems). */
@@ -5688,5 +5693,14 @@
     if (m->sv < SettingsVersion_v1_16)
     {
-        // VirtualBox 5.1 adds a NVMe storage controller, paravirt debug options.
+        // VirtualBox 5.1 adds a NVMe storage controller, paravirt debug options, cpu profile.
+
+        if (   hardwareMachine.strParavirtDebug.isNotEmpty()
+            || (!hardwareMachine.strCpuProfile.equals("host") && hardwareMachine.strCpuProfile.isNotEmpty())
+           )
+        {
+            m->sv = SettingsVersion_v1_16;
+            return;
+        }
+
         for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();
              it != storageMachine.llStorageControllers.end();
@@ -5700,10 +5714,4 @@
                 return;
             }
-        }
-
-        if (hardwareMachine.strParavirtDebug.isNotEmpty())
-        {
-            m->sv = SettingsVersion_v1_16;
-            return;
         }
     }
