From 106a0db6646f06baa79576c60c23a5773ca6dc63 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 3 May 2017 14:02:42 +0200 Subject: [PATCH] vbox5: update to 5.1.22 Issue #2338 --- repos/ports/lib/mk/virtualbox5-runtime.mk | 1 + repos/ports/lib/mk/virtualbox5-vmm.mk | 1 + repos/ports/ports/virtualbox5.hash | 2 +- repos/ports/ports/virtualbox5.port | 10 ++-- repos/ports/run/vbox5_win7_32.run | 1 - repos/ports/src/virtualbox/frontend/main.cc | 1 - .../src/virtualbox/include/VBox/com/ptr.h | 9 --- repos/ports/src/virtualbox/sup.cc | 2 +- repos/ports/src/virtualbox5/frontend/main.cc | 1 - repos/ports/src/virtualbox5/mm.cc | 60 +------------------ .../src/virtualbox5/patches/iem_wip.patch | 48 +++++++++++++++ repos/ports/src/virtualbox5/patches/mm.patch | 32 ++++++++++ .../src/virtualbox5/patches/vbox_main.patch | 41 +++++++------ repos/ports/src/virtualbox5/pgm.cc | 17 ++++++ repos/ports/src/virtualbox5/spec/nova/sup.cc | 7 ++- repos/ports/src/virtualbox5/sup.cc | 2 +- repos/ports/src/virtualbox5/unimpl.cc | 4 +- 17 files changed, 138 insertions(+), 101 deletions(-) diff --git a/repos/ports/lib/mk/virtualbox5-runtime.mk b/repos/ports/lib/mk/virtualbox5-runtime.mk index dfd7dc8be0..2f6941c1b8 100644 --- a/repos/ports/lib/mk/virtualbox5-runtime.mk +++ b/repos/ports/lib/mk/virtualbox5-runtime.mk @@ -167,6 +167,7 @@ SRC_S += Runtime/common/asm/ASMAtomicUoReadU64.as SRC_S += Runtime/common/asm/ASMAtomicXchgU64.asm SRC_S += Runtime/common/asm/ASMCpuIdExSlow.asm SRC_S += Runtime/common/asm/ASMGetXcr0.asm +SRC_S += Runtime/common/asm/ASMFxSave.asm SRC_S += Runtime/common/asm/ASMMemFirstMismatchingU8.asm SRC_CC += Runtime/common/err/errmsg.cpp diff --git a/repos/ports/lib/mk/virtualbox5-vmm.mk b/repos/ports/lib/mk/virtualbox5-vmm.mk index d956a314be..71886a55b1 100644 --- a/repos/ports/lib/mk/virtualbox5-vmm.mk +++ b/repos/ports/lib/mk/virtualbox5-vmm.mk @@ -93,6 +93,7 @@ SRC_CC += VMM/VMMAll/APICAll.cpp endif SRC_CC += VMM/VMMR3/MM.cpp +SRC_CC += VMM/VMMR3/MMHeap.cpp CC_OPT += -DVBOX_IN_VMM diff --git a/repos/ports/ports/virtualbox5.hash b/repos/ports/ports/virtualbox5.hash index 6c54687b12..2e03f0868c 100644 --- a/repos/ports/ports/virtualbox5.hash +++ b/repos/ports/ports/virtualbox5.hash @@ -1 +1 @@ -e64afa88d6d63dea8d07b6d01316dcf18905b999 +63197fb01f1442acf40937798b78d036450296bd diff --git a/repos/ports/ports/virtualbox5.port b/repos/ports/ports/virtualbox5.port index cbcd8d1d7c..073500cd36 100644 --- a/repos/ports/ports/virtualbox5.port +++ b/repos/ports/ports/virtualbox5.port @@ -1,17 +1,17 @@ LICENSE := GPLv2 -VERSION := 5.1.20 +VERSION := 5.1.22 DOWNLOADS := virtualbox.archive virtualbox_sdk.archive VIRTUALBOX_TBZ2 := VirtualBox-$(VERSION).tar.bz2 -VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-114628.zip +VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-115126.zip URL(virtualbox) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_TBZ2) DIR(virtualbox) := src/app/virtualbox -SHA(virtualbox) := 13eb1890c6315c2e3f25cc9a00e7671549592452 +SHA(virtualbox) := 57e6f73f62af7d5ddb670972ba0417b6fcb43950 URL(virtualbox_sdk) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_SDK_ZIP) DIR(virtualbox_sdk) := src/app/virtualbox_sdk -SHA(virtualbox_sdk) := 2e733662fef8580bb501825da89d7e9858540533 +SHA(virtualbox_sdk) := 21b45da69214b32cf7f7115ef53e0c1d77ae2434 PATCHES_DIR := src/virtualbox5/patches PATCHES_DIR_VBOX4 := src/virtualbox/patches @@ -64,7 +64,7 @@ VBOX_MAIN_INC += MediumLock MouseImpl NATEngineImpl NATNetworkImpl VBOX_MAIN_INC += NetworkAdapterImpl NetworkServiceRunner VBOX_MAIN_INC += objectslist ObjectState VBOX_MAIN_INC += ParallelPortImpl PCIDeviceAttachmentImpl Performance -VBOX_MAIN_INC += ProgressImpl ProgressProxyImpl SnapshotImpl +VBOX_MAIN_INC += ProgressImpl ProgressProxyImpl QMTranslator SnapshotImpl VBOX_MAIN_INC += SecretKeyStore SerialPortImpl SessionImpl SharedFolderImpl VBOX_MAIN_INC += StorageControllerImpl SystemPropertiesImpl TokenImpl VMMDev VBOX_MAIN_INC += UsbWebcamInterface diff --git a/repos/ports/run/vbox5_win7_32.run b/repos/ports/run/vbox5_win7_32.run index 925e3beeb7..71833ed94e 100644 --- a/repos/ports/run/vbox5_win7_32.run +++ b/repos/ports/run/vbox5_win7_32.run @@ -3,7 +3,6 @@ # assert_spec nova -assert_spec 64bit set flavor "win7" diff --git a/repos/ports/src/virtualbox/frontend/main.cc b/repos/ports/src/virtualbox/frontend/main.cc index c8c7d19f32..2ade9d48d3 100644 --- a/repos/ports/src/virtualbox/frontend/main.cc +++ b/repos/ports/src/virtualbox/frontend/main.cc @@ -135,7 +135,6 @@ HRESULT setupmachine(Genode::Env &env) /* handle input of Genode and forward it to VMM layer */ static ComPtr genodeConsole = gConsole; - RTLogPrintf("genodeConsole = %p\n", genodeConsole); genodeConsole->init_clipboard(); diff --git a/repos/ports/src/virtualbox/include/VBox/com/ptr.h b/repos/ports/src/virtualbox/include/VBox/com/ptr.h index 758ff8df1c..63f8525fd3 100644 --- a/repos/ports/src/virtualbox/include/VBox/com/ptr.h +++ b/repos/ports/src/virtualbox/include/VBox/com/ptr.h @@ -44,15 +44,6 @@ class ComPtr { return operator=((T*)that); } - template - ComPtr& operator=(T2 *p) - { - _obj = dynamic_cast(p); - if (!_obj) - Genode::log(__func__, ": dynamic cast failed"); - return *this; - } - ComPtr& operator=(T *p) { _obj = p; diff --git a/repos/ports/src/virtualbox/sup.cc b/repos/ports/src/virtualbox/sup.cc index 1747b97396..bef5e583a8 100644 --- a/repos/ports/src/virtualbox/sup.cc +++ b/repos/ports/src/virtualbox/sup.cc @@ -384,7 +384,7 @@ HRESULT genode_check_memory_config(ComObjPtr machine) if (memory_vbox + memory_vmm > memory_genode) { using Genode::error; - error("Configured memory ", memory_vmm, " MB (vbox file) is insufficient."); + error("Configured memory ", memory_vbox, " MB (vbox file) is insufficient."); error(memory_genode, " MB (1) - ", memory_vmm, " MB (2) = ", memory_genode - memory_vmm, " MB (3)"); diff --git a/repos/ports/src/virtualbox5/frontend/main.cc b/repos/ports/src/virtualbox5/frontend/main.cc index 389b2f599f..bd5d0d2d42 100644 --- a/repos/ports/src/virtualbox5/frontend/main.cc +++ b/repos/ports/src/virtualbox5/frontend/main.cc @@ -151,7 +151,6 @@ HRESULT setupmachine(Genode::Env &env) /* handle input of Genode and forward it to VMM layer */ static ComPtr genodeConsole = gConsole; - RTLogPrintf("genodeConsole = %p\n", genodeConsole); genodeConsole->init_clipboard(); diff --git a/repos/ports/src/virtualbox5/mm.cc b/repos/ports/src/virtualbox5/mm.cc index a2fe3d90d4..8077c8e507 100644 --- a/repos/ports/src/virtualbox5/mm.cc +++ b/repos/ports/src/virtualbox5/mm.cc @@ -168,14 +168,12 @@ int MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv) int MMR3HyperInitFinalize(PVM) { - Genode::log(__func__, " called"); return VINF_SUCCESS; } int MMR3HyperSetGuard(PVM, void* ptr, size_t, bool) { - Genode::log(__func__, " called ", ptr); return VINF_SUCCESS; } @@ -297,47 +295,6 @@ int MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, } -char * MMR3HeapStrDupU(PUVM pUVM, MMTAG enmTag, const char *string) -{ - if (!string) - return NULL; - - size_t len = strlen(string) + 1; - char *dup = reinterpret_cast(MMR3HeapAllocU(pUVM, enmTag, len)); - if (dup) - memcpy(dup, string, len); - - return dup; -} - - -char * MMR3HeapStrDup(PVM pVM, MMTAG enmTag, const char *string) -{ - Assert(pVM); - Assert(pVM->pUVM); - return MMR3HeapStrDupU(pVM->pUVM, enmTag, string); -} - - -char * MMR3HeapAPrintfVU(PUVM pUVM, MMTAG enmTag, const char *pszFormat, va_list va) -{ - /* - * The lazy bird way. - */ - char *psz; - int cch = RTStrAPrintfV(&psz, pszFormat, va); - if (cch < 0) - return NULL; - Assert(psz[cch] == '\0'); - char *pszRet = (char *)MMR3HeapAllocU(pUVM, enmTag, cch + 1); - if (pszRet) - memcpy(pszRet, psz, cch + 1); - RTStrFree(psz); - Genode::log(__func__, " called ", Genode::Cstring(pszRet), " ", Genode::Cstring(pszFormat)); - return pszRet; -} - - VMMR3DECL(RTHCPHYS) MMR3HyperHCVirt2HCPhys(PVM pVM, void *pvR3) { return (RTHCPHYS)(uintptr_t)pvR3; } @@ -360,7 +317,8 @@ VMMR3DECL(void *) MMR3PageAllocLow(PVM pVM) { return MMR3PageAlloc(pVM); } int MMR3ReserveHandyPages(PVM pVM, uint32_t cHandyPages) { - Genode::log(__func__, " called"); + if (VERBOSE_MM) + Genode::log(__func__, " called"); return VINF_SUCCESS; } @@ -384,17 +342,3 @@ VMMDECL(uint32_t) MMHyperHeapPtrToOffset(PVM pVM, void *pv) return offset; } - - -extern "C" { - -char * MMR3HeapAPrintf(PVM pVM, MMTAG enmTag, const char *pszFormat, ...) -{ - va_list va; - va_start(va, pszFormat); - char *psz = MMR3HeapAPrintfVU(pVM->pUVM, enmTag, pszFormat, va); - va_end(va); - return psz; -} - -} diff --git a/repos/ports/src/virtualbox5/patches/iem_wip.patch b/repos/ports/src/virtualbox5/patches/iem_wip.patch index d2e1b40bd5..2fa84d1338 100644 --- a/repos/ports/src/virtualbox5/patches/iem_wip.patch +++ b/repos/ports/src/virtualbox5/patches/iem_wip.patch @@ -137,3 +137,51 @@ break; } if (pVM->pgm.s.aHandyPages[i].idSharedPage == idPage) +--- a/src/app/virtualbox/src/VBox/VMM/VMMR3/IEMR3.cpp ++++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/IEMR3.cpp +@@ -195,8 +195,10 @@ + for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) + { + pVM->aCpus[idCpu].iem.s.pCtxRC = VM_RC_ADDR(pVM, pVM->aCpus[idCpu].iem.s.pCtxR3); ++#if defined(VBOX_WITH_STATISTICS) + if (pVM->aCpus[idCpu].iem.s.pStatsRC) + pVM->aCpus[idCpu].iem.s.pStatsRC = MMHyperR3ToRC(pVM, pVM->aCpus[idCpu].iem.s.pStatsCCR3); ++#endif + } + } + +--- a/src/app/virtualbox/src/VBox/VMM/include/IEMInternal.h ++++ b/src/app/virtualbox/src/VBox/VMM/include/IEMInternal.h +@@ -83,7 +83,7 @@ + + //#define IEM_WITH_CODE_TLB// - work in progress + +- ++#if defined(VBOX_WITH_STATISTICS) + #if !defined(IN_TSTVMSTRUCT) && !defined(DOXYGEN_RUNNING) + /** Instruction statistics. */ + typedef struct IEMINSTRSTATS +@@ -98,6 +98,7 @@ + #endif + /** Pointer to IEM instruction statistics. */ + typedef IEMINSTRSTATS *PIEMINSTRSTATS; ++#endif + + /** Finish and move to types.h */ + typedef union +@@ -727,6 +728,7 @@ + /** Pointer to the CPU context - raw-mode context. */ + RCPTRTYPE(PCPUMCTX) pCtxRC; + ++#if defined(VBOX_WITH_STATISTICS) + /** Pointer to instruction statistics for raw-mode context (same as R0). */ + RCPTRTYPE(PIEMINSTRSTATS) pStatsRC; + /** Pointer to instruction statistics for ring-0 context (same as RC). */ +@@ -735,6 +737,7 @@ + R3PTRTYPE(PIEMINSTRSTATS) pStatsCCR3; + /** Pointer to instruction statistics for ring-3 context. */ + R3PTRTYPE(PIEMINSTRSTATS) pStatsR3; ++#endif + + #ifdef IEM_VERIFICATION_MODE_FULL + /** The event verification records for what IEM did (LIFO). */ diff --git a/repos/ports/src/virtualbox5/patches/mm.patch b/repos/ports/src/virtualbox5/patches/mm.patch index 27f87345b1..666c570218 100644 --- a/repos/ports/src/virtualbox5/patches/mm.patch +++ b/repos/ports/src/virtualbox5/patches/mm.patch @@ -96,3 +96,35 @@ /** +--- a/src/app/virtualbox/src/VBox/VMM/VMMR3/MMHeap.cpp ++++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/MMHeap.cpp +@@ -34,6 +34,7 @@ + #include + #include + ++#if 0 + + /********************************************************************************************************************************* + * Internal Functions * +@@ -510,6 +511,7 @@ + return pHdrNew + 1; + } + ++#endif /*#if 0 */ + + /** + * Duplicates the specified string. +@@ -632,6 +634,7 @@ + return pszRet; + } + ++#if 0 + + /** + * Releases memory allocated with MMR3HeapAlloc() or MMR3HeapRealloc(). +@@ -693,4 +696,4 @@ + */ + RTMemFree(pHdr); + } +- ++#endif /* #if 0 */ diff --git a/repos/ports/src/virtualbox5/patches/vbox_main.patch b/repos/ports/src/virtualbox5/patches/vbox_main.patch index f901ca309d..7a6d011601 100644 --- a/repos/ports/src/virtualbox5/patches/vbox_main.patch +++ b/repos/ports/src/virtualbox5/patches/vbox_main.patch @@ -493,15 +493,6 @@ index a717aff..3d52b9f 100644 #include #include -@@ -76,7 +76,7 @@ - #include "AutoCaller.h" - #include "Logging.h" - --#include -+//#include - - #ifdef RT_OS_WINDOWS - # include "win/svchlp.h" @@ -4069,6 +4069,9 @@ */ HRESULT VirtualBox::i_saveSettings() @@ -559,18 +550,32 @@ index a717aff..3d52b9f 100644 #include "SchemaDefs.h" --- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp +++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -@@ -8227,8 +8227,14 @@ +@@ -1371,6 +1372,17 @@ + } + } + ++ if (*aParavirtProvider != ParavirtProvider_None) ++ { ++ HRESULT rc = setError(S_OK, tr("ParavirtProvider '%s'(%d) not supported on VBox@Genode."), ++ *aParavirtProvider == ParavirtProvider_Minimal ? "Minimal" : ++ *aParavirtProvider == ParavirtProvider_HyperV ? "HyperV" : ++ *aParavirtProvider == ParavirtProvider_KVM ? "KVM" : "unknown", ++ *aParavirtProvider); ++ *aParavirtProvider = ParavirtProvider_None; ++ return rc; ++ } ++ + Assert( *aParavirtProvider == ParavirtProvider_None + || *aParavirtProvider == ParavirtProvider_Minimal + || *aParavirtProvider == ParavirtProvider_HyperV +@@ -8338,8 +8338,8 @@ { AutoCaller autoCaller(this); AssertComRCReturnRC(autoCaller.rc()); -+#if 0 - AssertComRCReturn( getObjectState().getState() == ObjectState::InInit - || getObjectState().getState() == ObjectState::Limited, E_FAIL); -+#else -+ if (getObjectState().getState() == ObjectState::InInit || -+ getObjectState().getState() == ObjectState::Limited, E_FAIL) -+ Genode::log(__func__, " skip assertion"); -+#endif +- AssertComRCReturn( getObjectState().getState() == ObjectState::InInit +- || getObjectState().getState() == ObjectState::Limited, E_FAIL); ++ AssertReturn( getObjectState().getState() == ObjectState::InInit ++ || getObjectState().getState() == ObjectState::Limited, E_FAIL); AssertReturn(!mData->mAccessible, E_FAIL); diff --git a/repos/ports/src/virtualbox5/pgm.cc b/repos/ports/src/virtualbox5/pgm.cc index 60dd103b7d..5dd24c08a9 100644 --- a/repos/ports/src/virtualbox5/pgm.cc +++ b/repos/ports/src/virtualbox5/pgm.cc @@ -16,6 +16,7 @@ #include /* VirtualBox includes */ +#include "PGMInternal.h" #include static bool verbose = false; @@ -56,3 +57,19 @@ int PGMR3MappingsSize(PVM pVM, uint32_t *pcb) return 0; } + + +int pgmMapActivateCR3(PVM, PPGMPOOLPAGE) +{ + if (verbose) + Genode::log(__func__, ": not implemented ", __builtin_return_address(0)); + return VINF_SUCCESS; +} + + +int pgmMapDeactivateCR3(PVM, PPGMPOOLPAGE) +{ + if (verbose) + Genode::log(__func__, ": not implemented ", __builtin_return_address(0)); + return VINF_SUCCESS; +} diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc index fb22a9e5a3..03746749da 100644 --- a/repos/ports/src/virtualbox5/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc @@ -174,9 +174,12 @@ int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages, Attached_ram_dataspace * ds = new Attached_ram_dataspace(genode_env().ram(), genode_env().rm(), cPages * ONE_PAGE_SIZE); + + Genode::addr_t const vmm_local = reinterpret_cast(ds->local_addr()); + *ppvPages = ds->local_addr(); if (pR0Ptr) - *pR0Ptr = reinterpret_cast(*ppvPages); + *pR0Ptr = vmm_local; Genode::log(__func__, " cPages ", cPages, " alloc=", *ppvPages, " done"); @@ -186,7 +189,7 @@ int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages, for (unsigned iPage = 0; iPage < cPages; iPage++) { paPages[iPage].uReserved = 0; - paPages[iPage].Phys = reinterpret_cast(ds->local_addr()) + iPage * ONE_PAGE_SIZE; + paPages[iPage].Phys = vmm_local + iPage * ONE_PAGE_SIZE; } return VINF_SUCCESS; diff --git a/repos/ports/src/virtualbox5/sup.cc b/repos/ports/src/virtualbox5/sup.cc index 6e6fc53ce9..13ead6eea4 100644 --- a/repos/ports/src/virtualbox5/sup.cc +++ b/repos/ports/src/virtualbox5/sup.cc @@ -387,7 +387,7 @@ HRESULT genode_check_memory_config(ComObjPtr machine) if (memory_vbox + memory_vmm > memory_genode) { using Genode::error; - error("Configured memory ", memory_vmm, " MB (vbox file) is insufficient."); + error("Configured memory ", memory_vbox, " MB (vbox file) is insufficient."); error(memory_genode, " MB (1) - ", memory_vmm, " MB (2) = ", memory_genode - memory_vmm, " MB (3)"); diff --git a/repos/ports/src/virtualbox5/unimpl.cc b/repos/ports/src/virtualbox5/unimpl.cc index 5527be8480..75fa2f61c3 100644 --- a/repos/ports/src/virtualbox5/unimpl.cc +++ b/repos/ports/src/virtualbox5/unimpl.cc @@ -60,7 +60,6 @@ DUMMY(HMR3PatchTprInstr) DUMMY(MMHyperR0ToCC) DUMMY(MMHyperRCToCC) -DUMMY(MMR3HeapAPrintfV) DUMMY(MMR3HyperRealloc) DUMMY(MMR3LockCall) DUMMY(MMR3PageDummyHCPhys) @@ -71,8 +70,6 @@ DUMMY(PDMR3LdrGetInterfaceSymbols) DUMMY(PDMR3LdrQueryRCModFromPC) DUMMY(PDMCritSectBothFF) -DUMMY(pgmMapActivateCR3) -DUMMY(pgmMapDeactivateCR3) DUMMY(pgmMapResolveConflicts) DUMMY(pgmR3SyncPTResolveConflict) DUMMY(pgmR3SyncPTResolveConflictPAE) @@ -80,6 +77,7 @@ DUMMY(pgmR3SyncPTResolveConflictPAE) DUMMY(PGMR3HandlerVirtualRegister) DUMMY(MMPagePhys2PageEx) +DUMMY(PGMR3DbgReadGCPtr) DUMMY(PGMR3DbgR3Ptr2GCPhys) DUMMY(PGMR3MappingsUnfix)