VirtualBox

Changeset 93901 in vbox for trunk


Ignore:
Timestamp:
Feb 23, 2022 3:35:26 PM (3 years ago)
Author:
vboxsync
Message:

VMM,Main,++: Removed VM_IS_RAW_MODE_ENABLED/VM_EXEC_ENGINE_RAW_MODE and added VM_IS_EXEC_ENGINE_IEM/VM_EXEC_ENGINE_IEM instead. In IMachineDebugger::getExecutionEngine VMExecutionEngine_RawMode was removed and VMExecutionEngine_Emulated added. Removed dead code and updated frontends accordingly. On darwin.arm64 HM now falls back on IEM execution since neither HM or NEM is availble there. bugref:9898

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/vm.h

    r93650 r93901  
    10911091
    10921092/**
    1093  * Checks whether raw-mode is used.
    1094  *
    1095  * @retval  true if either is used.
    1096  * @retval  false if software virtualization (raw-mode) is used.
     1093 * Checks whether iem-executes-all-mode is used.
     1094 *
     1095 * @retval  true if IEM is used.
     1096 * @retval  false if not.
    10971097 *
    10981098 * @param   a_pVM       The cross context VM structure.
     
    11001100 * @internal
    11011101 */
    1102 #ifdef VBOX_WITH_RAW_MODE
    1103 # define VM_IS_RAW_MODE_ENABLED(a_pVM)      ((a_pVM)->bMainExecutionEngine == VM_EXEC_ENGINE_RAW_MODE)
    1104 #else
    1105 # define VM_IS_RAW_MODE_ENABLED(a_pVM)      (false)
    1106 #endif
     1102#define VM_IS_EXEC_ENGINE_IEM(a_pVM)      ((a_pVM)->bMainExecutionEngine == VM_EXEC_ENGINE_IEM)
    11071103
    11081104/**
     
    11131109 *
    11141110 * @param   a_pVM       The cross context VM structure.
    1115  * @sa      VM_IS_RAW_MODE_ENABLED, VM_IS_HM_ENABLED, VM_IS_NEM_ENABLED.
     1111 * @sa      VM_IS_EXEC_ENGINE_IEM, VM_IS_HM_ENABLED, VM_IS_NEM_ENABLED.
    11161112 * @internal
    11171113 */
    1118 #define VM_IS_HM_OR_NEM_ENABLED(a_pVM)      ((a_pVM)->bMainExecutionEngine != VM_EXEC_ENGINE_RAW_MODE)
     1114#define VM_IS_HM_OR_NEM_ENABLED(a_pVM)      ((a_pVM)->bMainExecutionEngine != VM_EXEC_ENGINE_IEM)
    11191115
    11201116/**
     
    11251121 *
    11261122 * @param   a_pVM       The cross context VM structure.
    1127  * @sa      VM_IS_NEM_ENABLED, VM_IS_RAW_MODE_ENABLED, VM_IS_HM_OR_NEM_ENABLED.
     1123 * @sa      VM_IS_NEM_ENABLED, VM_IS_EXEC_ENGINE_IEM, VM_IS_HM_OR_NEM_ENABLED.
    11281124 * @internal
    11291125 */
     
    11371133 *
    11381134 * @param   a_pVM       The cross context VM structure.
    1139  * @sa      VM_IS_HM_ENABLED, VM_IS_RAW_MODE_ENABLED, VM_IS_HM_OR_NEM_ENABLED.
     1135 * @sa      VM_IS_HM_ENABLED, VM_IS_EXEC_ENGINE_IEM, VM_IS_HM_OR_NEM_ENABLED.
    11401136 * @internal
    11411137 */
  • trunk/include/VBox/vmm/vmapi.h

    r93444 r93901  
    4848/** Has not yet been set. */
    4949#define VM_EXEC_ENGINE_NOT_SET              UINT8_C(0)
    50 /** Raw-mode. */
    51 #define VM_EXEC_ENGINE_RAW_MODE             UINT8_C(1)
     50/** The interpreter (IEM). */
     51#define VM_EXEC_ENGINE_IEM                  UINT8_C(1)
    5252/** Hardware assisted virtualization thru HM. */
    5353#define VM_EXEC_ENGINE_HW_VIRT              UINT8_C(2)
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r93460 r93901  
    42974297                            " [STEP=%d LOG=%d EXEC=%s",
    42984298                            singlestepEnabled == TRUE, logEnabled == TRUE,
    4299                             enmExecEngine == VMExecutionEngine_NotSet ? "NotSet"
    4300                             : enmExecEngine == VMExecutionEngine_RawMode ? "RAW"
    4301                             : enmExecEngine == VMExecutionEngine_HwVirt ? "HM"
     4299                            enmExecEngine == VMExecutionEngine_NotSet      ? "NotSet"
     4300                            : enmExecEngine == VMExecutionEngine_Emulated  ? "IEM"
     4301                            : enmExecEngine == VMExecutionEngine_HwVirt    ? "HM"
    43024302                            : enmExecEngine == VMExecutionEngine_NativeApi ? "NEM" : "UNK");
    43034303                char *psz = strchr(szTitle, '\0');
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r93115 r93901  
    16101610}
    16111611
    1612 bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const
    1613 {
    1614     if (fHWVirtExSupported)
    1615         return questionBinary(0, MessageType_Error,
    1616                               tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
    1617                                  "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>"
    1618                                  "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
    1619                               0 /* auto-confirm id */,
    1620                               tr("Close VM"), tr("Continue"));
    1621     else
    1622         return questionBinary(0, MessageType_Error,
    1623                               tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
    1624                                  "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."),
    1625                               0 /* auto-confirm id */,
    1626                               tr("Close VM"), tr("Continue"));
    1627 }
    1628 
    1629 bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const
    1630 {
    1631     if (fHWVirtExSupported)
    1632         return questionBinary(0, MessageType_Error,
    1633                               tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
    1634                                  "Certain guests (e.g. OS/2 and QNX) require this feature.</p>"
    1635                                  "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
    1636                               0 /* auto-confirm id */,
    1637                               tr("Close VM"), tr("Continue"));
    1638     else
    1639         return questionBinary(0, MessageType_Error,
    1640                               tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
    1641                                  "Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"),
    1642                               0 /* auto-confirm id */,
    1643                               tr("Close VM"), tr("Continue"));
    1644 }
    1645 
    16461612void UIMessageCenter::warnAboutVBoxSVCUnavailable() const
    16471613{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r93115 r93901  
    404404
    405405        bool warnAboutNetworkInterfaceNotFound(const QString &strMachineName, const QString &strIfNames) const;
    406         bool warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const;
    407         bool warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const;
    408406
    409407        void warnAboutVBoxSVCUnavailable() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r93115 r93901  
    986986    {
    987987        /* Assign state-icons: */
     988/** @todo  The vtx_amdv_disabled_16px.png icon isn't really approprate anymore (no raw-mode),
     989 * might want to get something different for KVMExecutionEngine_Emulated or reuse the
     990 * vm_execution_engine_native_api_16px.png one... @bugref{9898} */
    988991        setStateIcon(KVMExecutionEngine_NotSet, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
    989         setStateIcon(KVMExecutionEngine_RawMode, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
     992        setStateIcon(KVMExecutionEngine_Emulated, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
    990993        setStateIcon(KVMExecutionEngine_HwVirt, UIIconPool::iconSet(":/vtx_amdv_16px.png"));
    991         /** @todo New indicator icon, vm_execution_engine_native_api_16px.png, V inside a turtle / tortoise.  @bugref{9044} */
    992994        setStateIcon(KVMExecutionEngine_NativeApi, UIIconPool::iconSet(":/vm_execution_engine_native_api_16px.png"));
    993995
     
    10791081                strExecutionEngine = "VT-x/AMD-V";  /* no translation */
    10801082                break;
    1081             case KVMExecutionEngine_RawMode:
    1082                 strExecutionEngine = "raw-mode";    /* no translation */
     1083            case KVMExecutionEngine_Emulated:
     1084                strExecutionEngine = "IEM";         /* no translation */
    10831085                break;
    10841086            case KVMExecutionEngine_NativeApi:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r93460 r93901  
    19081908bool UISession::postprocessInitialization()
    19091909{
    1910     /* Check if the required virtualization features are active. We get this info only when the session is active. */
    1911     const bool fIs64BitsGuest = uiCommon().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetIs64Bit();
    1912     const bool fRecommendVirtEx = uiCommon().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetRecommendedVirtEx();
    1913     AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
    1914     const KVMExecutionEngine enmEngine = debugger().GetExecutionEngine();
    1915     if (fRecommendVirtEx && enmEngine == KVMExecutionEngine_RawMode)
    1916     {
    1917         /* Check whether vt-x / amd-v supported: */
    1918         bool fVTxAMDVSupported = uiCommon().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
    1919 
    1920         /* Pause VM: */
    1921         setPause(true);
    1922 
    1923         /* Ask the user about further actions: */
    1924         bool fShouldWeClose;
    1925         if (fIs64BitsGuest)
    1926             fShouldWeClose = msgCenter().warnAboutVirtExInactiveFor64BitsGuest(fVTxAMDVSupported);
    1927         else
    1928             fShouldWeClose = msgCenter().warnAboutVirtExInactiveForRecommendedGuest(fVTxAMDVSupported);
    1929 
    1930         /* If user asked to close VM: */
    1931         if (fShouldWeClose)
    1932         {
    1933             /* Enable 'manual-override',
    1934              * preventing automatic Runtime UI closing: */
    1935             setManualOverrideMode(true);
    1936             /* Power off VM: */
    1937             LogRel(("GUI: Aborting startup due to postprocess initialization issue detected...\n"));
    1938             powerOff(false /* do NOT restore current snapshot */);
    1939             return false;
    1940         }
    1941 
    1942         /* Resume VM: */
    1943         setPause(false);
    1944     }
    1945 
    1946     /* True by default: */
     1910    /* There used to be some raw-mode warnings here for raw-mode incompatible
     1911       guests (64-bit ones and OS/2).  Nothing to do at present. */
    19471912    return true;
    19481913}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r93115 r93901  
    348348            strExecutionEngine = "VT-x/AMD-V";  /* no translation */
    349349            break;
    350         case KVMExecutionEngine_RawMode:
    351             strExecutionEngine = "raw-mode";    /* no translation */
     350        case KVMExecutionEngine_Emulated:
     351            strExecutionEngine = "IEM";         /* no translation */
    352352            break;
    353353        case KVMExecutionEngine_NativeApi:
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r93891 r93901  
    2105721057  <enum
    2105821058    name="VMExecutionEngine"
    21059     uuid="56029577-31f7-44d2-3334-7ecbf95294b6"
     21059    uuid="6e3f78f9-2dfe-4ed7-863d-67cad351e9d8"
    2106021060    >
    2106121061    <desc>
     
    2106521065      <desc>Has not yet been set (try again later).</desc>
    2106621066    </const>
    21067     <const name="RawMode"           value="1">
    21068       <desc>Raw-mode.</desc>
     21067    <const name="Emulated"          value="1">
     21068      <desc>Emulated thru IEM.</desc>
    2106921069    </const>
    2107021070    <const name="HwVirt"            value="2">
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r93485 r93901  
    425425            {
    426426                case VM_EXEC_ENGINE_NOT_SET:    *apenmEngine = VMExecutionEngine_NotSet; break;
    427                 case VM_EXEC_ENGINE_RAW_MODE:   *apenmEngine = VMExecutionEngine_RawMode; break;
     427                case VM_EXEC_ENGINE_IEM:        *apenmEngine = VMExecutionEngine_Emulated; break;
    428428                case VM_EXEC_ENGINE_HW_VIRT:    *apenmEngine = VMExecutionEngine_HwVirt; break;
    429429                case VM_EXEC_ENGINE_NATIVE_API: *apenmEngine = VMExecutionEngine_NativeApi; break;
  • trunk/src/VBox/VMM/Makefile.kmk

    r93757 r93901  
    715715# Always optimize the interpreter.
    716716#
    717 if ($(USERNAME) != "bird" && $(USERNAME) != "aeichner") || "$(KBUILD_TYPE)" == "release" #|| "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
     717#if "$(KBUILD_TYPE)" == "release" || ($(USERNAME) != "bird" && $(USERNAME) != "aeichner")
     718if "$(KBUILD_TYPE)" == "release" || ($(USERNAME) != "aeichner")
    718719 if1of ($(KBUILD_TARGET), win)
    719720# -noover is recognized despite the statement saying otherwise. It silences these warnings:
    720721# cl : Command line warning D9025 : overriding '/Od' with '/O2'
    721722# cl : Command line warning D9025 : overriding '/Oy-' with '/Oy'
    722 VMMAll/IEMAll.cpp_CXXFLAGS += -noover -O2xy
     723VMMAll/IEMAll.cpp_CXXFLAGS       += -noover -O2xy
     724VMMAll/IEMAllAImplC.cpp_CXXFLAGS += -noover -O2xy
    723725 else
    724726VMMAll/IEMAll.cpp_CXXFLAGS += -O2
     727VMMAll/IEMAllAImplC.cpp_CXXFLAGS += -O2 -fomit-frame-pointer
    725728#VMMAll/IEMAll.cpp_CXXFLAGS += -fno-align-functions -fno-align-jumps -fno-align-loops # Saves a few of percents, not worth it.
    726729#VMMAll/IEMAll.cpp_CXXFLAGS += -fno-reorder-blocks    # Saves one or two percent ... never mind.
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r93824 r93901  
    13131313                 * No need to monitor anything in this case. */
    13141314                /** @todo r=bird: WTF is hit?!?   */
    1315                 Assert(VM_IS_RAW_MODE_ENABLED(pVM));
     1315                /*Assert(VM_IS_RAW_MODE_ENABLED(pVM)); - ??? */
    13161316                GCPdPt  = uGstPdpe & X86_PDPE_PG_MASK;
    13171317                enmKind = PGMPOOLKIND_PAE_PD_PHYS;
     
    30363036    switch (enmGuestMode)
    30373037    {
    3038         /*
    3039          * When switching to real or protected mode we don't change
    3040          * anything since it's likely that we'll switch back pretty soon.
    3041          *
    3042          * During pgmR3InitPaging we'll end up here with PGMMODE_INVALID
    3043          * and is supposed to determine which shadow paging and switcher to
    3044          * use during init.
    3045          */
    30463038        case PGMMODE_REAL:
    30473039        case PGMMODE_PROTECTED:
    3048             if (    enmShadowMode != PGMMODE_INVALID
    3049                 && VM_IS_RAW_MODE_ENABLED(pVM) /* always switch in hm and nem modes! */)
    3050                 break; /* (no change) */
    3051 
    30523040            switch (enmHostMode)
    30533041            {
  • trunk/src/VBox/VMM/VMMR3/DBGF.cpp

    r93787 r93901  
    286286#else
    287287    int cWait = RTEnvExist("VBOX_DBGF_NO_WAIT_FOR_ATTACH")
    288              || (   !VM_IS_RAW_MODE_ENABLED(pVM)
    289                  && (   enmEvent == DBGFEVENT_ASSERTION_HYPER
     288             || (   (   enmEvent == DBGFEVENT_ASSERTION_HYPER
    290289                     || enmEvent == DBGFEVENT_FATAL_ERROR)
    291290                 && !RTEnvExist("VBOX_DBGF_WAIT_FOR_ATTACH"))
  • trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp

    r93115 r93901  
    636636        if (hAlias == DBGF_AS_R0 && pUVM->pVM)
    637637            PDMR3LdrEnumModules(pUVM->pVM, dbgfR3AsLazyPopulateR0Callback, hDbgAs);
     638#ifdef VBOX_WITH_RAW_MODE_KEEP /* needs fixing */
    638639        else if (hAlias == DBGF_AS_RC && pUVM->pVM && VM_IS_RAW_MODE_ENABLED(pUVM->pVM))
    639640        {
     
    641642            PDMR3LdrEnumModules(pUVM->pVM, dbgfR3AsLazyPopulateRCCallback, hDbgAs);
    642643        }
     644#endif
    643645        else if (hAlias == DBGF_AS_PHYS && pUVM->pVM)
    644646        {
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r93718 r93901  
    108108    PCFGMNODE pCfgEM = CFGMR3GetChild(pCfgRoot, "EM");
    109109
    110     int rc = CFGMR3QueryBoolDef(pCfgEM, "IemExecutesAll", &pVM->em.s.fIemExecutesAll, false);
     110    int rc = CFGMR3QueryBoolDef(pCfgEM, "IemExecutesAll", &pVM->em.s.fIemExecutesAll,
     111#if defined(RT_ARCH_ARM64) && defined(RT_OS_DARWIN)
     112                                true
     113#else
     114                                false
     115#endif
     116                                );
    111117    AssertLogRelRCReturn(rc, rc);
    112118
     
    12801286     * Execute everything in IEM?
    12811287     */
    1282     if (pVM->em.s.fIemExecutesAll)
     1288    if (   pVM->em.s.fIemExecutesAll
     1289        || VM_IS_EXEC_ENGINE_IEM(pVM))
    12831290        return EMSTATE_IEM;
    12841291
    1285     /* !!! THIS MUST BE IN SYNC WITH remR3CanExecuteRaw !!! */
    1286     /* !!! THIS MUST BE IN SYNC WITH remR3CanExecuteRaw !!! */
    1287     /* !!! THIS MUST BE IN SYNC WITH remR3CanExecuteRaw !!! */
    1288 
    1289     X86EFLAGS EFlags = pVCpu->cpum.GstCtx.eflags;
    1290     if (!VM_IS_RAW_MODE_ENABLED(pVM))
    1291     {
    1292         if (VM_IS_HM_ENABLED(pVM))
    1293         {
    1294             if (HMCanExecuteGuest(pVM, pVCpu, &pVCpu->cpum.GstCtx))
    1295                 return EMSTATE_HM;
    1296         }
    1297         else if (NEMR3CanExecuteGuest(pVM, pVCpu))
    1298             return EMSTATE_NEM;
    1299 
    1300         /*
    1301          * Note! Raw mode and hw accelerated mode are incompatible. The latter
    1302          *       turns off monitoring features essential for raw mode!
    1303          */
    1304         return EMSTATE_IEM_THEN_REM;
    1305     }
     1292    if (VM_IS_HM_ENABLED(pVM))
     1293    {
     1294        if (HMCanExecuteGuest(pVM, pVCpu, &pVCpu->cpum.GstCtx))
     1295            return EMSTATE_HM;
     1296    }
     1297    else if (NEMR3CanExecuteGuest(pVM, pVCpu))
     1298        return EMSTATE_NEM;
    13061299
    13071300    /*
    1308      * Standard raw-mode:
    1309      *
    1310      * Here we only support 16 & 32 bits protected mode ring 3 code that has no IO privileges
    1311      * or 32 bits protected mode ring 0 code
    1312      *
    1313      * The tests are ordered by the likelihood of being true during normal execution.
     1301     * Note! Raw mode and hw accelerated mode are incompatible. The latter
     1302     *       turns off monitoring features essential for raw mode!
    13141303     */
    1315     if (EFlags.u32 & (X86_EFL_TF /* | HF_INHIBIT_IRQ_MASK*/))
    1316     {
    1317         Log2(("raw mode refused: EFlags=%#x\n", EFlags.u32));
    1318         return EMSTATE_REM;
    1319     }
    1320 
    1321 # ifndef VBOX_RAW_V86
    1322     if (EFlags.u32 & X86_EFL_VM) {
    1323         Log2(("raw mode refused: VM_MASK\n"));
    1324         return EMSTATE_REM;
    1325     }
    1326 # endif
    1327 
    1328     /** @todo check up the X86_CR0_AM flag in respect to raw mode!!! We're probably not emulating it right! */
    1329     uint32_t u32CR0 = pVCpu->cpum.GstCtx.cr0;
    1330     if ((u32CR0 & (X86_CR0_PG | X86_CR0_PE)) != (X86_CR0_PG | X86_CR0_PE))
    1331     {
    1332         //Log2(("raw mode refused: %s%s%s\n", (u32CR0 & X86_CR0_PG) ? "" : " !PG", (u32CR0 & X86_CR0_PE) ? "" : " !PE", (u32CR0 & X86_CR0_AM) ? "" : " !AM"));
    1333         return EMSTATE_REM;
    1334     }
    1335 
    1336     if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PAE)
    1337     {
    1338         uint32_t u32Dummy, u32Features;
    1339 
    1340         CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
    1341         if (!(u32Features & X86_CPUID_FEATURE_EDX_PAE))
    1342             return EMSTATE_REM;
    1343     }
    1344 
    1345     unsigned uSS = pVCpu->cpum.GstCtx.ss.Sel;
    1346     if (    pVCpu->cpum.GstCtx.eflags.Bits.u1VM
    1347         ||  (uSS & X86_SEL_RPL) == 3)
    1348     {
    1349         if (!(EFlags.u32 & X86_EFL_IF))
    1350         {
    1351             Log2(("raw mode refused: IF (RawR3)\n"));
    1352             return EMSTATE_REM;
    1353         }
    1354 
    1355         if (!(u32CR0 & X86_CR0_WP))
    1356         {
    1357             Log2(("raw mode refused: CR0.WP + RawR0\n"));
    1358             return EMSTATE_REM;
    1359         }
    1360     }
    1361     else
    1362     {
    1363         /* Only ring 0 supervisor code. */
    1364         if ((uSS & X86_SEL_RPL) != 0)
    1365         {
    1366             Log2(("raw r0 mode refused: CPL %d\n", uSS & X86_SEL_RPL));
    1367             return EMSTATE_REM;
    1368         }
    1369 
    1370         // Let's start with pure 32 bits ring 0 code first
    1371         /** @todo What's pure 32-bit mode? flat? */
    1372         if (    !(pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig)
    1373             ||  !(pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig))
    1374         {
    1375             Log2(("raw r0 mode refused: SS/CS not 32bit\n"));
    1376             return EMSTATE_REM;
    1377         }
    1378 
    1379         /* Write protection must be turned on, or else the guest can overwrite our hypervisor code and data. */
    1380         if (!(u32CR0 & X86_CR0_WP))
    1381         {
    1382             Log2(("raw r0 mode refused: CR0.WP=0!\n"));
    1383             return EMSTATE_REM;
    1384         }
    1385 
    1386 # if !defined(VBOX_ALLOW_IF0) && !defined(VBOX_RUN_INTERRUPT_GATE_HANDLERS)
    1387         if (!(EFlags.u32 & X86_EFL_IF))
    1388         {
    1389             ////Log2(("R0: IF=0 VIF=%d %08X\n", eip, pVMeflags));
    1390             //Log2(("RR0: Interrupts turned off; fall back to emulation\n"));
    1391             return EMSTATE_REM;
    1392         }
    1393 # endif
    1394 
    1395 # ifndef VBOX_WITH_RAW_RING1
    1396         /** @todo still necessary??? */
    1397         if (EFlags.Bits.u2IOPL != 0)
    1398         {
    1399             Log2(("raw r0 mode refused: IOPL %d\n", EFlags.Bits.u2IOPL));
    1400             return EMSTATE_REM;
    1401         }
    1402 # endif
    1403     }
    1404 
    1405     /*
    1406      * Stale hidden selectors means raw-mode is unsafe (being very careful).
    1407      */
    1408     if (pVCpu->cpum.GstCtx.cs.fFlags & CPUMSELREG_FLAGS_STALE)
    1409     {
    1410         Log2(("raw mode refused: stale CS\n"));
    1411         return EMSTATE_REM;
    1412     }
    1413     if (pVCpu->cpum.GstCtx.ss.fFlags & CPUMSELREG_FLAGS_STALE)
    1414     {
    1415         Log2(("raw mode refused: stale SS\n"));
    1416         return EMSTATE_REM;
    1417     }
    1418     if (pVCpu->cpum.GstCtx.ds.fFlags & CPUMSELREG_FLAGS_STALE)
    1419     {
    1420         Log2(("raw mode refused: stale DS\n"));
    1421         return EMSTATE_REM;
    1422     }
    1423     if (pVCpu->cpum.GstCtx.es.fFlags & CPUMSELREG_FLAGS_STALE)
    1424     {
    1425         Log2(("raw mode refused: stale ES\n"));
    1426         return EMSTATE_REM;
    1427     }
    1428     if (pVCpu->cpum.GstCtx.fs.fFlags & CPUMSELREG_FLAGS_STALE)
    1429     {
    1430         Log2(("raw mode refused: stale FS\n"));
    1431         return EMSTATE_REM;
    1432     }
    1433     if (pVCpu->cpum.GstCtx.gs.fFlags & CPUMSELREG_FLAGS_STALE)
    1434     {
    1435         Log2(("raw mode refused: stale GS\n"));
    1436         return EMSTATE_REM;
    1437     }
    1438 
    1439 # ifdef VBOX_WITH_SAFE_STR
    1440     if (pVCpu->cpum.GstCtx.tr.Sel == 0)
    1441     {
    1442         Log(("Raw mode refused -> TR=0\n"));
    1443         return EMSTATE_REM;
    1444     }
    1445 # endif
    1446 
    1447     /*Assert(PGMPhysIsA20Enabled(pVCpu));*/
    1448     return EMSTATE_RAW;
     1304    return EMSTATE_IEM_THEN_REM;
    14491305}
    14501306
     
    23542210                case VINF_EM_RESCHEDULE_RAW:
    23552211                    Assert(!pVM->em.s.fIemExecutesAll || pVCpu->em.s.enmState != EMSTATE_IEM);
    2356                     if (VM_IS_RAW_MODE_ENABLED(pVM))
    2357                     {
    2358                         Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE_RAW: %d -> %d (EMSTATE_RAW)\n", enmOldState, EMSTATE_RAW));
    2359                         pVCpu->em.s.enmState = EMSTATE_RAW;
    2360                     }
    2361                     else
    2362                     {
    2363                         AssertLogRelFailed();
    2364                         pVCpu->em.s.enmState = EMSTATE_NONE;
    2365                     }
     2212                    AssertLogRelFailed();
     2213                    pVCpu->em.s.enmState = EMSTATE_NONE;
    23662214                    break;
    23672215
     
    23932241                case VINF_EM_RESCHEDULE_REM:
    23942242                    Assert(!pVM->em.s.fIemExecutesAll || pVCpu->em.s.enmState != EMSTATE_IEM);
    2395                     if (!VM_IS_RAW_MODE_ENABLED(pVM))
    2396                     {
    2397                         Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE_REM: %d -> %d (EMSTATE_IEM_THEN_REM)\n",
    2398                               enmOldState, EMSTATE_IEM_THEN_REM));
    2399                         if (pVCpu->em.s.enmState != EMSTATE_IEM_THEN_REM)
    2400                         {
    2401                             pVCpu->em.s.enmState = EMSTATE_IEM_THEN_REM;
    2402                             pVCpu->em.s.cIemThenRemInstructions = 0;
    2403                         }
    2404                     }
    2405                     else
    2406                     {
    2407                         Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE_REM: %d -> %d (EMSTATE_REM)\n", enmOldState, EMSTATE_REM));
    2408                         pVCpu->em.s.enmState = EMSTATE_REM;
     2243                    Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE_REM: %d -> %d (EMSTATE_IEM_THEN_REM)\n",
     2244                          enmOldState, EMSTATE_IEM_THEN_REM));
     2245                    if (pVCpu->em.s.enmState != EMSTATE_IEM_THEN_REM)
     2246                    {
     2247                        pVCpu->em.s.enmState = EMSTATE_IEM_THEN_REM;
     2248                        pVCpu->em.s.cIemThenRemInstructions = 0;
    24092249                    }
    24102250                    break;
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r93744 r93901  
    245245                              "|UseNEMInstead"
    246246                              "|FallbackToNEM"
     247                              "|FallbackToIEM"
    247248                              "|EnableNestedPaging"
    248249                              "|EnableUX"
     
    277278     * Forces hardware virtualization, no falling back on raw-mode. HM must be
    278279     * enabled, i.e. /HMEnabled must be true. */
    279     bool fHMForced;
     280    bool const fHMForced = true;
     281#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    280282    AssertRelease(pVM->fHMEnabled);
    281     fHMForced = true;
     283#else
     284    AssertRelease(!pVM->fHMEnabled);
     285#endif
    282286
    283287    /** @cfgm{/HM/UseNEMInstead, bool, true}
     
    296300    bool fFallbackToNEM = true;
    297301    rc = CFGMR3QueryBoolDef(pCfgHm, "FallbackToNEM", &fFallbackToNEM, true);
     302    AssertRCReturn(rc, rc);
     303
     304    /** @cfgm{/HM/FallbackToIEM, bool, false on AMD64 else true }
     305     * Enables fallback on NEM. */
     306#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     307    bool fFallbackToIEM = false;
     308#else
     309    bool fFallbackToIEM = true;
     310#endif
     311    rc = CFGMR3QueryBoolDef(pCfgHm, "fFallbackToIEM", &fFallbackToIEM, fFallbackToIEM);
    298312    AssertRCReturn(rc, rc);
    299313
     
    613627                }
    614628            }
     629
     630            /*
     631             * Then try fall back on IEM if NEM isn't available and we're allowed to.
     632             */
    615633            if (RT_FAILURE(rc))
    616                 return VM_SET_ERROR(pVM, rc, pszMsg);
     634            {
     635                if (   fFallbackToIEM
     636                    && (!fFallbackToNEM || rc == VERR_NEM_NOT_AVAILABLE))
     637                {
     638                    LogRel(("HM: HMR3Init: Falling back on IEM: %s\n", !fFallbackToNEM ? pszMsg : "NEM not available"));
     639                    VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_IEM);
     640                }
     641                else
     642                    return VM_SET_ERROR(pVM, rc, pszMsg);
     643            }
    617644        }
    618645    }
     
    622649         * Disabled HM mean raw-mode, unless NEM is supposed to be used.
    623650         */
     651        rc = VERR_NEM_NOT_AVAILABLE;
    624652        if (fUseNEMInstead)
    625653        {
    626654            rc = NEMR3Init(pVM, false /*fFallback*/, true);
    627655            ASMCompilerBarrier(); /* NEMR3Init may have changed bMainExecutionEngine. */
    628             if (RT_FAILURE(rc))
     656            if (RT_SUCCESS(rc))
     657            {
     658                /* For some reason, HM is in charge or large pages. Make sure to enable them: */
     659                PGMSetLargePageUsage(pVM, pVM->hm.s.fLargePages);
     660            }
     661            else if (!fFallbackToIEM || rc != VERR_NEM_NOT_AVAILABLE)
    629662                return rc;
    630 
    631             /* For some reason, HM is in charge or large pages. Make sure to enable them: */
    632             PGMSetLargePageUsage(pVM, pVM->hm.s.fLargePages);
    633         }
     663        }
     664
     665        if (fFallbackToIEM && rc == VERR_NEM_NOT_AVAILABLE)
     666        {
     667            LogRel(("HM: HMR3Init: Falling back on IEM%s\n", fUseNEMInstead ? ": NEM not available" : ""));
     668            VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_IEM);
     669        }
     670
    634671        if (   pVM->bMainExecutionEngine == VM_EXEC_ENGINE_NOT_SET
    635             || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_RAW_MODE
    636672            || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_HW_VIRT /* paranoia */)
    637673            return VM_SET_ERROR(pVM, rc, "Misconfigured VM: No guest execution engine available!");
     
    659695
    660696    Assert(pVM->bMainExecutionEngine != VM_EXEC_ENGINE_NOT_SET);
    661     Assert(pVM->bMainExecutionEngine != VM_EXEC_ENGINE_RAW_MODE);
    662697    return VINF_SUCCESS;
    663698}
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r93115 r93901  
    577577{
    578578    LogFlow(("PDMR3Relocate\n"));
    579 
     579    RT_NOREF(pVM, offDelta);
     580
     581#ifdef VBOX_WITH_RAW_MODE_KEEP /* needs fixing */
    580582    /*
    581583     * The registered PIC.
     
    610612     * Devices & Drivers.
    611613     */
    612 #ifdef VBOX_WITH_RAW_MODE_KEEP /* needs fixing */
    613614    int rc;
    614615    PCPDMDEVHLPRC pDevHlpRC = NIL_RTRCPTR;
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r93651 r93901  
    41064106     */
    41074107    pVM->pdm.s.Apic.pDevInsR3 = pDevIns;
     4108#ifdef VBOX_WITH_RAW_MODE_KEEP
    41084109    pVM->pdm.s.Apic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    41094110    Assert(pVM->pdm.s.Apic.pDevInsRC || !VM_IS_RAW_MODE_ENABLED(pVM));
     4111#endif
    41104112
    41114113    LogFlow(("pdmR3DevHlp_ApicRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
  • trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp

    r93115 r93901  
    419419
    420420    RTRCPTR pRCHelpers = NIL_RTRCPTR;
     421#if 0
    421422    if (VM_IS_RAW_MODE_ENABLED(pVM))
    422423    {
     
    425426        AssertRelease(pRCHelpers);
    426427    }
     428#else
     429    RT_NOREF(pDevIns);
     430#endif
    427431
    428432    LogFlow(("pdmR3PciRawHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
  • trunk/src/VBox/VMM/VMMR3/PDMLdr.cpp

    r93718 r93901  
    956956#if defined(PDMLDR_FAKE_MODE) || !defined(VBOX_WITH_RAW_MODE_KEEP)
    957957    RT_NOREF(pVM, pszModule, pszSymbol);
    958     Assert(VM_IS_RAW_MODE_ENABLED(pVM));
    959958    *pRCPtrValue = NIL_RTRCPTR;
    960959    return VINF_SUCCESS;
     
    10251024#if defined(PDMLDR_FAKE_MODE) || !defined(VBOX_WITH_RAW_MODE_KEEP)
    10261025    RT_NOREF(pVM, pszModule, pszSearchPath, pszSymbol);
    1027     Assert(VM_IS_RAW_MODE_ENABLED(pVM));
    10281026    *pRCPtrValue = NIL_RTRCPTR;
    10291027    return VINF_SUCCESS;
     
    16371635                                                bool fRing0)
    16381636{
    1639     bool const fNullRun = !fRing0 && !VM_IS_RAW_MODE_ENABLED(pVM);
     1637    bool const fNullRun = !fRing0;
    16401638
    16411639    /*
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r93744 r93901  
    10871087     * GIM is now initialized. Determine if TSC mode switching is allowed (respecting CFGM override).
    10881088     */
    1089     pVM->tm.s.fTSCModeSwitchAllowed &= tmR3HasFixedTSC(pVM) && GIMIsEnabled(pVM) && !VM_IS_RAW_MODE_ENABLED(pVM);
     1089    pVM->tm.s.fTSCModeSwitchAllowed &= tmR3HasFixedTSC(pVM) && GIMIsEnabled(pVM);
    10901090    LogRel(("TM: TMR3InitFinalize: fTSCModeSwitchAllowed=%RTbool\n", pVM->tm.s.fTSCModeSwitchAllowed));
    10911091
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r93718 r93901  
    729729static int vmR3ReadBaseConfig(PVM pVM, PUVM pUVM, uint32_t cCpus)
    730730{
    731     int         rc;
    732     PCFGMNODE   pRoot = CFGMR3GetRoot(pVM);
     731    PCFGMNODE const pRoot = CFGMR3GetRoot(pVM);
    733732
    734733    /*
    735734     * Base EM and HM config properties.
    736735     */
     736#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    737737    pVM->fHMEnabled = true;
     738#else /* Other architectures must fall back on IEM for the time being: */
     739    pVM->fHMEnabled = false;
     740#endif
    738741
    739742    /*
     
    741744     */
    742745    uint32_t cCPUsCfg;
    743     rc = CFGMR3QueryU32Def(pRoot, "NumCPUs", &cCPUsCfg, 1);
     746    int rc = CFGMR3QueryU32Def(pRoot, "NumCPUs", &cCPUsCfg, 1);
    744747    AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Rrc\n", rc), rc);
    745748    AssertLogRelMsgReturn(cCPUsCfg == cCpus,
     
    831834    if (RT_SUCCESS(rc))
    832835    {
    833         ASMCompilerBarrier(); /* HMR3Init will have modified bMainExecutionEngine */
     836        ASMCompilerBarrier(); /* HMR3Init will have modified const member bMainExecutionEngine. */
    834837        Assert(   pVM->bMainExecutionEngine == VM_EXEC_ENGINE_HW_VIRT
    835                || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_NATIVE_API);
     838               || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_NATIVE_API
     839               || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_IEM);
    836840        rc = MMR3Init(pVM);
    837841        if (RT_SUCCESS(rc))
  • trunk/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp

    r93115 r93901  
    368368             * assisted virtualization mode, thus the different messages.
    369369             */
    370             uint32_t        uEIP       = 0; //CPUMGetHyperEIP(pVCpu);
    371370            TRPMEVENT       enmType;
    372371            uint8_t         u8TrapNo   =       0xce;
     
    376375            bool            fIcebp     = false;
    377376            int rc2 = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrorCode, &uCR2, &cbInstr, &fIcebp);
    378             if (VM_IS_RAW_MODE_ENABLED(pVM))
    379             {
    380                 if (RT_SUCCESS(rc2))
    381                     pHlp->pfnPrintf(pHlp,
    382                                     "!! TRAP=%02x ERRCD=%RX32 CR2=%RGv EIP=%RX32 Type=%d cbInstr=%02x fIcebp=%RTbool\n",
    383                                     u8TrapNo, uErrorCode, uCR2, uEIP, enmType, cbInstr, fIcebp);
    384                 else
    385                     pHlp->pfnPrintf(pHlp,
    386                                     "!! EIP=%RX32 NOTRAP\n",
    387                                     uEIP);
    388             }
    389             else if (RT_SUCCESS(rc2))
     377            if (RT_SUCCESS(rc2))
    390378                pHlp->pfnPrintf(pHlp,
    391379                                "!! ACTIVE TRAP=%02x ERRCD=%RX32 CR2=%RGv PC=%RGr Type=%d cbInstr=%02x fIcebp=%RTbool (Guest!)\n",
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette