ConsoleImpl2.cpp revision 8ad4991aaa9695a98840f9d1f718417c59bedf8f
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * VBox Console COM Class implementation
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * @remark We've split out the code that the 64-bit VC++ v8 compiler finds
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * problematic to optimize so we can disable optimizations and later,
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * perhaps, find a real solution for it (like rewriting the code and
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * to stop resemble a tonne of spaghetti).
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * Copyright (C) 2006-2010 Oracle Corporation
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * available from http://www.virtualbox.org. This file is free software;
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * General Public License (GPL) as published by the Free Software
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync/*******************************************************************************
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync* Header Files *
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync*******************************************************************************/
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync// for some reason Windows burns in sdk\...\winsock.h if this isn't included first
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync// generated header
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync#if 0 /* enable to play with lots of memory. */
0c94a8282c9042b02f022302a3d987746140eab9vboxsync#include <VBox/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync# include <hgcm/HGCM.h> /** @todo it should be possible to register a service
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * extension using a VMMDev callback. */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync#endif /* VBOX_WITH_GUEST_PROPS */
0c94a8282c9042b02f022302a3d987746140eab9vboxsync#endif /* VBOX_WITH_NETFLT */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsyncstatic int DarwinSmcKey(char *pabKey, uint32_t cbKey)
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Method as described in Amit Singh's article:
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * http://osxbook.com/book/bonus/chapter7/tpmdrmmyth/
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync typedef struct
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault,
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port);
f9cdd92d151d9c28eb0f1aed25863fc04f85691dvboxsync AppleSMCBuffer inputStruct = { 0, {0}, 32, {0}, 5, };
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync for (int i = 0; i < 2; i++)
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync inputStruct.key = (uint32_t)((i == 0) ? 'OSK0' : 'OSK1');
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync (const void *)&inputStruct,
0c94a8282c9042b02f022302a3d987746140eab9vboxsync for (int j = 0; j < 32; j++)
0c94a8282c9042b02f022302a3d987746140eab9vboxsync#endif /* RT_OS_DARWIN */
0c94a8282c9042b02f022302a3d987746140eab9vboxsync/* Darwin compile kludge */
0c94a8282c9042b02f022302a3d987746140eab9vboxsync/* Comment out the following line to remove VMWare compatibility hack. */
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * Translate IDE StorageControllerType_T to string representation.
0c94a8282c9042b02f022302a3d987746140eab9vboxsyncconst char* controllerString(StorageControllerType_T enmType)
0c94a8282c9042b02f022302a3d987746140eab9vboxsync return "PIIX3";
0c94a8282c9042b02f022302a3d987746140eab9vboxsync return "PIIX4";
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync return "ICH6";
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync return "Unknown";
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Simple class for storing network boot information.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync ULONG lval = mBootPrio - 1; /* 0 will wrap around and get the lowest priority. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync return lval < rval; /* Zero compares as highest number (lowest prio). */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * VC++ 8 / amd64 has some serious trouble with this function.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * As a temporary measure, we'll drop global optimizations.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsyncstatic int findEfiRom(IVirtualBox* vbox, FirmwareType_T aFirmwareType, Utf8Str& aEfiRomFile)
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync rc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(),
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync empty.asOutParam(), aFilePath.asOutParam(), &fPresent);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsyncstatic int getSmcDeviceKey(IMachine *pMachine, BSTR *aKey, bool *pfGetKeyFromRealSMC)
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * The extra data takes precedence (if non-zero).
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync HRESULT hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/SmcDeviceKey").raw(),
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Query it here and now.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync LogRel(("Warning: DarwinSmcKey failed with rc=%Rrc!\n", rc));
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Is it apple hardware in bootcamp?
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /** @todo implement + test RTSYSDMISTR_MANUFACTURER on all hosts.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Currently falling back on the product name. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync RTSystemQueryDmiString(RTSYSDMISTR_MANUFACTURER, szManufacturer, sizeof(szManufacturer));
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync if ( !strcmp(szManufacturer, "Apple Computer, Inc.")
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync RTSystemQueryDmiString(RTSYSDMISTR_PRODUCT_NAME, szProdName, sizeof(szProdName));
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync && RT_C_IS_DIGIT(szProdName[strlen(szProdName) - 1]) /* version number */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync const char *pcszName)
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync : iprt::Error(Utf8StrFmt("%s failed: rc=%Rrc, pcszName=%s", pcszFunction, vrc, pcszName)),
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync AssertMsgFailed(("%s\n", what())); // in strict mode, hit a breakpoint here
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * fails (C-string variant).
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * @param pParent See CFGMR3InsertStringN.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * @param pcszNodeName See CFGMR3InsertStringN.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * @param pcszValue The string value.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync const char *pcszName,
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync throw ConfigError("CFGMR3InsertString", vrc, pcszName);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * fails (Utf8Str variant).
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param pParent See CFGMR3InsertStringN.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param pcszNodeName See CFGMR3InsertStringN.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param rStrValue The string value.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync const char *pcszName,
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync throw ConfigError("CFGMR3InsertStringLengthKnown", vrc, pcszName);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * fails (Bstr variant).
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * @param pParent See CFGMR3InsertStringN.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * @param pcszNodeName See CFGMR3InsertStringN.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param rBstrValue The string value.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync const char *pcszName,
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigString(pNode, pcszName, Utf8Str(rBstrValue));
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * Helper that calls CFGMR3InsertBytes and throws an iprt::Error if that fails.
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * @param pNode See CFGMR3InsertBytes.
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * @param pcszName See CFGMR3InsertBytes.
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * @param pvBytes See CFGMR3InsertBytes.
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * @param cbBytes See CFGMR3InsertBytes.
0c94a8282c9042b02f022302a3d987746140eab9vboxsync const char *pcszName,
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync const void *pvBytes,
0c94a8282c9042b02f022302a3d987746140eab9vboxsync throw ConfigError("CFGMR3InsertBytes", vrc, pcszName);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * Helper that calls CFGMR3InsertInteger and throws an iprt::Error if that
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * @param pNode See CFGMR3InsertInteger.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * @param pcszName See CFGMR3InsertInteger.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * @param u64Integer See CFGMR3InsertInteger.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync const char *pcszName,
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync throw ConfigError("CFGMR3InsertInteger", vrc, pcszName);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * Helper that calls CFGMR3InsertNode and throws an iprt::Error if that fails.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param pNode See CFGMR3InsertNode.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param pcszName See CFGMR3InsertNode.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * @param ppChild See CFGMR3InsertNode.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync const char *pcszName,
f9cdd92d151d9c28eb0f1aed25863fc04f85691dvboxsync int vrc = CFGMR3InsertNode(pNode, pcszName, ppChild);
f9cdd92d151d9c28eb0f1aed25863fc04f85691dvboxsync throw ConfigError("CFGMR3InsertNode", vrc, pcszName);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * Helper that calls CFGMR3RemoveValue and throws an iprt::Error if that fails.
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * @param pNode See CFGMR3RemoveValue.
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * @param pcszName See CFGMR3RemoveValue.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync const char *pcszName)
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync throw ConfigError("CFGMR3RemoveValue", vrc, pcszName);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * Construct the VM configuration tree (CFGM).
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * This is a callback for VMR3Create() call. It is called from CFGMR3Init()
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * in the emulation thread (EMT). Any per thread COM/XPCOM initialization
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync * is done here.
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync * @param pVM VM handle.
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync * @param pvConsole Pointer to the VMPowerUpTask object.
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync * @return VBox status code.
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync * @note Locks the Console object for writing.
f9cdd92d151d9c28eb0f1aed25863fc04f85691dvboxsyncDECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole)
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync bool fFdcEnabled = false;
f9cdd92d151d9c28eb0f1aed25863fc04f85691dvboxsync /* initialize COM */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync LogFlow(("Console::configConstructor(): CoInitializeEx()=%08X\n", hrc));
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync ComObjPtr<Console> pConsole = static_cast<Console *>(pvConsole);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync AssertComRCReturn(autoCaller.rc(), VERR_ACCESS_DENIED);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync /* lock the console because we widely use internal fields and methods */
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync AutoWriteLock alock(pConsole COMMA_LOCKVAL_SRC_POS);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync /* Save the VM pointer in the machine object */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync#define H() AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_GENERAL_FAILURE)
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * Get necessary objects and frequently used parameters.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync hrc = pMachine->COMGETTER(MemorySize)(&cRamMBs); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync#if 0 /* enable to play with lots of memory. */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync cRamMBs = RTStrToUInt64(RTEnvGet("VBOX_RAM_SIZE"));
0c94a8282c9042b02f022302a3d987746140eab9vboxsync hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType); H();
0c94a8282c9042b02f022302a3d987746140eab9vboxsync /* We'd better have 0x10000000 region, to cover 256 buses
0c94a8282c9042b02f022302a3d987746140eab9vboxsync but this put too much load on hypervisor heap */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS");
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Get root node first.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * This is the only node in the tree.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync // InsertConfigString throws
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Set the root (and VMM) level values.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigBytes(pRoot, "UUID", &HardwareUuid, sizeof(HardwareUuid));
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "RamHoleSize", cbRamHole);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "CpuExecutionCap", ulCpuExecutionCap);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "RawR3Enabled", 1); /* boolean */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "RawR0Enabled", 1); /* boolean */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /** @todo Config: RawR0, PATMEnabled and CSAMEnabled needs attention later. */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "PATMEnabled", 1); /* boolean */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "CSAMEnabled", 1); /* boolean */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /* Not necessary, but to make sure these two settings end up in the release log. */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(PageFusionEnabled)(&fPageFusion); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "PageFusion", fPageFusion); /* boolean */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->COMGETTER(MemoryBalloonSize)(&ulBalloonSize); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "MemBalloonSize", ulBalloonSize);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * CPUM values.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* cpuid leaf overrides. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync for (uint32_t uLeaf = s_auCpuIdRanges[i]; uLeaf < s_auCpuIdRanges[i + 1]; uLeaf++)
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync hrc = pMachine->GetCPUIDLeaf(uLeaf, &ulEax, &ulEbx, &ulEcx, &ulEdx);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigNode(pCPUM, Utf8StrFmt("HostCPUID/%RX32", uLeaf).c_str(), &pLeaf);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /* We must limit CPUID count for Windows NT 4, as otherwise it stops
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync with error 0x3e (MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED). */
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync LogRel(("Limiting CPUID leaf count for NT4 guests\n"));
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /* Expose extended MWAIT features to Mac OS X guests. */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pCPUM, "MWaitExtensions", true);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * Hardware virtualization extensions.
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &fHWVirtExEnabled); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync if (cCpus > 1) /** @todo SMP: This isn't nice, but things won't work on mac otherwise. */
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync /* - With more than 4GB PGM will use different RAMRANGE sizes for raw
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync mode and hv mode to optimize lookup times.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync - With more than one virtual CPU, raw-mode isn't a fallback option. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync#else /* !VBOX_WITH_RAW_MODE */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync#endif /* !VBOX_WITH_RAW_MODE */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* only honor the property value if there was no other reason to enable it */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Force, &fHwVirtExtForced); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync InsertConfigInteger(pRoot, "HwVirtExtForced", fHwVirtExtForced);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * MM values.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pMM, "CanUseLargerHeap", chipsetType == ChipsetType_ICH9);
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync * Hardware virtualization settings.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* Indicate whether 64-bit guests are supported or not. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /** @todo This is currently only forced off on 32-bit hosts only because it
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * makes a lof of difference there (REM and Solaris performance).
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync hrc = host->GetProcessorFeature(ProcessorFeature_LongMode,
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = guestOSType->COMGETTER(Is64Bit)(&fIs64BitGuest); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "64bitEnabled", 1);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync#if ARCH_BITS == 32 /* The recompiler must use VBoxREM64 (32-bit host only). */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "64bitEnabled", 0);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /** @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* Only allow TPR patching for NT, Win2k, XP and Windows Server 2003. (32 bits mode)
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * We may want to consider adding more guest OSes (Solaris) later on.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "TPRPatchingEnabled", 1);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* HWVirtEx exclusive mode */
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &fHWVirtExExclusive); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "Exclusive", fHWVirtExExclusive);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* Nested paging (VT-x/AMD-V) */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &fEnableNestedPaging); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "EnableNestedPaging", fEnableNestedPaging);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync /* Large pages; requires nested paging */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &fEnableLargePages); H();
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pHWVirtExt, "EnableLargePages", fEnableLargePages);
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync /* VPID (VT-x) */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &fEnableVPID); H();
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync InsertConfigInteger(pHWVirtExt, "EnableVPID", fEnableVPID);
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync /* Physical Address Extension (PAE) */
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE); H();
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync /* Synthetic CPU */
9c9db71d639cf066ed41d49629d46d48bff4be2fvboxsync hrc = pMachine->GetCPUProperty(CPUPropertyType_Synthetic, &fSyntheticCpu); H();
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync InsertConfigInteger(pRoot, "SyntheticCpu", fSyntheticCpu);
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug); H();
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync * PDM config.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * Load drivers in VBoxC.[so|dll]
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync // VBoxC is located in the components subdirectory
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync rc = RTPathAppPrivateArch(szPathVBoxC, RTPATH_MAX - sizeof("/components/VBoxC")); AssertRC(rc);
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync * I/O settings (cache, max bandwidth, ...).
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync InsertConfigNode(pPDM, "AsyncCompletion", &pPDMAc);
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync /* Builtin I/O cache */
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync hrc = pMachine->COMGETTER(IoCacheEnabled)(&fIoCache); H();
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync InsertConfigInteger(pPDMAcFile, "CacheEnabled", fIoCache);
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync /* I/O cache size */
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync hrc = pMachine->COMGETTER(IoCacheSize)(&ioCacheSize); H();
8865793e4f3435f5e2c728d9e6739cd24d08c0devboxsync InsertConfigInteger(pPDMAcFile, "CacheSize", ioCacheSize * _1M);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync PCFGMNODE pCfg = NULL; /* /Devices/Dev/.../Config/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync PCFGMNODE pLunL0 = NULL; /* /Devices/Dev/0/LUN#0/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync PCFGMNODE pLunL1 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync PCFGMNODE pLunL2 = NULL; /* /Devices/Dev/0/LUN#0/AttachedDriver/Config/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync PCFGMNODE pBiosCfg = NULL; /* /Devices/pcbios/0/Config/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync PCFGMNODE pNetBootCfg = NULL; /* /Devices/pcbios/0/Config/NetBoot/ */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * The time offset
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = biosSettings->COMGETTER(TimeOffset)(&timeOffset); H();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pTMNode, "UTCOffset", timeOffset * 1000000);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * PCI buses.
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync u32IocPciAddress = (0x1 << 16) | 0; // ISA controller
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync u32IocPciAddress = (0x1f << 16) | 0; // LPC controller
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* Provide MCFG info */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pCfg, "McfgBase", u64McfgBase);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pCfg, "McfgLength", u32McfgLength);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* And register 2 bridges */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigNode(pDevices, "ich9pcibridge", &pDev);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync#if 0 /* enable this to test PCI bridging */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync rc = CFGMR3InsertInteger(pInst, "PCIBusNo", 0);/* -> pci[0] */ RC_CHECK();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync rc = CFGMR3InsertInteger(pInst, "PCIBusNo", 1);/* ->pcibridge[0] */ RC_CHECK();
38745c55f37c31ba8b78cc728d2f08ea6eec38d6vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync rc = CFGMR3InsertInteger(pInst, "PCIBusNo", 1);/* ->pcibridge[0] */ RC_CHECK();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * Enable 3 following devices: HPET, SMC, LPC on MacOS X guests
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * High Precision Event Timer (HPET)
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* Other guests may wish to use HPET too, but MacOS X not functional without it */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync hrc = pMachine->COMGETTER(HpetEnabled)(&fHpetEnabled); H();
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* so always enable HPET in extended profile */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync /* HPET is always present on ICH9 */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync * System Management Controller (SMC)
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync rc = getSmcDeviceKey(pMachine, bstrKey.asOutParam(), &fGetKeyFromRealSMC);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigInteger(pCfg, "GetKeyFromRealSMC", fGetKeyFromRealSMC);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * Low Pin Count (LPC) bus
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync /** @todo: implement appropriate getter */
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync fLpcEnabled = fOsXGuest || (chipsetType == ChipsetType_ICH9);
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync * PS/2 keyboard & mouse.
c66c4413faa5a72ce047742f9acfa85e94dec8afvboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
e70bda5438c3582164d26f171a8bc8d3d7da1e12vboxsync InsertConfigString(pLunL0, "Driver", "KeyboardQueue");
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
66b58af085e22ee26be57f98127fb49ee2e91790vboxsync InsertConfigString(pLunL1, "Driver", "MainKeyboard");
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync InsertConfigString(pLunL0, "Driver", "MouseQueue");
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse);
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * i8254 Programmable Interval Timer And Dummy Speaker
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
661bfa5aae55ac2f94fa1cb131ea2323e5f6e633vboxsync * i8259 Programmable Interrupt Controller.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Advanced Programmable Interrupt Controller.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * SMP: Each CPU has a LAPIC, but we have a single device representing all LAPICs states,
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * thus only single insert
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * I/O Advanced Programmable Interrupt Controller.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * RTC MC146818.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(RTCUseUTC)(&fRTCUseUTC); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "UseUTC", fRTCUseUTC ? 1 : 0);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(VRAMSize)(&cVRamMBs); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "VRamSize", cVRamMBs * _1M);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(MonitorCount)(&cMonitorCount); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "MonitorCount", cMonitorCount);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "R0Enabled", fHWVirtExEnabled);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * BIOS logo
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "FadeIn", fFadeIn ? 1 : 0);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "FadeOut", fFadeOut ? 1: 0);
8f7ee9e453c60b3b699799538a45950b35266665vboxsync hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime); H();
8f7ee9e453c60b3b699799538a45950b35266665vboxsync InsertConfigInteger(pCfg, "LogoTime", logoDisplayTime);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "LogoFile", Utf8Str(!logoImagePath.isEmpty() ? logoImagePath : "") );
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Boot menu
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync biosSettings->COMGETTER(BootMenuMode)(&eBootMenuMode);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync case BIOSBootMenuMode_Disabled: iShowBootMenu = 0; break;
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync case BIOSBootMenuMode_MenuOnly: iShowBootMenu = 1; break;
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "ShowBootMenu", iShowBootMenu);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* Custom VESA mode list */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync unsigned cModes = 0;
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync RTStrPrintf(szExtraDataKey, sizeof(szExtraDataKey), "CustomVideoMode%u", iMode);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr(szExtraDataKey).raw(), bstr.asOutParam()); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "CustomVideoModes", cModes);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync /* VESA height reduction */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync IFramebuffer *pFramebuffer = pConsole->getDisplay()->getFramebuffer();
8f7ee9e453c60b3b699799538a45950b35266665vboxsync hrc = pFramebuffer->COMGETTER(HeightReduction)(&ulHeightReduction); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync /* If framebuffer is not available, there is no height reduction. */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "HeightReduction", ulHeightReduction);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync /* Attach the display. */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigString(pLunL0, "Driver", "MainDisplay");
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pDisplay);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Firmware.
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = pMachine->COMGETTER(FirmwareType)(&eFwType); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync BOOL fEfiEnabled = (eFwType >= FirmwareType_EFI) && (eFwType <= FirmwareType_EFIDUAL);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pBiosCfg, "RamHoleSize", cbRamHole);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pBiosCfg, "HardDiskDevice", "piix3ide");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pBiosCfg, "FloppyDevice", "i82078");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pBiosCfg, "PXEDebug", fPXEDebug);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigBytes(pBiosCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid));
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigNode(pBiosCfg, "NetBoot", &pNetBootCfg);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos)
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync hrc = pMachine->GetBootOrder(pos, &bootDevice); H();
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync szParamName[sizeof(szParamName) - 2] = ((char (pos - 1)) + '0');
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync AssertMsgFailed(("Invalid bootDevice=%d\n", bootDevice));
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pBiosCfg, szParamName, pszBootDevice);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* Autodetect firmware type, basing on guest type */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* Get boot args */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiBootArgs").raw(), bootArgs.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* Get device props */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps").raw(), deviceProps.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* Get GOP mode settings */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode").raw(), bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* UGA mode settings */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution").raw(), bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution").raw(), bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * EFI subtree.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "RamHoleSize", cbRamHole);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "DeviceProps", deviceProps);
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigBytes(pCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid));
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigInteger(pCfg, "64BitEntry", f64BitEntry); /* boolean */
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigInteger(pCfg, "UgaHorizontalResolution", u32UgaHorisontal);
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigInteger(pCfg, "UgaVerticalResolution", u32UgaVertical);
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync /* For OS X guests we'll force passing host's DMI info to the guest */
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigInteger(pCfg, "DmiExposeMemoryTable", 1);
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync * Storage controllers.
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync PCFGMNODE aCtrlNodes[StorageControllerType_LsiLogicSas + 1] = {};
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync hrc = pMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls)); H();
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync rc = ctrls[i]->COMGETTER(ControllerType)(&enmCtrlType); H();
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes));
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync rc = ctrls[i]->COMGETTER(Name)(controllerName.asOutParam()); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync rc = ctrls[i]->COMGETTER(Instance)(&ulInstance); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync rc = ctrls[i]->COMGETTER(UseHostIOCache)(&fUseHostIOCache); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* /Devices/<ctrldev>/ */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync const char *pszCtrlDev = pConsole->convertControllerTypeToDev(enmCtrlType);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* /Devices/<ctrldev>/<instance>/ */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the status driver */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedScsi];
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = BusMgr->assignPciDevice("buslogic", pCtlInst); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync /* Attach the status driver */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedScsi];
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = BusMgr->assignPciDevice("ahci", pCtlInst); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = ctrls[i]->COMGETTER(PortCount)(&cPorts); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Needed configuration values for the bios. */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pBiosCfg, "SataHardDiskDevice", "ahci");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" };
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync { "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = ctrls[i]->GetIDEEmulationPort(j, &lPortNumber); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, s_apszConfig[j], lPortNumber);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pBiosCfg, s_apszBiosConfig[j], lPortNumber);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the status driver */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSata]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedSata];
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * IDE (update this when the main interface changes)
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = BusMgr->assignPciDevice("piix3ide", pCtlInst); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pCfg, "Type", controllerString(enmCtrlType));
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the status driver */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedIde]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedIde];
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* IDE flavors */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * i82078 Floppy drive controller
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the status driver */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedFloppy]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedFloppy];
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = BusMgr->assignPciDevice("lsilogicsas", pCtlInst); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pCfg, "ControllerType", "SAS1068");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the status driver */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSas]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync paLedDevType = &pConsole->maStorageDevType[iLedSas];
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync AssertMsgFailedReturn(("invalid storage controller type: %d\n", enmCtrlType), VERR_GENERAL_FAILURE);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync /* Attach the media to the storage controllers. */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = pMachine->GetMediumAttachmentsOfController(controllerName.raw(),
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync false /* fSetupMerge */,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync 0 /* uMergeSource */,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync 0 /* uMergeTarget */,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync false /* fAttachDetach */,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync false /* fForceUnmount */,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * Network adapters
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync PCFGMNODE pDevPCNet = NULL; /* PCNet-type devices */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync PCFGMNODE pDevE1000 = NULL; /* E1000-type devices */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync PCFGMNODE pDevVirtioNet = NULL; /* Virtio network devices */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigNode(pDevices, "virtio-net", &pDevVirtioNet);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync#endif /* VBOX_WITH_VIRTIO */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::NetworkAdapterCount; ++ulInstance)
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = pMachine->GetNetworkAdapter(ulInstance, networkAdapter.asOutParam()); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = networkAdapter->COMGETTER(Enabled)(&fEnabled); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * The virtual hardware type. Create appropriate device first.
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = networkAdapter->COMGETTER(AdapterType)(&adapterType); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync#endif /* VBOX_WITH_VIRTIO */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync AssertMsgFailed(("Invalid network adapter type '%d' for slot '%d'",
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync N_("Invalid network adapter type '%d' for slot '%d'"),
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
8f7ee9e453c60b3b699799538a45950b35266665vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync /* the first network card gets the PCI ID 3, the next 3 gets 8..10,
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync * next 4 get 16..19. */
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync * Dirty hack for PCI slot compatibility with VMWare,
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync * it assigns slot 11 to the first network controller.
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync if (iPciDeviceNo == 3 && adapterType == NetworkAdapterType_I82545EM)
fdb40b7d2efa84fc6f03b7a695cb4b2e035c30c7vboxsync hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Collect information needed for network booting and add it to the list.
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * The virtual hardware type. PCNet supports two types.
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Get the MAC address and convert it to binary representation
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = networkAdapter->COMGETTER(MACAddress)(macAddr.asOutParam()); H();
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * Check if the cable is supposed to be unplugged
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync hrc = networkAdapter->COMGETTER(CableConnected)(&fCableConnected); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "CableConnected", fCableConnected ? 1 : 0);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Line speed to report from custom drivers
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = networkAdapter->COMGETTER(LineSpeed)(&ulLineSpeed); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pCfg, "LineSpeed", ulLineSpeed);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * Attach the status driver.
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapNetworkLeds[ulInstance]);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * Configure the network card now
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync false /*fAttachDetach*/);
0c94a8282c9042b02f022302a3d987746140eab9vboxsync * Build network boot information and transfer it to the BIOS.
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync if (pNetBootCfg && !llBootNics.empty()) /* NetBoot node doesn't exist for EFI! */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync llBootNics.sort(); /* Sort the list by boot priority. */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync unsigned uBootIdx = 0;
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync for (std::list<BootNic>::iterator it = llBootNics.begin(); it != llBootNics.end(); ++it)
0c94a8282c9042b02f022302a3d987746140eab9vboxsync /* A NIC with priority 0 is only used if it's first in the list. */
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync achBootIdx[0] = '0' + uBootIdx++; /* Boot device order. */
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pNetBtDevCfg, "NIC", it->mInstance);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciDev);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciFn);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Serial (UART) Ports
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::SerialPortCount; ++ulInstance)
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync hrc = pMachine->GetSerialPort(ulInstance, serialPort.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = serialPort->COMGETTER(Enabled)(&fEnabled); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = serialPort->COMGETTER(IOBase)(&ulIOBase); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = serialPort->COMGETTER(Server)(&fServer); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = serialPort->COMGETTER(Path)(bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = serialPort->COMGETTER(HostMode)(&eHostMode); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync InsertConfigString(pLunL0, "Driver", "Host Serial");
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync * Parallel (LPT) Ports
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync for (ULONG ulInstance = 0; ulInstance < SchemaDefs::ParallelPortCount; ++ulInstance)
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync hrc = pMachine->GetParallelPort(ulInstance, parallelPort.asOutParam()); H();
49a6b09abb20015b0af3e618a1f92b7e26785e90vboxsync hrc = parallelPort->COMGETTER(Enabled)(&fEnabled); H();
88e56f700a3b8dfdf1646f96320f335e22339caavboxsync InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pInst);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = parallelPort->COMGETTER(IOBase)(&ulIOBase); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pLunL0, "Driver", "HostParallel");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = parallelPort->COMGETTER(Path)(bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * VMM Device
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = BusMgr->assignPciDevice("VMMDev", pInst); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync if (hwVersion.compare(Bstr("1").raw()) == 0) /* <= 2.0.x */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "GuestCoreDumpDir", snapshotFolder);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* the VMM device's Main driver */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pVMMDev);
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync * Attach the status driver.
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
5c4d7e2aae42bbf39793dfa686925f076a56b4d5vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapSharedFolderLed);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Audio Sniffer Device
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* the Audio Sniffer device's Main driver */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pLunL0, "Driver", "MainAudioSniffer");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync AudioSniffer *pAudioSniffer = pConsole->mAudioSniffer;
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "Object", (uintptr_t)pAudioSniffer);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = audioAdapter->COMGETTER(Enabled)(&fAudioEnabled); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = audioAdapter->COMGETTER(AudioController)(&audioController); H();
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync /* default: ICH AC97 */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = BusMgr->assignPciDevice("ichac97", pInst); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync /* legacy SoundBlaster16 */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync /* Intel HD Audio */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync /* the Audio driver */
19320d55d1417c39b3b5673a53aaa5ef177242c8vboxsync hrc = audioAdapter->COMGETTER(AudioDriver)(&audioDriver); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync#endif /* RT_OS_WINDOWS */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "AudioDriver", "solaudio");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync#endif /* RT_OS_LINUX */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(VBOX_WITH_SOLARIS_OSS)
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "AudioDriver", "coreaudio");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * The USB Controller.
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync hrc = pMachine->COMGETTER(USBController)(USBCtlPtr.asOutParam());
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync hrc = USBCtlPtr->COMGETTER(Enabled)(&fOhciEnabled); H();
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = BusMgr->assignPciDevice("usb-ohci", pInst); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pLunL0, "Driver", "VUSBRootHub");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Attach the status driver.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapUSBLed[0]);
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync hrc = USBCtlPtr->COMGETTER(EnabledEhci)(&fEhciEnabled); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync hrc = BusMgr->assignPciDevice("usb-ehci", pInst); H();
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pLunL0, "Driver", "VUSBRootHub");
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync * Attach the status driver.
44372afb953dc9f1f1ec71943f5f561a607c0307vboxsync InsertConfigString(pLunL0, "Driver", "MainStatus");
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapUSBLed[1]);
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync * Virtual USB Devices.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * Global USB options, currently unused as we'll apply the 2.0 -> 1.1 morphing
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync * on a per device level now.
29099c2d04b11e614f1fa399fab9e9162f2788b9vboxsync // This globally enables the 2.0 -> 1.1 device morphing of proxied devices to keep windows quiet.
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync //InsertConfigInteger(pCfg, "Force11Device", true);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync // The following breaks stuff, but it makes MSDs work in vista. (I include it here so
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync // that it's documented somewhere.) Users needing it can use:
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync // VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync //InsertConfigInteger(pCfg, "Force11PacketSize", true);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync# if 0 /* Virtual MSD*/
0c94a8282c9042b02f022302a3d987746140eab9vboxsync InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
0c94a8282c9042b02f022302a3d987746140eab9vboxsync InsertConfigNode(pLunL1, "AttachedDriver", &pLunL2);
0c69348b58bb8eabb1bea8867ee932b667bd0d34vboxsync InsertConfigString(pCfg, "Path", "/Volumes/DataHFS/bird/VDIs/linux.vdi");
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)
if (pszCFGMValueName)
if (pNode)
AssertLogRelMsgRC(rc, ("failed to insert CFGM value '%s' to key '%s'\n", strCFGMValueUtf8.c_str(), pszExtraDataKey));
catch (ConfigError &x)
return x.m_vrc;
#undef H
#ifdef VBOX_WITH_EXTPACK
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 fSetupMerge,
unsigned uMergeSource,
unsigned uMergeTarget,
bool fAttachDetach,
bool fForceUnmount,
unsigned uLUN;
if (pLunL0)
if (fAttachDetach)
#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 fSetupMerge,
unsigned uMergeSource,
unsigned uMergeTarget,
#define H() AssertMsgReturnStmt(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), if (phrc) *phrc = hrc, VERR_GENERAL_FAILURE)
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 (fSetupMerge)
switch (enmType)
case DeviceType_DVD:
case DeviceType_Floppy:
case DeviceType_HardDisk:
bool fHostIP = true;
fHostIP = false;
uImage--;
if (!pMedium)
if (fSetupMerge)
fHostIP = false;
if (!fHostIP)
catch (ConfigError &x)
return x.m_vrc;
#undef H
return VINF_SUCCESS;
unsigned uInstance,
unsigned uLun,
bool fAttachDetach)
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)
setVMRuntimeErrorCallbackF(pVM, this, 0, "BridgedInterfaceDown", "Bridged interface %s is down. Guest will not be able to use this interface", pszHifName);
# 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;