VirtualBox

Changeset 101461 in vbox


Ignore:
Timestamp:
Oct 17, 2023 8:37:28 AM (15 months ago)
Author:
vboxsync
Message:

Main: Allow creation of x86 VMs (based on guest OS type or the set architecture) on non-x86 hosts. bugref:10384

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigX86.cpp

    r101459 r101461  
    483483    hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam());           H();
    484484
     485    PlatformArchitecture_T platformArchHost;
     486    hrc = host->COMGETTER(Architecture)(&platformArchHost);                                 H();
     487
    485488    ComPtr<IFirmwareSettings> firmwareSettings;
    486489    hrc = pMachine->COMGETTER(FirmwareSettings)(firmwareSettings.asOutParam());             H();
     
    517520    ComPtr<IPlatform> platform;
    518521    pMachine->COMGETTER(Platform)(platform.asOutParam());                                   H();
     522
     523#if 1 /* For now we only support running same-same architectures (e.g. x86 VMs on x86 hosts). */
     524    PlatformArchitecture_T platformArchMachine;
     525    hrc = platform->COMGETTER(Architecture)(&platformArchMachine);                          H();
     526    if (platformArchMachine != platformArchHost)
     527        return pVMM->pfnVMR3SetError(pUVM, VERR_PLATFORM_ARCH_NOT_SUPPORTED, RT_SRC_POS,
     528                                     N_("VM platform architecture (%s) not supported on this host (%s)."),
     529                                     Global::stringifyPlatformArchitecture(platformArchMachine),
     530                                     Global::stringifyPlatformArchitecture(platformArchHost));
     531#endif
    519532
    520533    ChipsetType_T chipsetType;
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r101374 r101461  
    317317 *  @param strName              Name for the machine.
    318318 *  @param aArchitecture        Architecture to use for the machine.
     319 *                              If a valid guest OS type is set via @aOsType, the guest OS' type will be used instead then.
    319320 *  @param llGroups             list of groups for the machine.
    320321 *  @param strOsType            OS Type string (stored as is if aOsType is NULL).
     
    460461        AssertComRC(hrc);
    461462
     463        /* Use the platform architecture which was handed-in by default. */
     464        PlatformArchitecture_T enmPlatformArch = aArchitecture;
     465
    462466        if (aOsType)
    463467        {
    464468            /* Store OS type */
    465469            mUserData->s.strOsType = aOsType->i_id();
     470
     471            /* Use the platform architecture of the found guest OS type. */
     472            enmPlatformArch = aOsType->i_platformArchitecture();
    466473        }
    467474        else if (!strOsType.isEmpty())
     
    472479
    473480        /* Set the platform architecture first before applying the defaults below. */
    474         hrc = mPlatform->i_initArchitecture(aArchitecture);
     481        hrc = mPlatform->i_initArchitecture(enmPlatformArch);
    475482        if (FAILED(hrc)) return hrc;
    476483
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r101318 r101461  
    22402240                     aSettingsFile.c_str(), aName.c_str(), aArchitecture, aOsTypeId.c_str(), aFlags.c_str()));
    22412241
    2242 #if 1
    2243     /**
    2244      * We only allow same-same platform architectures (x86 VMs for x86 hosts, for instance) for now.
    2245      *
    2246      * This might change in the future, but for now we simply overwrite the architecture the caller handed-in
    2247      * with the host architecture.
    2248      */
    2249     aArchitecture = PlatformProperties::s_getHostPlatformArchitecture();
    2250 #endif
    2251 
    22522242    StringsList llGroups;
    22532243    HRESULT hrc = i_convertMachineGroups(aGroups, &llGroups);
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