- Timestamp:
- Feb 3, 2011 10:49:26 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r35753 r35830 224 224 }; 225 225 226 /* 227 * VC++ 8 / amd64 has some serious trouble with this function. 228 * As a temporary measure, we'll drop global optimizations. 229 */ 230 #if defined(_MSC_VER) && defined(RT_ARCH_AMD64) 231 # pragma optimize("g", off) 232 #endif 233 234 static int findEfiRom(IVirtualBox* vbox, FirmwareType_T aFirmwareType, Utf8Str& aEfiRomFile) 226 static int findEfiRom(IVirtualBox* vbox, FirmwareType_T aFirmwareType, Utf8Str *pEfiRomFile) 235 227 { 236 int rc;228 Bstr aFilePath, empty; 237 229 BOOL fPresent = FALSE; 238 Bstr aFilePath, empty; 239 240 rc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(), 241 empty.asOutParam(), aFilePath.asOutParam(), &fPresent); 242 if (RT_FAILURE(rc)) 243 AssertComRCReturn(rc, VERR_FILE_NOT_FOUND); 230 HRESULT hrc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(), 231 empty.asOutParam(), aFilePath.asOutParam(), &fPresent); 232 AssertComRCReturn(hrc, Global::vboxStatusCodeFromCOM(hrc)); 244 233 245 234 if (!fPresent) 246 235 return VERR_FILE_NOT_FOUND; 247 236 248 aEfiRomFile = Utf8Str(aFilePath);249 250 return S_OK;237 *pEfiRomFile = Utf8Str(aFilePath); 238 239 return VINF_SUCCESS; 251 240 } 252 241 … … 318 307 } 319 308 309 310 /* 311 * VC++ 8 / amd64 has some serious trouble with the next functions. 312 * As a temporary measure, we'll drop global optimizations. 313 */ 314 #if defined(_MSC_VER) && defined(RT_ARCH_AMD64) 315 # pragma optimize("g", off) 316 #endif 317 318 320 319 class ConfigError : public iprt::Error 321 320 { … … 533 532 { 534 533 LogFlowFuncEnter(); 535 PciBusAddress PciAddr;536 bool fFdcEnabled = false;537 BOOL fIs64BitGuest = false;538 534 539 535 #if !defined(VBOX_WITH_XPCOM) … … 589 585 RTUUID HardwareUuid; 590 586 rc = RTUuidFromUtf16(&HardwareUuid, bstr.raw()); 591 Assert MsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);587 AssertRCReturn(rc, rc); 592 588 593 589 ULONG cRamMBs; … … 597 593 cRamMBs = RTStrToUInt64(RTEnvGet("VBOX_RAM_SIZE")); 598 594 #endif 599 uint64_t const cbRam = cRamMBs * (uint64_t)_1M;600 uint32_t cbRamHole = MM_RAM_HOLE_SIZE_DEFAULT;601 uint64_t u 64McfgBase= 0;602 uint32_t u32McfgLength= 0;595 uint64_t const cbRam = cRamMBs * (uint64_t)_1M; 596 uint32_t cbRamHole = MM_RAM_HOLE_SIZE_DEFAULT; 597 uint64_t uMcfgBase = 0; 598 uint32_t cbMcfgLength = 0; 603 599 604 600 ChipsetType_T chipsetType; … … 608 604 /* We'd better have 0x10000000 region, to cover 256 buses 609 605 but this put too much load on hypervisor heap */ 610 u32McfgLength = 0x4000000; //0x10000000;611 cbRamHole += u32McfgLength;612 u 64McfgBase = _4G - cbRamHole;606 cbMcfgLength = 0x4000000; //0x10000000; 607 cbRamHole += cbMcfgLength; 608 uMcfgBase = _4G - cbRamHole; 613 609 } 614 610 … … 649 645 */ 650 646 hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H(); 651 InsertConfigString(pRoot, "Name", bstr);647 InsertConfigString(pRoot, "Name", bstr); 652 648 InsertConfigBytes(pRoot, "UUID", &HardwareUuid, sizeof(HardwareUuid)); 653 649 InsertConfigInteger(pRoot, "RamSize", cbRam); … … 756 752 * Hardware virtualization settings. 757 753 */ 758 PCFGMNODE pHWVirtExt; 754 BOOL fIsGuest64Bit = false; 755 PCFGMNODE pHWVirtExt; 759 756 InsertConfigNode(pRoot, "HWVirtExt", &pHWVirtExt); 760 757 if (fHWVirtExEnabled) … … 769 766 hrc = host->GetProcessorFeature(ProcessorFeature_LongMode, 770 767 &fSupportsLongMode); H(); 771 hrc = guestOSType->COMGETTER(Is64Bit)(&fIs 64BitGuest); H();772 773 if (fSupportsLongMode && fIs 64BitGuest)768 hrc = guestOSType->COMGETTER(Is64Bit)(&fIsGuest64Bit); H(); 769 770 if (fSupportsLongMode && fIsGuest64Bit) 774 771 { 775 772 InsertConfigInteger(pHWVirtExt, "64bitEnabled", 1); … … 788 785 789 786 /** @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */ 790 if ( !fIs 64BitGuest787 if ( !fIsGuest64Bit 791 788 && fIOAPIC 792 789 && ( osTypeId == "WindowsNT4" … … 947 944 * PCI buses. 948 945 */ 949 uint32_t u 32IocPciAddress, u32HbcPciAddress;946 uint32_t uIocPciAddress, uHbcPciAddress; 950 947 switch (chipsetType) 951 948 { … … 954 951 case ChipsetType_PIIX3: 955 952 InsertConfigNode(pDevices, "pci", &pDev); 956 u 32HbcPciAddress = (0x0 << 16) | 0;957 u 32IocPciAddress = (0x1 << 16) | 0; // ISA controller953 uHbcPciAddress = (0x0 << 16) | 0; 954 uIocPciAddress = (0x1 << 16) | 0; // ISA controller 958 955 break; 959 956 case ChipsetType_ICH9: 960 957 InsertConfigNode(pDevices, "ich9pci", &pDev); 961 u 32HbcPciAddress = (0x1e << 16) | 0;962 u 32IocPciAddress = (0x1f << 16) | 0; // LPC controller958 uHbcPciAddress = (0x1e << 16) | 0; 959 uIocPciAddress = (0x1f << 16) | 0; // LPC controller 963 960 break; 964 961 } … … 970 967 { 971 968 /* Provide MCFG info */ 972 InsertConfigInteger(pCfg, "McfgBase", u 64McfgBase);973 InsertConfigInteger(pCfg, "McfgLength", u32McfgLength);969 InsertConfigInteger(pCfg, "McfgBase", uMcfgBase); 970 InsertConfigInteger(pCfg, "McfgLength", cbMcfgLength); 974 971 975 972 … … 1024 1021 Bstr bstrKey; 1025 1022 rc = getSmcDeviceKey(pMachine, bstrKey.asOutParam(), &fGetKeyFromRealSMC); 1026 Assert MsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);1023 AssertRCReturn(rc, rc); 1027 1024 1028 1025 InsertConfigString(pCfg, "DeviceKey", bstrKey); … … 1242 1239 InsertConfigBytes(pBiosCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid)); 1243 1240 InsertConfigNode(pBiosCfg, "NetBoot", &pNetBootCfg); 1244 InsertConfigInteger(pBiosCfg, "McfgBase", u 64McfgBase);1245 InsertConfigInteger(pBiosCfg, "McfgLength", u32McfgLength);1241 InsertConfigInteger(pBiosCfg, "McfgBase", uMcfgBase); 1242 InsertConfigInteger(pBiosCfg, "McfgLength", cbMcfgLength); 1246 1243 1247 1244 DeviceType_T bootDevice; … … 1288 1285 else 1289 1286 { 1290 Utf8Str efiRomFile;1291 1292 1287 /* Autodetect firmware type, basing on guest type */ 1293 1288 if (eFwType == FirmwareType_EFI) 1294 1289 { 1295 eFwType = 1296 fIs64BitGuest ? 1297 (FirmwareType_T)FirmwareType_EFI64 1298 : 1299 (FirmwareType_T)FirmwareType_EFI32; 1300 } 1301 bool f64BitEntry = eFwType == FirmwareType_EFI64; 1302 1303 rc = findEfiRom(virtualBox, eFwType, efiRomFile); 1304 AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc); 1290 eFwType = fIsGuest64Bit 1291 ? (FirmwareType_T)FirmwareType_EFI64 1292 : (FirmwareType_T)FirmwareType_EFI32; 1293 } 1294 bool const f64BitEntry = eFwType == FirmwareType_EFI64; 1295 1296 Utf8Str efiRomFile; 1297 rc = findEfiRom(virtualBox, eFwType, &efiRomFile); 1298 AssertRCReturn(rc, rc); 1305 1299 1306 1300 /* Get boot args */ … … 1311 1305 Bstr deviceProps; 1312 1306 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps").raw(), deviceProps.asOutParam()); H(); 1307 1313 1308 /* Get GOP mode settings */ 1314 1309 uint32_t u32GopMode = UINT32_MAX; … … 1363 1358 hrc = pMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls)); H(); 1364 1359 1360 bool fFdcEnabled = false; 1365 1361 for (size_t i = 0; i < ctrls.size(); ++i) 1366 1362 { … … 1461 1457 { 1462 1458 static const char * const s_apszConfig[4] = 1463 1459 { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" }; 1464 1460 static const char * const s_apszBiosConfig[4] = 1465 1461 { "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" }; 1466 1462 1467 1463 LONG lPortNumber = -1; … … 1687 1683 iPciDeviceNo = 3; 1688 1684 #endif 1689 Pci Addr = PciBusAddress(0, iPciDeviceNo, 0);1685 PciBusAddress PciAddr = PciBusAddress(0, iPciDeviceNo, 0); 1690 1686 hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr); H(); 1691 1687 … … 2453 2449 } 2454 2450 } 2455 InsertConfigInteger(pCfg, "IocPciAddress", u 32IocPciAddress);2451 InsertConfigInteger(pCfg, "IocPciAddress", uIocPciAddress); 2456 2452 if (chipsetType == ChipsetType_ICH9) 2457 2453 { 2458 InsertConfigInteger(pCfg, "McfgBase", u 64McfgBase);2459 InsertConfigInteger(pCfg, "McfgLength", u32McfgLength);2460 } 2461 InsertConfigInteger(pCfg, "HostBusPciAddress", u 32HbcPciAddress);2454 InsertConfigInteger(pCfg, "McfgBase", uMcfgBase); 2455 InsertConfigInteger(pCfg, "McfgLength", cbMcfgLength); 2456 } 2457 InsertConfigInteger(pCfg, "HostBusPciAddress", uHbcPciAddress); 2462 2458 InsertConfigInteger(pCfg, "ShowCpu", fShowCpu); 2463 2459 InsertConfigInteger(pCfg, "CpuHotPlug", fCpuHotPlug); … … 2803 2799 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 2804 2800 rc = VINF_SUCCESS; 2805 Assert MsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);2801 AssertRCReturn(rc, rc); 2806 2802 2807 2803 CFGMR3RemoveNode(pLunL0); … … 3040 3036 rc = PDMR3DeviceAttach(pVM, pcszDevice, 0, uLUN, 3041 3037 PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); 3042 Assert MsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc);3038 AssertRCReturn(rc, rc); 3043 3039 3044 3040 /* There is no need to handle removable medium mounting, as we … … 3080 3076 HRESULT hrc; 3081 3077 Bstr bstr; 3082 3083 #define H() AssertMsgReturnStmt(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), if (phrc) *phrc = hrc, VERR_GENERAL_FAILURE)3084 3085 3078 PCFGMNODE pLunL1 = NULL; 3086 3079 PCFGMNODE pCfg = NULL; 3080 3081 #define H() \ 3082 AssertMsgReturnStmt(SUCCEEDED(hrc), ("hrc=%Rhrc\n", hrc), if (phrc) *phrc = hrc, Global::vboxStatusCodeFromCOM(hrc)) 3083 3087 3084 3088 3085 BOOL fHostDrive = FALSE; … … 3138 3135 if ( pMedium 3139 3136 && ( enmType == DeviceType_DVD 3140 || enmType == DeviceType_Floppy 3141 ))3137 || enmType == DeviceType_Floppy) 3138 ) 3142 3139 { 3143 3140 // if this medium represents an ISO image and this image is inaccessible, … … 3148 3145 // would be to discard the VM state... 3149 3146 MediumState_T mediumState; 3150 rc = pMedium->RefreshState(&mediumState); 3151 AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc); 3152 3147 hrc = pMedium->RefreshState(&mediumState); H(); 3153 3148 if (mediumState == MediumState_Inaccessible) 3154 3149 { 3155 3150 Bstr loc; 3156 rc = pMedium->COMGETTER(Location)(loc.asOutParam()); 3157 if (FAILED(rc)) return rc; 3158 3151 hrc = pMedium->COMGETTER(Location)(loc.asOutParam()); H(); 3159 3152 setVMRuntimeErrorCallbackF(mpVM, 3160 3153 this, … … 3200 3193 3201 3194 if (mediumType == MediumType_Readonly) 3202 {3203 3195 InsertConfigInteger(pCfg, "ReadOnly", 1); 3204 }3205 3196 else if (enmType == DeviceType_Floppy) 3206 {3207 3197 InsertConfigInteger(pCfg, "MaybeReadOnly", 1); 3208 }3209 3198 3210 3199 /* Start without exclusive write access to the images. */ … … 3220 3209 && ( aMachineState == MachineState_TeleportingIn 3221 3210 || aMachineState == MachineState_FaultTolerantSyncing)) 3222 {3223 3211 InsertConfigInteger(pCfg, "TempReadOnly", 1); 3224 }3225 3212 3226 3213 /* Flag for opening the medium for sharing between VMs. This … … 3228 3215 * in the chain, as shared media can have no diffs. */ 3229 3216 if (mediumType == MediumType_Shareable) 3230 {3231 3217 InsertConfigInteger(pCfg, "Shareable", 1); 3232 }3233 3218 3234 3219 if (!fUseHostIOCache) … … 3249 3234 InsertConfigInteger(pCfg, "SetupMerge", 1); 3250 3235 if (uImage == uMergeSource) 3251 {3252 3236 InsertConfigInteger(pCfg, "MergeSource", 1); 3253 }3254 3237 else if (uImage == uMergeTarget) 3255 {3256 3238 InsertConfigInteger(pCfg, "MergeTarget", 1); 3257 }3258 3239 } 3259 3240 … … 3320 3301 { 3321 3302 if (uImage == uMergeSource) 3322 {3323 3303 InsertConfigInteger(pCur, "MergeSource", 1); 3324 }3325 3304 else if (uImage == uMergeTarget) 3326 {3327 3305 InsertConfigInteger(pCur, "MergeTarget", 1); 3328 }3329 3306 } 3330 3307 … … 3357 3334 * configuration node. Simplifies life of DrvVD a bit. */ 3358 3335 if (!fHostIP) 3359 {3360 3336 InsertConfigInteger(pCfg, "HostIPStack", 0); 3361 }3362 3337 3363 3338 /* next */ … … 3367 3342 } 3368 3343 } 3344 #undef H 3369 3345 } 3370 3346 catch (ConfigError &x) … … 3373 3349 return x.m_vrc; 3374 3350 } 3375 3376 #undef H3377 3351 3378 3352 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.