vbox: map SUPSemEvent* to RTSemEvent*

and drop usage of Genode::Semaphore.

Issue #2110
This commit is contained in:
Alexander Boettcher 2016-10-05 15:29:10 +02:00 committed by Christian Helmuth
parent 07b994c8bd
commit a5ff866ef7
2 changed files with 19 additions and 41 deletions

View File

@ -13,8 +13,6 @@
/* Genode includes */ /* Genode includes */
#include <os/attached_ram_dataspace.h> #include <os/attached_ram_dataspace.h>
#include <base/semaphore.h>
#include <os/timed_semaphore.h>
#include <trace/timestamp.h> #include <trace/timestamp.h>
/* Genode/Virtualbox includes */ /* Genode/Virtualbox includes */
@ -184,44 +182,35 @@ uint32_t SUPSemEventMultiGetResolution(PSUPDRVSESSION)
return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ return 100000*10; /* called by 'vmR3HaltGlobal1Init' */
} }
int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent)
{ {
*phEvent = (SUPSEMEVENT)new Genode::Semaphore(); return RTSemEventCreate((PRTSEMEVENT)phEvent);
return VINF_SUCCESS;
} }
int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
{ {
if (hEvent) Assert (hEvent);
delete reinterpret_cast<Genode::Semaphore *>(hEvent);
return VINF_SUCCESS; return RTSemEventDestroy((RTSEMEVENT)hEvent);
} }
int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
{ {
if (hEvent) Assert (hEvent);
reinterpret_cast<Genode::Semaphore *>(hEvent)->up();
else
Genode::error(__FUNCTION__, " called - not implemented");
return VINF_SUCCESS; return RTSemEventSignal((RTSEMEVENT)hEvent);
} }
int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent,
uint32_t cMillies) uint32_t cMillies)
{ {
if (hEvent && cMillies == RT_INDEFINITE_WAIT) Assert (hEvent);
reinterpret_cast<Genode::Semaphore *>(hEvent)->down();
else {
Genode::error(__FUNCTION__, " called millis=", cMillies,
" - not implemented");
reinterpret_cast<Genode::Semaphore *>(hEvent)->down();
}
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 && AssertMsg(uOperation != VMMR0_DO_VMMR0_TERM &&
uOperation != VMMR0_DO_CALL_HYPERVISOR && uOperation != VMMR0_DO_CALL_HYPERVISOR &&
uOperation != VMMR0_DO_GVMM_DESTROY_VM, uOperation != VMMR0_DO_GVMM_DESTROY_VM,
("SUPR3CallVMMR0Ex: unhandled uOperation %d", uOperation)); ("SUPR3CallVMMR0: unhandled uOperation %d", uOperation));
return VERR_GENERAL_FAILURE; return VERR_GENERAL_FAILURE;
} }

View File

@ -13,8 +13,6 @@
/* Genode includes */ /* Genode includes */
#include <os/attached_ram_dataspace.h> #include <os/attached_ram_dataspace.h>
#include <base/semaphore.h>
#include <os/timed_semaphore.h>
#include <trace/timestamp.h> #include <trace/timestamp.h>
/* Genode/Virtualbox includes */ /* Genode/Virtualbox includes */
@ -185,44 +183,35 @@ uint32_t SUPSemEventMultiGetResolution(PSUPDRVSESSION)
return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ return 100000*10; /* called by 'vmR3HaltGlobal1Init' */
} }
int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent)
{ {
*phEvent = (SUPSEMEVENT)new Genode::Semaphore(); return RTSemEventCreate((PRTSEMEVENT)phEvent);
return VINF_SUCCESS;
} }
int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
{ {
if (hEvent) Assert (hEvent);
delete reinterpret_cast<Genode::Semaphore *>(hEvent);
return VINF_SUCCESS; return RTSemEventDestroy((RTSEMEVENT)hEvent);
} }
int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
{ {
if (hEvent) Assert (hEvent);
reinterpret_cast<Genode::Semaphore *>(hEvent)->up();
else
Genode::error(__FUNCTION__, " called - not implemented");
return VINF_SUCCESS; return RTSemEventSignal((RTSEMEVENT)hEvent);
} }
int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent,
uint32_t cMillies) uint32_t cMillies)
{ {
if (hEvent && cMillies == RT_INDEFINITE_WAIT) Assert (hEvent);
reinterpret_cast<Genode::Semaphore *>(hEvent)->down();
else {
Genode::error(__FUNCTION__, " called millis=", cMillies,
" - not implemented");
reinterpret_cast<Genode::Semaphore *>(hEvent)->down();
}
return VINF_SUCCESS; return RTSemEventWaitNoResume((RTSEMEVENT)hEvent, cMillies);
} }