VirtualBox

Changeset 101054 in vbox


Ignore:
Timestamp:
Sep 7, 2023 1:59:53 PM (13 months ago)
Author:
vboxsync
Message:

Main: More checks for (un)supported platforms. See comments for details. bugref:10384

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/PlatformARMImpl.cpp

    r101052 r101054  
    172172{
    173173    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    174     m->bd.rollback();
     174    if (m)
     175        m->bd.rollback();
    175176}
    176177
  • trunk/src/VBox/Main/src-server/PlatformImpl.cpp

    r101052 r101054  
    9292    m->bd.allocate();
    9393
    94     /* Allocates architecture-dependent stuff. */
    95     HRESULT hrc = i_initArchitecture(m->bd->architectureType);
    96     AssertComRCReturnRC(hrc);
     94    /* Allocates architecture-dependent stuff.
     95     * Note: We ignore the return value here, as the machine object expects a working platform object.
     96             We always want a working platform object, no matter if we support the current platform architecture or not. */
     97    i_initArchitecture(m->bd->architectureType);
    9798
    9899    /* Confirm a successful initialization */
    99100    autoInitSpan.setSucceeded();
    100101
     102    LogFlowThisFuncLeave();
    101103    return S_OK;
    102104}
     
    129131    m->bd.share(aThat->m->bd);
    130132
    131     /* Allocates architecture-dependent stuff. */
    132     HRESULT hrc = i_initArchitecture(aThat->m->bd->architectureType, aThat);
    133     AssertComRCReturnRC(hrc);
     133    /* Allocates architecture-dependent stuff.
     134     * Note: We ignore the return value here, as the machine object expects a working platform object.
     135             We always want a working platform object, no matter if we support the current platform architecture or not. */
     136    i_initArchitecture(aThat->m->bd->architectureType, aThat);
    134137
    135138    autoInitSpan.setSucceeded();
     
    163166    m->bd.attachCopy(aThat->m->bd);
    164167
    165     /* Allocates architecture-dependent stuff. */
    166     HRESULT hrc = i_initArchitecture(aThat->m->bd->architectureType, aThat, true /* fCopy */);
    167     AssertComRCReturnRC(hrc);
     168    /* Allocates architecture-dependent stuff.
     169     * Note: We ignore the return value here, as the machine object expects a working platform object.
     170             We always want a working platform object, no matter if we support the current platform architecture or not. */
     171    i_initArchitecture(aThat->m->bd->architectureType, aThat, true /* fCopy */);
    168172
    169173    autoInitSpan.setSucceeded();
     
    277281        case PlatformArchitecture_x86:
    278282        {
    279             /* mX86 is constant during life time, no need to lock */
    280             return mX86.queryInterfaceTo(aX86.asOutParam());
     283            if (mX86.isNotNull())
     284            {
     285                /* mX86 is constant during life time, no need to lock. */
     286                return mX86.queryInterfaceTo(aX86.asOutParam());
     287            }
     288            break;
    281289        }
    282290
     
    286294    }
    287295
    288     return VBOX_E_PLATFORM_ARCH_NOT_SUPPORTED;
     296    return setErrorVrc(VERR_PLATFORM_ARCH_NOT_SUPPORTED, ("x86-specific platform settings are not available on this platform"));
    289297}
    290298
     
    302310        case PlatformArchitecture_ARM:
    303311        {
    304             /* mARM is constant during life time, no need to lock */
    305             return mARM.queryInterfaceTo(aARM.asOutParam());
     312            if (mARM.isNotNull())
     313            {
     314                /* mARM is constant during life time, no need to lock. */
     315                return mARM.queryInterfaceTo(aARM.asOutParam());
     316            }
     317            break;
    306318        }
    307319#else
     
    313325    }
    314326
    315     return VBOX_E_PLATFORM_ARCH_NOT_SUPPORTED;
     327    return setErrorVrc(VERR_PLATFORM_ARCH_NOT_SUPPORTED, ("ARM-specific platform settings are not available on this platform"));
    316328}
    317329
     
    538550            return mX86->i_saveSettings(data.x86);
    539551
    540  #ifdef VBOX_WITH_VIRT_ARMV8
     552#ifdef VBOX_WITH_VIRT_ARMV8
    541553        case PlatformArchitecture_ARM:
    542554            return mARM->i_saveSettings(data.arm);
     
    554566{
    555567    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    556     m->bd.rollback();
    557 
    558     switch (m->bd->architectureType)
    559     {
    560         case PlatformArchitecture_x86:
    561             return mX86->i_rollback();
    562 
    563 #ifdef VBOX_WITH_VIRT_ARMV8
    564         case PlatformArchitecture_ARM:
    565             return mARM->i_rollback();
    566 #endif
    567         case PlatformArchitecture_None:
    568             RT_FALL_THROUGH();
    569         default:
    570             break;
    571     }
    572 
    573     AssertFailedReturnVoid();
     568
     569    if (m)
     570    {
     571        m->bd.rollback();
     572
     573        switch (m->bd->architectureType)
     574        {
     575            case PlatformArchitecture_x86:
     576                if (mX86.isNotNull())
     577                    return mX86->i_rollback();
     578                break;
     579
     580#ifdef VBOX_WITH_VIRT_ARMV8
     581            case PlatformArchitecture_ARM:
     582                if (mARM.isNotNull())
     583                    return mARM->i_rollback();
     584                break;
     585#endif
     586            case PlatformArchitecture_None:
     587                RT_FALL_THROUGH();
     588            default:
     589                break;
     590        }
     591    }
    574592}
    575593
     
    675693
    676694    HRESULT hrc = S_OK;
    677 
    678      /** @todo BUGBUG We only support ARM VMs on ARM hosts for now.
    679       *               Remove this limitation once we have support for FE/Qt and x86-on-ARM support. */
    680 #if defined(RT_ARCH_ARM32) || defined(RT_ARCH_ARM64)
    681     m->bd->architectureType = PlatformArchitecture_ARM;
    682 #else
    683     m->bd->architectureType = aArchitecture;
    684 #endif
    685695
    686696    /* Currently we only keep the current platform-specific object around,
     
    728738#endif
    729739        default:
    730             AssertFailedStmt(hrc = VBOX_E_PLATFORM_ARCH_NOT_SUPPORTED);
     740            hrc = VBOX_E_PLATFORM_ARCH_NOT_SUPPORTED;
    731741            break;
    732742    }
     
    796806            break;
    797807
     808#ifdef VBOX_WITH_VIRT_ARMV8
    798809        case PlatformArchitecture_ARM:
    799             AssertFailed(); /** @todo BUGBUG Implement this! */
    800             break;
    801 
     810            /** @todo BUGBUG Implement this! */
     811            break;
     812#endif
    802813        case PlatformArchitecture_None:
    803814            RT_FALL_THROUGH();
  • trunk/src/VBox/Main/src-server/PlatformX86Impl.cpp

    r101052 r101054  
    181181{
    182182    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    183     m->bd.rollback();
     183    if (m)
     184        m->bd.rollback();
    184185}
    185186
  • trunk/src/VBox/Main/xml/Settings.cpp

    r101050 r101054  
    54075407#endif
    54085408        default:
    5409             AssertFailed();
    54105409            break;
    54115410    }
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