ConsoleImpl2.cpp revision d1d4bf58f99da14d0aaa7bcc728a359c8a7eb7bd
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * VBox Console COM Class implementation
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @remark We've split out the code that the 64-bit VC++ v8 compiler finds
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * problematic to optimize so we can disable optimizations and later,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * perhaps, find a real solution for it (like rewriting the code and
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * to stop resemble a tonne of spaghetti).
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Copyright (C) 2006-2010 Oracle Corporation
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * available from http://www.virtualbox.org. This file is free software;
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * you can redistribute it and/or modify it under the terms of the GNU
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * General Public License (GPL) as published by the Free Software
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/*******************************************************************************
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync* Header Files *
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync*******************************************************************************/
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync// for some reason Windows burns in sdk\...\winsock.h if this isn't included first
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync// generated header
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#if 0 /* enable to play with lots of memory. */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync#include <VBox/vmm/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync# include "HGCM.h" /** @todo it should be possible to register a service
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * extension using a VMMDev callback. */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync#endif /* VBOX_WITH_GUEST_PROPS */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#endif /* VBOX_WITH_NETFLT */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncstatic int DarwinSmcKey(char *pabKey, uint32_t cbKey)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Method as described in Amit Singh's article:
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * http://osxbook.com/book/bonus/chapter7/tpmdrmmyth/
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync typedef struct
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AppleSMCBuffer inputStruct = { 0, {0}, 32, {0}, 5, };
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync for (int i = 0; i < 2; i++)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync inputStruct.key = (uint32_t)((i == 0) ? 'OSK0' : 'OSK1');
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync (const void *)&inputStruct,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync for (int j = 0; j < 32; j++)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#endif /* RT_OS_DARWIN */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/* Darwin compile kludge */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/* Comment out the following line to remove VMWare compatibility hack. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Translate IDE StorageControllerType_T to string representation.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncconst char* controllerString(StorageControllerType_T enmType)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync return "PIIX3";
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync return "PIIX4";
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync return "ICH6";
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync return "Unknown";
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Simple class for storing network boot information.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync ULONG lval = mBootPrio - 1; /* 0 will wrap around and get the lowest priority. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync return lval < rval; /* Zero compares as highest number (lowest prio). */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncstatic int findEfiRom(IVirtualBox* vbox, FirmwareType_T aFirmwareType, Utf8Str *pEfiRomFile)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync HRESULT hrc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(),
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync empty.asOutParam(), aFilePath.asOutParam(), &fPresent);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AssertComRCReturn(hrc, Global::vboxStatusCodeFromCOM(hrc));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncstatic int getSmcDeviceKey(IMachine *pMachine, BSTR *aKey, bool *pfGetKeyFromRealSMC)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * The extra data takes precedence (if non-zero).
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync HRESULT hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/SmcDeviceKey").raw(),
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Query it here and now.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync LogRel(("Warning: DarwinSmcKey failed with rc=%Rrc!\n", rc));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Is it apple hardware in bootcamp?
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /** @todo implement + test RTSYSDMISTR_MANUFACTURER on all hosts.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Currently falling back on the product name. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync RTSystemQueryDmiString(RTSYSDMISTR_MANUFACTURER, szManufacturer, sizeof(szManufacturer));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync if ( !strcmp(szManufacturer, "Apple Computer, Inc.")
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync RTSystemQueryDmiString(RTSYSDMISTR_PRODUCT_NAME, szProdName, sizeof(szProdName));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync && RT_C_IS_DIGIT(szProdName[strlen(szProdName) - 1]) /* version number */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * VC++ 8 / amd64 has some serious trouble with the next functions.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * As a temporary measure, we'll drop global optimizations.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync const char *pcszName)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync : iprt::Error(Utf8StrFmt("%s failed: rc=%Rrc, pcszName=%s", pcszFunction, vrc, pcszName)),
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AssertMsgFailed(("%s\n", what())); // in strict mode, hit a breakpoint here
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * fails (C-string variant).
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param pParent See CFGMR3InsertStringN.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param pcszNodeName See CFGMR3InsertStringN.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param pcszValue The string value.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync const char *pcszName,
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync throw ConfigError("CFGMR3InsertString", vrc, pcszName);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * fails (Utf8Str variant).
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param pParent See CFGMR3InsertStringN.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param pcszNodeName See CFGMR3InsertStringN.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * @param rStrValue The string value.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync throw ConfigError("CFGMR3InsertStringLengthKnown", vrc, pcszName);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * fails (Bstr variant).
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pParent See CFGMR3InsertStringN.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pcszNodeName See CFGMR3InsertStringN.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param rBstrValue The string value.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pNode, pcszName, Utf8Str(rBstrValue));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Helper that calls CFGMR3InsertBytes and throws an iprt::Error if that fails.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pNode See CFGMR3InsertBytes.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pcszName See CFGMR3InsertBytes.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pvBytes See CFGMR3InsertBytes.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param cbBytes See CFGMR3InsertBytes.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const void *pvBytes,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync throw ConfigError("CFGMR3InsertBytes", vrc, pcszName);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Helper that calls CFGMR3InsertInteger and throws an iprt::Error if that
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pNode See CFGMR3InsertInteger.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pcszName See CFGMR3InsertInteger.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param u64Integer See CFGMR3InsertInteger.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync throw ConfigError("CFGMR3InsertInteger", vrc, pcszName);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Helper that calls CFGMR3InsertNode and throws an iprt::Error if that fails.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pNode See CFGMR3InsertNode.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pcszName See CFGMR3InsertNode.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param ppChild See CFGMR3InsertNode.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync int vrc = CFGMR3InsertNode(pNode, pcszName, ppChild);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync throw ConfigError("CFGMR3InsertNode", vrc, pcszName);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Helper that calls CFGMR3RemoveValue and throws an iprt::Error if that fails.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pNode See CFGMR3RemoveValue.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pcszName See CFGMR3RemoveValue.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pcszName)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync throw ConfigError("CFGMR3RemoveValue", vrc, pcszName);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncstatic HRESULT attachRawPciDevices(BusAssignmentManager* BusMgr,
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = aMachine->COMGETTER(PciDeviceAssignments)(ComSafeArrayAsOutParam(assignments));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync for (size_t iDev = 0; iDev < assignments.size(); iDev++)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync ComPtr<IPciDeviceAttachment> assignment = assignments[iDev];
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync assignment->COMGETTER(Name)(aDevName.asOutParam());
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigNode(pDev, Utf8StrFmt("%d", iDev).c_str(), &pInst);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "HostPCIBusNo", HostPciAddress.iBus);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "HostPCIDeviceNo", HostPciAddress.iDevice);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "HostPCIFunctionNo", HostPciAddress.iFn);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = BusMgr->assignPciDevice("pciraw", pInst, GuestPciAddress, true);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "GuestPCIBusNo", GuestPciAddress.iBus);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "GuestPCIDeviceNo", GuestPciAddress.iDevice);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "GuestPCIFunctionNo", GuestPciAddress.iFn);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* the Main driver */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pLunL0, "Driver", "PciRawMain");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pMainDev);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Construct the VM configuration tree (CFGM).
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * This is a callback for VMR3Create() call. It is called from CFGMR3Init()
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * in the emulation thread (EMT). Any per thread COM/XPCOM initialization
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * is done here.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pVM VM handle.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pvConsole Pointer to the VMPowerUpTask object.
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * @return VBox status code.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @note Locks the Console object for writing.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncDECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* initialize COM */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync LogFlow(("Console::configConstructor(): CoInitializeEx()=%08X\n", hrc));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync ComObjPtr<Console> pConsole = static_cast<Console *>(pvConsole);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AssertComRCReturn(autoCaller.rc(), VERR_ACCESS_DENIED);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* lock the console because we widely use internal fields and methods */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AutoWriteLock alock(pConsole COMMA_LOCKVAL_SRC_POS);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Set the VM handle and do the rest of the job in an worker method so we
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * can easily reset the VM handle on failure.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync int vrc = pConsole->configConstructorInner(pVM, &alock);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Worker for configConstructor.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @return VBox status code.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @param pVM The VM handle.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsyncint Console::configConstructorInner(PVM pVM, AutoWriteLock *pAlock)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#define H() AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_GENERAL_FAILURE)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Get necessary objects and frequently used parameters.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(MemorySize)(&cRamMBs); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#if 0 /* enable to play with lots of memory. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync cRamMBs = RTStrToUInt64(RTEnvGet("VBOX_RAM_SIZE"));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* We'd better have 0x10000000 region, to cover 256 buses
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync but this put too much load on hypervisor heap */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync BusAssignmentManager* BusMgr = mBusMgr = BusAssignmentManager::createInstance(chipsetType);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS");
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Get root node first.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * This is the only node in the tree.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync // InsertConfigString throws
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Set the root (and VMM) level values.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigBytes(pRoot, "UUID", &HardwareUuid, sizeof(HardwareUuid));
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "RamHoleSize", cbRamHole);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "CpuExecutionCap", ulCpuExecutionCap);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "RawR3Enabled", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "RawR0Enabled", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /** @todo Config: RawR0, PATMEnabled and CSAMEnabled needs attention later. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "PATMEnabled", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "CSAMEnabled", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Not necessary, but to make sure these two settings end up in the release log. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->COMGETTER(PageFusionEnabled)(&fPageFusion); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "PageFusion", fPageFusion); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->COMGETTER(MemoryBalloonSize)(&ulBalloonSize); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "MemBalloonSize", ulBalloonSize);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * CPUM values.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* cpuid leaf overrides. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync for (uint32_t uLeaf = s_auCpuIdRanges[i]; uLeaf < s_auCpuIdRanges[i + 1]; uLeaf++)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetCPUIDLeaf(uLeaf, &ulEax, &ulEbx, &ulEcx, &ulEdx);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigNode(pCPUM, Utf8StrFmt("HostCPUID/%RX32", uLeaf).c_str(), &pLeaf);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* We must limit CPUID count for Windows NT 4, as otherwise it stops
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync with error 0x3e (MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED). */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync LogRel(("Limiting CPUID leaf count for NT4 guests\n"));
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Expose extended MWAIT features to Mac OS X guests. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCPUM, "MWaitExtensions", true);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Hardware virtualization extensions.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &fHWVirtExEnabled); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync if (cCpus > 1) /** @todo SMP: This isn't nice, but things won't work on mac otherwise. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* - With more than 4GB PGM will use different RAMRANGE sizes for raw
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync mode and hv mode to optimize lookup times.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync - With more than one virtual CPU, raw-mode isn't a fallback option. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync#else /* !VBOX_WITH_RAW_MODE */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync#endif /* !VBOX_WITH_RAW_MODE */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* only honor the property value if there was no other reason to enable it */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Force, &fHwVirtExtForced); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pRoot, "HwVirtExtForced", fHwVirtExtForced);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * MM values.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pMM, "CanUseLargerHeap", chipsetType == ChipsetType_ICH9);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Hardware virtualization settings.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Indicate whether 64-bit guests are supported or not. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /** @todo This is currently only forced off on 32-bit hosts only because it
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * makes a lof of difference there (REM and Solaris performance).
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = host->GetProcessorFeature(ProcessorFeature_LongMode,
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = guestOSType->COMGETTER(Is64Bit)(&fIsGuest64Bit); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pHWVirtExt, "64bitEnabled", 1);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync#if ARCH_BITS == 32 /* The recompiler must use VBoxREM64 (32-bit host only). */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pHWVirtExt, "64bitEnabled", 0);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /** @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Only allow TPR patching for NT, Win2k, XP and Windows Server 2003. (32 bits mode)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * We may want to consider adding more guest OSes (Solaris) later on.
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pHWVirtExt, "TPRPatchingEnabled", 1);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* HWVirtEx exclusive mode */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &fHWVirtExExclusive); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pHWVirtExt, "Exclusive", fHWVirtExExclusive);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Nested paging (VT-x/AMD-V) */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &fEnableNestedPaging); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pHWVirtExt, "EnableNestedPaging", fEnableNestedPaging);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Large pages; requires nested paging */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &fEnableLargePages); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pHWVirtExt, "EnableLargePages", fEnableLargePages);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* VPID (VT-x) */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &fEnableVPID); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pHWVirtExt, "EnableVPID", fEnableVPID);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Physical Address Extension (PAE) */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Synthetic CPU */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetCPUProperty(CPUPropertyType_Synthetic, &fSyntheticCpu); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCPUM, "SyntheticCpu", fSyntheticCpu);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * PDM config.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Load drivers in VBoxC.[so|dll]
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync // VBoxC is located in the components subdirectory
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync rc = RTPathAppPrivateArch(szPathVBoxC, RTPATH_MAX - sizeof("/components/VBoxC")); AssertRC(rc);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Block cache settings.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* I/O cache size */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(IoCacheSize)(&ioCacheSize); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pPDMBlkCache, "CacheSize", ioCacheSize * _1M);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Bandwidth groups.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(BandwidthControl)(bwCtrl.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = bwCtrl->GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)); H();
66a94fee6b0acc21c078369f49d97020cc03ab11vboxsync InsertConfigNode(pAcFile, "BwGroups", &pAcFileBwGroups);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = bwGroups[i]->COMGETTER(Name)(strName.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = bwGroups[i]->COMGETTER(MaxMbPerSec)(&cMaxMbPerSec); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigNode(pAcFileBwGroups, Utf8Str(strName).c_str(), &pBwGroup);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBwGroup, "Max", cMaxMbPerSec * _1M);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBwGroup, "Start", cMaxMbPerSec * _1M);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync PCFGMNODE pCfg = NULL; /* /Devices/Dev/.../Config/ */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync PCFGMNODE pLunL0 = NULL; /* /Devices/Dev/0/LUN#0/ */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync PCFGMNODE pLunL1 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/ */
66a94fee6b0acc21c078369f49d97020cc03ab11vboxsync PCFGMNODE pLunL2 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/Config/ */
66a94fee6b0acc21c078369f49d97020cc03ab11vboxsync PCFGMNODE pBiosCfg = NULL; /* /Devices/pcbios/0/Config/ */
66a94fee6b0acc21c078369f49d97020cc03ab11vboxsync PCFGMNODE pNetBootCfg = NULL; /* /Devices/pcbios/0/Config/NetBoot/ */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * The time offset
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = biosSettings->COMGETTER(TimeOffset)(&timeOffset); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pTMNode, "UTCOffset", timeOffset * 1000000);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * PCI buses.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync uIocPciAddress = (0x1 << 16) | 0; // ISA controller
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync uIocPciAddress = (0x1f << 16) | 0; // LPC controller
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Provide MCFG info */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "McfgLength", cbMcfgLength);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* And register 2 bridges */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigNode(pDevices, "ich9pcibridge", &pDev);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Add PCI passthrough devices */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = attachRawPciDevices(BusMgr, pDevices, this); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Enable 3 following devices: HPET, SMC, LPC on MacOS X guests or on ICH9 chipset
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * High Precision Event Timer (HPET)
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync /* Other guests may wish to use HPET too, but MacOS X not functional without it */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(HpetEnabled)(&fHpetEnabled); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* so always enable HPET in extended profile */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* HPET is always present on ICH9 */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * System Management Controller (SMC)
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync rc = getSmcDeviceKey(pMachine, bstrKey.asOutParam(), &fGetKeyFromRealSMC);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "GetKeyFromRealSMC", fGetKeyFromRealSMC);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * Low Pin Count (LPC) bus
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /** @todo: implement appropriate getter */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync fLpcEnabled = fOsXGuest || (chipsetType == ChipsetType_ICH9);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync fShowRtc = fOsXGuest || (chipsetType == ChipsetType_ICH9);
8238dbee2b0c21592e6af0fafcdb2e56cf3a791cvboxsync * PS/2 keyboard & mouse.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigString(pLunL0, "Driver", "KeyboardQueue");
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pLunL1, "Driver", "MainKeyboard");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pLunL0, "Driver", "MouseQueue");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * i8254 Programmable Interval Timer And Dummy Speaker
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * i8259 Programmable Interrupt Controller.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Advanced Programmable Interrupt Controller.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * SMP: Each CPU has a LAPIC, but we have a single device representing all LAPICs states,
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * thus only single insert
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * I/O Advanced Programmable Interrupt Controller.
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * RTC MC146818.
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = pMachine->COMGETTER(RTCUseUTC)(&fRTCUseUTC); H();
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "UseUTC", fRTCUseUTC ? 1 : 0);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = pMachine->COMGETTER(VRAMSize)(&cVRamMBs); H();
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "VRamSize", cVRamMBs * _1M);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = pMachine->COMGETTER(MonitorCount)(&cMonitorCount); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "MonitorCount", cMonitorCount);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "R0Enabled", fHWVirtExEnabled);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * BIOS logo
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn); H();
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "FadeIn", fFadeIn ? 1 : 0);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "FadeOut", fFadeOut ? 1: 0);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "LogoTime", logoDisplayTime);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigString(pCfg, "LogoFile", Utf8Str(!logoImagePath.isEmpty() ? logoImagePath : "") );
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync * Boot menu
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync biosSettings->COMGETTER(BootMenuMode)(&eBootMenuMode);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync case BIOSBootMenuMode_Disabled: iShowBootMenu = 0; break;
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync case BIOSBootMenuMode_MenuOnly: iShowBootMenu = 1; break;
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "ShowBootMenu", iShowBootMenu);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync /* Custom VESA mode list */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync unsigned cModes = 0;
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync RTStrPrintf(szExtraDataKey, sizeof(szExtraDataKey), "CustomVideoMode%u", iMode);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = pMachine->GetExtraData(Bstr(szExtraDataKey).raw(), bstr.asOutParam()); H();
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pCfg, "CustomVideoModes", cModes);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* VESA height reduction */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pFramebuffer->COMGETTER(HeightReduction)(&ulHeightReduction); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* If framebuffer is not available, there is no height reduction. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "HeightReduction", ulHeightReduction);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Attach the display. */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigString(pLunL0, "Driver", "MainDisplay");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pDisplay);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Firmware.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = pMachine->COMGETTER(FirmwareType)(&eFwType); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync BOOL fEfiEnabled = (eFwType >= FirmwareType_EFI) && (eFwType <= FirmwareType_EFIDUAL);
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBiosCfg, "RamHoleSize", cbRamHole);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pBiosCfg, "HardDiskDevice", "piix3ide");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pBiosCfg, "FloppyDevice", "i82078");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBiosCfg, "PXEDebug", fPXEDebug);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigBytes(pBiosCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigNode(pBiosCfg, "NetBoot", &pNetBootCfg);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBiosCfg, "McfgBase", uMcfgBase);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pBiosCfg, "McfgLength", cbMcfgLength);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetBootOrder(pos, &bootDevice); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync szParamName[sizeof(szParamName) - 2] = ((char (pos - 1)) + '0');
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync AssertMsgFailed(("Invalid bootDevice=%d\n", bootDevice));
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigString(pBiosCfg, szParamName, pszBootDevice);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Autodetect firmware type, basing on guest type */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync bool const f64BitEntry = eFwType == FirmwareType_EFI64;
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Get boot args */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiBootArgs").raw(), bootArgs.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Get device props */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps").raw(), deviceProps.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* Get GOP mode settings */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode").raw(), bstr.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* UGA mode settings */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution").raw(), bstr.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution").raw(), bstr.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * EFI subtree.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "RamHoleSize", cbRamHole);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigString(pCfg, "DeviceProps", deviceProps);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigBytes(pCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid));
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "64BitEntry", f64BitEntry); /* boolean */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "UgaHorizontalResolution", u32UgaHorisontal);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "UgaVerticalResolution", u32UgaVertical);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* For OS X guests we'll force passing host's DMI info to the guest */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "DmiExposeMemoryTable", 1);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Storage controllers.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync PCFGMNODE aCtrlNodes[StorageControllerType_LsiLogicSas + 1] = {};
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync hrc = pMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls)); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync bool fFdcEnabled = false;
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync rc = ctrls[i]->COMGETTER(ControllerType)(&enmCtrlType); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes));
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync rc = ctrls[i]->COMGETTER(Name)(controllerName.asOutParam()); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync rc = ctrls[i]->COMGETTER(Instance)(&ulInstance); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync rc = ctrls[i]->COMGETTER(UseHostIOCache)(&fUseHostIOCache); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync rc = ctrls[i]->COMGETTER(Bootable)(&fBootable); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* /Devices/<ctrldev>/ */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync const char *pszCtrlDev = convertControllerTypeToDev(enmCtrlType);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* /Devices/<ctrldev>/<instance>/ */
ddd5bf03356cc0515b0f42ed9048a6364e7eb1e2vboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Attach the status driver */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedScsi]);
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync hrc = BusMgr->assignPciDevice("buslogic", pCtlInst); H();
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /* Attach the status driver */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedScsi]);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice("ahci", pCtlInst); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = ctrls[i]->COMGETTER(PortCount)(&cPorts); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Needed configuration values for the bios, only first controller. */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pBiosCfg, "SataHardDiskDevice", "ahci");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" };
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync { "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = ctrls[i]->GetIDEEmulationPort(j, &lPortNumber); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, s_apszConfig[j], lPortNumber);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pBiosCfg, s_apszBiosConfig[j], lPortNumber);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Attach the status driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedSata]);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * IDE (update this when the main interface changes)
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice("piix3ide", pCtlInst); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pCfg, "Type", controllerString(enmCtrlType));
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Attach the status driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedIde]);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* IDE flavors */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * i82078 Floppy drive controller
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Attach the status driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedFloppy]);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice("lsilogicsas", pCtlInst); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pCfg, "ControllerType", "SAS1068");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Attach the status driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedSas]);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync AssertMsgFailedReturn(("invalid storage controller type: %d\n", enmCtrlType), VERR_GENERAL_FAILURE);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Attach the media to the storage controllers. */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = pMachine->GetMediumAttachmentsOfController(controllerName.raw(),
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Builtin I/O cache - per device setting. */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = pMachine->COMGETTER(IoCacheEnabled)(&fBuiltinIoCache); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync false /* fSetupMerge */,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync 0 /* uMergeSource */,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync 0 /* uMergeTarget */,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync false /* fAttachDetach */,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync false /* fForceUnmount */,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * Network adapters
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync PCFGMNODE pDevPCNet = NULL; /* PCNet-type devices */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync PCFGMNODE pDevE1000 = NULL; /* E1000-type devices */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync PCFGMNODE pDevVirtioNet = NULL; /* Virtio network devices */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigNode(pDevices, "virtio-net", &pDevVirtioNet);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync#endif /* VBOX_WITH_VIRTIO */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::NetworkAdapterCount; ++ulInstance)
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync hrc = pMachine->GetNetworkAdapter(ulInstance, networkAdapter.asOutParam()); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = networkAdapter->COMGETTER(Enabled)(&fEnabled); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * The virtual hardware type. Create appropriate device first.
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = networkAdapter->COMGETTER(AdapterType)(&adapterType); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync#endif /* VBOX_WITH_VIRTIO */
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync AssertMsgFailed(("Invalid network adapter type '%d' for slot '%d'",
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync N_("Invalid network adapter type '%d' for slot '%d'"),
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* the first network card gets the PCI ID 3, the next 3 gets 8..10,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * next 4 get 16..19. */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* auto assignment */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * Dirty hack for PCI slot compatibility with VMWare,
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * it assigns slot 11 to the first network controller.
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync if (iPciDeviceNo == 3 && adapterType == NetworkAdapterType_I82545EM)
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync PciBusAddress PciAddr = PciBusAddress(0, iPciDeviceNo, 0);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync * Collect information needed for network booting and add it to the list.
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Could be updated by reference, if auto assigned */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * The virtual hardware type. PCNet supports two types.
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync * Get the MAC address and convert it to binary representation
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = networkAdapter->COMGETTER(MACAddress)(macAddr.asOutParam()); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync * Check if the cable is supposed to be unplugged
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync hrc = networkAdapter->COMGETTER(CableConnected)(&fCableConnected); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync InsertConfigInteger(pCfg, "CableConnected", fCableConnected ? 1 : 0);
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync * Line speed to report from custom drivers
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync hrc = networkAdapter->COMGETTER(LineSpeed)(&ulLineSpeed); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pCfg, "LineSpeed", ulLineSpeed);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * Attach the status driver.
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapNetworkLeds[ulInstance]);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Configure the network card now
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync bool fIgnoreConnectFailure = mMachineState == MachineState_Restoring;
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync false /*fAttachDetach*/,
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync * Build network boot information and transfer it to the BIOS.
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync if (pNetBootCfg && !llBootNics.empty()) /* NetBoot node doesn't exist for EFI! */
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync llBootNics.sort(); /* Sort the list by boot priority. */
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync unsigned uBootIdx = 0;
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync for (std::list<BootNic>::iterator it = llBootNics.begin(); it != llBootNics.end(); ++it)
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* A NIC with priority 0 is only used if it's first in the list. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync achBootIdx[0] = '0' + uBootIdx++; /* Boot device order. */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pNetBtDevCfg, "NIC", it->mInstance);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pNetBtDevCfg, "PCIBusNo", it->mPciAddress.iBus);
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync InsertConfigInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciAddress.iDevice);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciAddress.iFn);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Serial (UART) Ports
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync /* serial enabled mask to be passed to dev ACPI */
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync uint16_t auSerialIoPortBase[SchemaDefs::SerialPortCount] = {0};
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync uint8_t auSerialIrq[SchemaDefs::SerialPortCount] = {0};
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::SerialPortCount; ++ulInstance)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetSerialPort(ulInstance, serialPort.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = serialPort->COMGETTER(Enabled)(&fEnabled); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = serialPort->COMGETTER(IOBase)(&ulIOBase); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync auSerialIoPortBase[ulInstance] = (uint16_t)ulIOBase;
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = serialPort->COMGETTER(Server)(&fServer); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = serialPort->COMGETTER(Path)(bstr.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = serialPort->COMGETTER(HostMode)(&eHostMode); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigString(pLunL0, "Driver", "Host Serial");
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync * Parallel (LPT) Ports
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::ParallelPortCount; ++ulInstance)
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = pMachine->GetParallelPort(ulInstance, parallelPort.asOutParam()); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = parallelPort->COMGETTER(Enabled)(&fEnabled); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync hrc = parallelPort->COMGETTER(IOBase)(&ulIOBase); H();
6902a98267d5180fb081cb5273751d0a628bf04dvboxsync InsertConfigString(pLunL0, "Driver", "HostParallel");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = parallelPort->COMGETTER(Path)(bstr.asOutParam()); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * VMM Device
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice("VMMDev", pInst); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam()); H();
1ede9a25697f3a01a4362525e84330a7940b508fvboxsync if (hwVersion.compare(Bstr("1").raw()) == 0) /* <= 2.0.x */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = pMachine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam()); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pCfg, "GuestCoreDumpDir", snapshotFolder);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* the VMM device's Main driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pVMMDev);
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync * Attach the status driver.
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapSharedFolderLed);
5060d2375aca9a234bf38465a6502e9eb454a2c5vboxsync * Audio Sniffer Device
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* the Audio Sniffer device's Main driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pLunL0, "Driver", "MainAudioSniffer");
8be5264d31d6a6ec949ff2285764c9af57298b52vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pAudioSniffer);
8be5264d31d6a6ec949ff2285764c9af57298b52vboxsync * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio
8be5264d31d6a6ec949ff2285764c9af57298b52vboxsync hrc = pMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); H();
8be5264d31d6a6ec949ff2285764c9af57298b52vboxsync hrc = audioAdapter->COMGETTER(Enabled)(&fAudioEnabled); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = audioAdapter->COMGETTER(AudioController)(&audioController); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* default: ICH AC97 */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = BusMgr->assignPciDevice("ichac97", pInst); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* legacy SoundBlaster16 */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* Intel HD Audio */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* the Audio driver */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync hrc = audioAdapter->COMGETTER(AudioDriver)(&audioDriver); H();
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync#endif /* RT_OS_WINDOWS */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync InsertConfigString(pCfg, "AudioDriver", "solaudio");
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
case AudioDriverType_ALSA:
# ifdef VBOX_WITH_PULSE
case AudioDriverType_Pulse:
case AudioDriverType_OSS:
#ifdef RT_OS_FREEBSD
# ifdef VBOX_WITH_PULSE
case AudioDriverType_Pulse:
#ifdef RT_OS_DARWIN
if (USBCtlPtr)
if (fOhciEnabled)
#ifdef VBOX_WITH_EHCI
if (fEhciEnabled)
# ifdef VBOX_WITH_EXTPACK
# ifdef VBOX_WITH_EXTPACK
#ifdef VBOX_WITH_USB
// VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1
switch (mode)
case ClipboardMode_Disabled:
#ifdef VBOX_WITH_CROGL
if (fEnabled)
rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_CONSOLE, SHCRGL_CPARMS_SET_CONSOLE, &parm);
rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_VM, SHCRGL_CPARMS_SET_VM, &parm);
#ifdef VBOX_WITH_GUEST_PROPS
#ifdef VBOX_WITH_GUEST_CONTROL
if (fACPI)
fShowCpu = true;
if (fCpuHotPlug)
if (fCpuAttached)
catch (ConfigError &x)
return x.m_vrc;
#ifdef VBOX_WITH_EXTPACK
#undef H
return rc;
* Applies the CFGM overlay as specified by /VBoxInternal/XXX extra data
if (pszCFGMValueName)
if (pNode)
AssertLogRelMsgRCBreak(rc, ("failed to insert CFGM value '%s' to key '%s'\n", strCFGMValueUtf8.c_str(), pszExtraDataKey));
catch (ConfigError &x)
return x.m_vrc;
return rc;
void Console::setVMRuntimeErrorCallbackF(PVM pVM, void *pvConsole, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
const char *pcszDevice,
unsigned uInstance,
bool fUseHostIOCache,
bool fBuiltinIoCache,
bool fSetupMerge,
unsigned uMergeSource,
unsigned uMergeTarget,
bool fAttachDetach,
bool fForceUnmount,
unsigned uLUN;
if (pLunL0)
if (fAttachDetach)
return rc;
mfSnapshotFolderDiskTypeShown = true;
#ifdef RT_OS_WINDOWS
const char *pszUnit;
&& maxSize > 0
const char *pszUnitSiz;
const char *pszUnitMax;
const char *pszUnit;
#ifdef RT_OS_WINDOWS
mfSnapshotFolderSizeWarningShown = true;
#ifdef RT_OS_LINUX
&& !fUseHostIOCache
fUseHostIOCache = true;
fUseHostIOCache = true;
mfSnapshotFolderExt4WarningShown = true;
!!fPassthrough,
phrc);
return rc;
if (fAttachDetach)
if (paLedDevType)
catch (ConfigError &x)
return x.m_vrc;
#undef H
return VINF_SUCCESS;;
bool fPassthrough,
bool fUseHostIOCache,
bool fBuiltinIoCache,
bool fSetupMerge,
unsigned uMergeSource,
unsigned uMergeTarget,
const char *pcszBwGroup,
AssertMsgReturnStmt(SUCCEEDED(hrc), ("hrc=%Rhrc\n", hrc), if (phrc) *phrc = hrc, Global::vboxStatusCodeFromCOM(hrc))
if (pMedium)
if (fHostDrive)
switch (enmType)
case DeviceType_DVD:
case DeviceType_Floppy:
case DeviceType_HardDisk:
if ( pMedium
"The image file '%ls' is inaccessible and is being ignored. Please select a different image file for the virtual %s drive.",
if (pMedium)
unsigned uImage = 0;
while (pTmp)
uImage++;
uImage--;
if (!fUseHostIOCache)
if ( fBuiltinIoCache
if (fSetupMerge)
switch (enmType)
case DeviceType_DVD:
case DeviceType_Floppy:
case DeviceType_HardDisk:
if (pcszBwGroup)
bool fHostIP = true;
fHostIP = false;
uImage--;
if (!pMedium)
if (fSetupMerge)
fHostIP = false;
if (!fHostIP)
#undef H
catch (ConfigError &x)
return x.m_vrc;
return VINF_SUCCESS;
unsigned uInstance,
unsigned uLun,
bool fAttachDetach,
bool fIgnoreConnectFailure)
if (pLunAD)
switch (eAttachmentType)
if (fSniffer)
InsertConfigString(pCfg, "TFTPPrefix", Utf8StrFmt("%ls%c%s", bstr.raw(), RTPATH_DELIMITER, "TFTP"));
if (mtu)
if (sockRcv)
if (sockSnd)
if (tcpRcv)
if (tcpSnd)
bool fValid = true;
switch (proto)
case NATProtocol_UDP:
case NATProtocol_TCP:
fValid = false;
if (!fValid)
if (port)
if (port)
switch (hrc)
case VERR_ACCESS_DENIED:
if (fSniffer)
if (fSniffer)
# if defined(RT_OS_DARWIN)
if (!pszColon)
if (pszSpace)
if (pszColon)
AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: FindByName failed, rc=%Rhrc (0x%x)", hrc, hrc));
&pNc,
&pszApp);
hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(), pAdaptorComponent.asOutParam());
wchar_t * pswzBindName;
AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n", hrc, hrc, err));
AssertFailed();
AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc));
/* we're not releasing the INetCfg stuff here since we use it later to figure out whether it is wireless */
# if defined(RT_OS_FREEBSD)
switch (hrc)
case VERR_ACCESS_DENIED:
"permissions of that node, and that the net.link.tap.user_open "
if (iSock >= 0)
# if defined(RT_OS_DARWIN)
/** @todo Come up with a better deal here. Problem is that IHostNetworkInterface is completely useless here. */
if (iSock >= 0)
if (fSharedMacOnWire)
if (iSock >= 0)
if (fSharedMacOnWire)
NULL,
NULL);
bool fSharedMacOnWire = false;
&Oid,
sizeof(Oid),
&PhMedium,
sizeof(PhMedium),
&cbResult,
NULL))
fSharedMacOnWire = true;
Assert(winEr == ERROR_INVALID_PARAMETER || winEr == ERROR_NOT_SUPPORTED || winEr == ERROR_BAD_COMMAND);
if (fSharedMacOnWire)
AssertLogRelMsgFailed(("Console::configNetwork: CreateFile failed, err (0x%x), ignoring\n", winEr));
# if defined(RT_OS_SOLARIS)
if (fSniffer)
if (fSniffer)
#if defined(RT_OS_WINDOWS)
# ifndef VBOX_WITH_NETFLT
&pNc,
&pszApp);
hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(), pAdaptorComponent.asOutParam());
LogRel(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc=%Rhrc (0x%x)\n", hrc, hrc));
wchar_t * pswzBindName;
AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n", hrc, hrc, err));
AssertFailed();
AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc=%Rhrc (0x%x)\n", hrc, hrc));
/* Grab the IP number from the 'vboxnetX' instance number (see netif.h) */
#if defined(VBOX_WITH_VDE)
switch (eAttachmentType)
#if defined(VBOX_WITH_VDE)
if (fAttachDetach)
if (fEnabled)
catch (ConfigError &x)
return x.m_vrc;
#undef H
return VINF_SUCCESS;
#ifdef VBOX_WITH_GUEST_PROPS
void *names,
void *values,
void *timestamps,
void *flags)
&parms[0]);
const char *pszName,
const char *pszValue,
const char *pszFlags)
&parms[0]);
&paParm);
return rc;
#ifdef VBOX_WITH_GUEST_PROPS
if (valuesOut[i])
if (flagsOut[i])
(void *)papszNames,
(void *)papszValues,
(void *)pai64Timestamps,
(void *)papszFlags);
for (unsigned i = 0; i < cProps; ++i)
if (valuesOut[i])
if (flagsOut[i])
return VINF_SUCCESS;
return VERR_NOT_SUPPORTED;
#ifdef VBOX_WITH_GUEST_CONTROL
return rc;
return VERR_NOT_SUPPORTED;