Changeset 28130 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 9, 2010 9:46:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r28128 r28130 72 72 73 73 #ifdef VBOX_WITH_NETFLT 74 # if def RT_OS_SOLARIS74 # if defined(RT_OS_SOLARIS) 75 75 # include <zone.h> 76 # endif 77 # ifdef RT_OS_LINUX 76 # elif defined(RT_OS_LINUX) 78 77 # include <unistd.h> 79 78 # include <sys/ioctl.h> … … 82 81 # include <linux/if.h> 83 82 # include <linux/wireless.h> 84 # endif 85 # ifdef RT_OS_FREEBSD 83 # elif defined(RT_OS_FREEBSD) 86 84 # include <unistd.h> 87 85 # include <sys/types.h> … … 91 89 # include <net80211/ieee80211_ioctl.h> 92 90 # endif 93 # if def RT_OS_WINDOWS91 # if defined(RT_OS_WINDOWS) 94 92 # include <VBox/WinNetConfig.h> 95 93 # include <Ntddndis.h> … … 114 112 * http://osxbook.com/book/bonus/chapter7/tpmdrmmyth/ 115 113 */ 116 typedef struct { 114 typedef struct 115 { 117 116 uint32_t key; 118 117 uint8_t pad0[22]; … … 153 152 &outputStructCnt); 154 153 if (kr != kIOReturnSuccess) 154 { 155 IOServiceClose(port); 155 156 return VERR_INTERNAL_ERROR; 157 } 156 158 157 159 for (int j=0; j<32; j++) … … 166 168 } 167 169 168 #endif 169 170 #endif /* RT_OS_DARWIN */ 171 172 /* Darwin compile cludge */ 170 173 #undef PVM 171 174 … … 304 307 #define STR_FREE() do { if (str) { SysFreeString(str); str = NULL; } } while (0) 305 308 #define RC_CHECK() do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc)); STR_FREE(); return rc; } } while (0) 306 #define H() do { if (FAILED(hrc)) { AssertMsgFailed(("hrc=% #x\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)309 #define H() do { if (FAILED(hrc)) { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0) 307 310 308 311 /* … … 348 351 349 352 Bstr guestTypeFamilyId; 350 hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H();353 hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H(); 351 354 BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS"); 352 355 … … 375 378 rc = CFGMR3InsertInteger(pRoot, "CSAMEnabled", 1); /* boolean */ RC_CHECK(); 376 379 #endif 380 STR_FREE(); 377 381 378 382 /* cpuid leaf overrides. */ … … 493 497 /* HWVirtEx exclusive mode */ 494 498 BOOL fHWVirtExExclusive = true; 495 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &fHWVirtExExclusive); 496 rc = CFGMR3InsertInteger(pHWVirtExt, "Exclusive", fHWVirtExExclusive); 499 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &fHWVirtExExclusive); H(); 500 rc = CFGMR3InsertInteger(pHWVirtExt, "Exclusive", fHWVirtExExclusive); RC_CHECK(); 497 501 498 502 /* Nested paging (VT-x/AMD-V) */ 499 503 BOOL fEnableNestedPaging = false; 500 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &fEnableNestedPaging); 501 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableNestedPaging", fEnableNestedPaging); 504 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &fEnableNestedPaging); H(); 505 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableNestedPaging", fEnableNestedPaging); RC_CHECK(); 502 506 503 507 /* Large pages; requires nested paging */ 504 508 BOOL fEnableLargePages = false; 505 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &fEnableLargePages); 506 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableLargePages", fEnableLargePages); 509 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &fEnableLargePages); H(); 510 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableLargePages", fEnableLargePages); RC_CHECK(); 507 511 508 512 /* VPID (VT-x) */ 509 513 BOOL fEnableVPID = false; 510 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &fEnableVPID); 511 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableVPID", fEnableVPID); 514 hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &fEnableVPID); H(); 515 rc = CFGMR3InsertInteger(pHWVirtExt, "EnableVPID", fEnableVPID); RC_CHECK(); 512 516 513 517 /* Physical Address Extension (PAE) */ … … 522 526 523 527 BOOL fPXEDebug; 524 hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug); 528 hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug); H(); 525 529 526 530 /* … … 531 535 PCFGMNODE pDrivers; 532 536 PCFGMNODE pMod; 533 rc = CFGMR3InsertNode(pRoot, "PDM", &pPDM); 534 rc = CFGMR3InsertNode(pPDM, "Drivers", &pDrivers); 535 rc = CFGMR3InsertNode(pDrivers, "VBoxC", &pMod); 537 rc = CFGMR3InsertNode(pRoot, "PDM", &pPDM); RC_CHECK(); 538 rc = CFGMR3InsertNode(pPDM, "Drivers", &pDrivers); RC_CHECK(); 539 rc = CFGMR3InsertNode(pDrivers, "VBoxC", &pMod); RC_CHECK(); 536 540 #ifdef VBOX_WITH_XPCOM 537 541 // VBoxC is located in the components subdirectory … … 539 543 rc = RTPathAppPrivateArch(szPathVBoxC, RTPATH_MAX - sizeof("/components/VBoxC")); AssertRC(rc); 540 544 strcat(szPathVBoxC, "/components/VBoxC"); 541 rc = CFGMR3InsertString(pMod, "Path", szPathVBoxC); 545 rc = CFGMR3InsertString(pMod, "Path", szPathVBoxC); RC_CHECK(); 542 546 #else 543 rc = CFGMR3InsertString(pMod, "Path", "VBoxC"); 547 rc = CFGMR3InsertString(pMod, "Path", "VBoxC"); RC_CHECK(); 544 548 #endif 545 549 … … 549 553 PCFGMNODE pPDMAc; 550 554 PCFGMNODE pPDMAcFile; 551 rc = CFGMR3InsertNode(pPDM, "AsyncCompletion", &pPDMAc); 552 rc = CFGMR3InsertNode(pPDMAc, "File", &pPDMAcFile); 555 rc = CFGMR3InsertNode(pPDM, "AsyncCompletion", &pPDMAc); RC_CHECK(); 556 rc = CFGMR3InsertNode(pPDMAc, "File", &pPDMAcFile); RC_CHECK(); 553 557 554 558 /* I/O manager type */ 555 559 IoMgrType_T ioMgrType; 556 hrc = pMachine->COMGETTER(IoMgr)(&ioMgrType); 560 hrc = pMachine->COMGETTER(IoMgr)(&ioMgrType); H(); 557 561 if (ioMgrType == IoMgrType_Async) 558 562 rc = CFGMR3InsertString(pPDMAcFile, "IoMgr", "Async"); … … 565 569 /* I/O backend type */ 566 570 IoBackendType_T ioBackendType; 567 hrc = pMachine->COMGETTER(IoBackend)(&ioBackendType); 571 hrc = pMachine->COMGETTER(IoBackend)(&ioBackendType); H(); 568 572 if (ioBackendType == IoBackendType_Buffered) 569 573 rc = CFGMR3InsertString(pPDMAcFile, "FileBackend", "Buffered"); … … 576 580 /* Builtin I/O cache */ 577 581 BOOL fIoCache = true; 578 hrc = pMachine->COMGETTER(IoCacheEnabled)(&fIoCache); 579 rc = CFGMR3InsertInteger(pPDMAcFile, "CacheEnabled", fIoCache); 582 hrc = pMachine->COMGETTER(IoCacheEnabled)(&fIoCache); H(); 583 rc = CFGMR3InsertInteger(pPDMAcFile, "CacheEnabled", fIoCache); RC_CHECK(); 580 584 581 585 /* I/O cache size */ 582 586 ULONG ioCacheSize = 5; 583 hrc = pMachine->COMGETTER(IoCacheSize)(&ioCacheSize); 584 rc = CFGMR3InsertInteger(pPDMAcFile, "CacheSize", ioCacheSize * _1M); 587 hrc = pMachine->COMGETTER(IoCacheSize)(&ioCacheSize); H(); 588 rc = CFGMR3InsertInteger(pPDMAcFile, "CacheSize", ioCacheSize * _1M); RC_CHECK(); 585 589 586 590 /* Maximum I/O bandwidth */ 587 591 ULONG ioBandwidthMax = 0; 588 hrc = pMachine->COMGETTER(IoBandwidthMax)(&ioBandwidthMax); 592 hrc = pMachine->COMGETTER(IoBandwidthMax)(&ioBandwidthMax); H(); 589 593 if (ioBandwidthMax != 0) 590 594 { … … 683 687 if (fHpetEnabled) 684 688 { 685 rc = CFGMR3InsertNode(pDevices, "hpet", &pDev); RC_CHECK();686 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK();687 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK();689 rc = CFGMR3InsertNode(pDevices, "hpet", &pDev); RC_CHECK(); 690 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK(); 691 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK(); 688 692 } 689 693 … … 700 704 { 701 705 Bstr tmpStr2; 702 rc = CFGMR3InsertNode(pDevices, "smc", &pDev); RC_CHECK();703 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK();704 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK();705 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK();706 rc = getSmcDeviceKey(pMachine, tmpStr2.asOutParam()); RC_CHECK();707 rc = CFGMR3InsertString(pCfg, "DeviceKey", Utf8Str(tmpStr2).raw()); RC_CHECK();706 rc = CFGMR3InsertNode(pDevices, "smc", &pDev); RC_CHECK(); 707 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK(); 708 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK(); 709 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK(); 710 rc = getSmcDeviceKey(pMachine, tmpStr2.asOutParam()); RC_CHECK(); 711 rc = CFGMR3InsertString(pCfg, "DeviceKey", Utf8Str(tmpStr2).raw()); RC_CHECK(); 708 712 } 709 713 … … 720 724 if (fLpcEnabled) 721 725 { 722 rc = CFGMR3InsertNode(pDevices, "lpc", &pDev); RC_CHECK();723 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK();724 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK();726 rc = CFGMR3InsertNode(pDevices, "lpc", &pDev); RC_CHECK(); 727 rc = CFGMR3InsertNode(pDev, "0", &pInst); RC_CHECK(); 728 rc = CFGMR3InsertInteger(pInst, "Trusted", 1); /* boolean */ RC_CHECK(); 725 729 } 726 730 … … 804 808 BOOL fRTCUseUTC; 805 809 hrc = pMachine->COMGETTER(RTCUseUTC)(&fRTCUseUTC); H(); 806 rc = CFGMR3InsertInteger(pCfg, "UseUTC", fRTCUseUTC ? 1 : 0); 810 rc = CFGMR3InsertInteger(pCfg, "UseUTC", fRTCUseUTC ? 1 : 0); RC_CHECK(); 807 811 808 812 /* … … 871 875 } 872 876 STR_FREE(); 873 rc = CFGMR3InsertInteger(pCfg, "CustomVideoModes", cModes); 877 rc = CFGMR3InsertInteger(pCfg, "CustomVideoModes", cModes); RC_CHECK(); 874 878 875 879 /* VESA height reduction */ … … 1027 1031 rc = CFGMR3InsertInteger(pCfg, "NumCPUs", cCpus); RC_CHECK(); 1028 1032 rc = CFGMR3InsertString(pCfg, "EfiRom", efiRomFile.raw()); RC_CHECK(); 1029 rc = CFGMR3InsertString(pCfg, "BootArgs", Utf8Str(bootArgs).raw()); RC_CHECK();1030 rc = CFGMR3InsertString(pCfg, "DeviceProps", Utf8Str(deviceProps).raw()); RC_CHECK();1033 rc = CFGMR3InsertString(pCfg, "BootArgs", Utf8Str(bootArgs).raw()); RC_CHECK(); 1034 rc = CFGMR3InsertString(pCfg, "DeviceProps", Utf8Str(deviceProps).raw()); RC_CHECK(); 1031 1035 rc = CFGMR3InsertInteger(pCfg, "IOAPIC", fIOAPIC); RC_CHECK(); 1032 rc = CFGMR3InsertBytes(pCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid)); RC_CHECK();1036 rc = CFGMR3InsertBytes(pCfg, "UUID", &HardwareUuid,sizeof(HardwareUuid)); RC_CHECK(); 1033 1037 rc = CFGMR3InsertInteger(pCfg, "64BitEntry", f64BitEntry); /* boolean */ RC_CHECK(); 1034 1038 rc = CFGMR3InsertInteger(pCfg, "GopMode", u32GopMode); RC_CHECK(); 1035 rc = CFGMR3InsertInteger(pCfg, "UgaHorizontalResolution", u32UgaHorisontal); 1036 rc = CFGMR3InsertInteger(pCfg, "UgaVerticalResolution", u32UgaVertical); 1039 rc = CFGMR3InsertInteger(pCfg, "UgaHorizontalResolution", u32UgaHorisontal); RC_CHECK(); 1040 rc = CFGMR3InsertInteger(pCfg, "UgaVerticalResolution", u32UgaVertical); RC_CHECK(); 1037 1041 1038 1042 /* For OS X guests we'll force passing host's DMI info to the guest */ … … 1653 1657 PCFGMNODE pNetBtDevCfg; 1654 1658 achBootIdx[0] = '0' + uBootIdx++; /* Boot device order. */ 1655 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK();1656 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", it->mInstance); RC_CHECK();1657 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciDev); RC_CHECK();1658 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciFn); RC_CHECK();1659 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK(); 1660 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", it->mInstance); RC_CHECK(); 1661 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciDev); RC_CHECK(); 1662 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciFn); RC_CHECK(); 1659 1663 } 1660 1664 } … … 2481 2485 #define STR_FREE() do { if (str) { SysFreeString(str); str = NULL; } } while (0) 2482 2486 #define RC_CHECK() do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc)); STR_FREE(); return rc; } } while (0) 2483 #define H() do { if (FAILED(hrc)) { AssertMsgFailed(("hrc=% #x\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)2487 #define H() do { if (FAILED(hrc)) { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0) 2484 2488 2485 2489 HRESULT hrc; … … 2593 2597 hrc = natDriver->COMGETTER(Network)(&str); H(); 2594 2598 if (str) 2599 { 2595 2600 rc = CFGMR3InsertStringW(pCfg, "Network", str); RC_CHECK(); 2601 } 2596 2602 STR_FREE(); 2597 2603 hrc = natDriver->COMGETTER(HostIP)(&str); H(); … … 2693 2699 uint32_t proto = strProto.toUInt32(); 2694 2700 bool fValid = true; 2695 switch (proto)2701 switch (proto) 2696 2702 { 2697 2703 case NATProtocol_UDP:
Note:
See TracChangeset
for help on using the changeset viewer.