From a5ff866ef7511ba0ec6b58e6b4a151da556400fa Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 5 Oct 2016 15:29:10 +0200 Subject: [PATCH] vbox: map SUPSemEvent* to RTSemEvent* and drop usage of Genode::Semaphore. Issue #2110 --- repos/ports/src/virtualbox/sup.cc | 31 ++++++++++-------------------- repos/ports/src/virtualbox5/sup.cc | 29 +++++++++------------------- 2 files changed, 19 insertions(+), 41 deletions(-) diff --git a/repos/ports/src/virtualbox/sup.cc b/repos/ports/src/virtualbox/sup.cc index 5882c10e8..416e71537 100644 --- a/repos/ports/src/virtualbox/sup.cc +++ b/repos/ports/src/virtualbox/sup.cc @@ -13,8 +13,6 @@ /* Genode includes */ #include -#include -#include #include /* Genode/Virtualbox includes */ @@ -184,44 +182,35 @@ uint32_t SUPSemEventMultiGetResolution(PSUPDRVSESSION) return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ } + int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) { - *phEvent = (SUPSEMEVENT)new Genode::Semaphore(); - return VINF_SUCCESS; + return RTSemEventCreate((PRTSEMEVENT)phEvent); } int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) { - if (hEvent) - delete reinterpret_cast(hEvent); - return VINF_SUCCESS; + Assert (hEvent); + + return RTSemEventDestroy((RTSEMEVENT)hEvent); } int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) { - if (hEvent) - reinterpret_cast(hEvent)->up(); - else - Genode::error(__FUNCTION__, " called - not implemented"); + Assert (hEvent); - return VINF_SUCCESS; + return RTSemEventSignal((RTSEMEVENT)hEvent); } int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies) { - if (hEvent && cMillies == RT_INDEFINITE_WAIT) - reinterpret_cast(hEvent)->down(); - else { - Genode::error(__FUNCTION__, " called millis=", cMillies, - " - not implemented"); - reinterpret_cast(hEvent)->down(); - } + Assert (hEvent); - return VINF_SUCCESS; + return RTSemEventWaitNoResume((RTSEMEVENT)hEvent, cMillies); } @@ -271,7 +260,7 @@ int SUPR3CallVMMR0(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, AssertMsg(uOperation != VMMR0_DO_VMMR0_TERM && uOperation != VMMR0_DO_CALL_HYPERVISOR && uOperation != VMMR0_DO_GVMM_DESTROY_VM, - ("SUPR3CallVMMR0Ex: unhandled uOperation %d", uOperation)); + ("SUPR3CallVMMR0: unhandled uOperation %d", uOperation)); return VERR_GENERAL_FAILURE; } diff --git a/repos/ports/src/virtualbox5/sup.cc b/repos/ports/src/virtualbox5/sup.cc index 1285487b5..00f82977f 100644 --- a/repos/ports/src/virtualbox5/sup.cc +++ b/repos/ports/src/virtualbox5/sup.cc @@ -13,8 +13,6 @@ /* Genode includes */ #include -#include -#include #include /* Genode/Virtualbox includes */ @@ -185,44 +183,35 @@ uint32_t SUPSemEventMultiGetResolution(PSUPDRVSESSION) return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ } + int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) { - *phEvent = (SUPSEMEVENT)new Genode::Semaphore(); - return VINF_SUCCESS; + return RTSemEventCreate((PRTSEMEVENT)phEvent); } int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) { - if (hEvent) - delete reinterpret_cast(hEvent); - return VINF_SUCCESS; + Assert (hEvent); + + return RTSemEventDestroy((RTSEMEVENT)hEvent); } int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) { - if (hEvent) - reinterpret_cast(hEvent)->up(); - else - Genode::error(__FUNCTION__, " called - not implemented"); + Assert (hEvent); - return VINF_SUCCESS; + return RTSemEventSignal((RTSEMEVENT)hEvent); } int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies) { - if (hEvent && cMillies == RT_INDEFINITE_WAIT) - reinterpret_cast(hEvent)->down(); - else { - Genode::error(__FUNCTION__, " called millis=", cMillies, - " - not implemented"); - reinterpret_cast(hEvent)->down(); - } + Assert (hEvent); - return VINF_SUCCESS; + return RTSemEventWaitNoResume((RTSEMEVENT)hEvent, cMillies); }