From e532fc83b69ece372c1b536af331ee984511d3c1 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 27 Oct 2017 11:39:02 +0200 Subject: [PATCH] vbox5: use sched_yield instead of pthread_yield Fixes #2551 --- repos/ports/ports/virtualbox5.hash | 2 +- repos/ports/src/virtualbox5/accloff/sup.cc | 8 +++++++- .../ports/src/virtualbox5/patches/vbox_main.patch | 15 --------------- repos/ports/src/virtualbox5/spec/nova/sup.cc | 7 +++++-- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/repos/ports/ports/virtualbox5.hash b/repos/ports/ports/virtualbox5.hash index 51f4dc5c0..d37952282 100644 --- a/repos/ports/ports/virtualbox5.hash +++ b/repos/ports/ports/virtualbox5.hash @@ -1 +1 @@ -e060302687a8d4233ce5b0304a30a7ee59e8d0af +c916354430e16892bbc739aaecd86b9451860326 diff --git a/repos/ports/src/virtualbox5/accloff/sup.cc b/repos/ports/src/virtualbox5/accloff/sup.cc index 6d0d92467..1c3b49a44 100644 --- a/repos/ports/src/virtualbox5/accloff/sup.cc +++ b/repos/ports/src/virtualbox5/accloff/sup.cc @@ -28,6 +28,8 @@ /* Libc include */ #include +#include /* sched_yield */ + /* VirtualBox SUPLib interface */ @@ -130,7 +132,11 @@ HRESULT genode_setup_machine(ComObjPtr machine) } -extern "C" void pthread_yield() { Genode::warning(__func__, " unimplemented"); } +extern "C" int sched_yield(void) +{ + Genode::warning(__func__, " unimplemented"); + return -1; +} int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages, PRTR0PTR pR0Ptr, PSUPPAGE paPages) diff --git a/repos/ports/src/virtualbox5/patches/vbox_main.patch b/repos/ports/src/virtualbox5/patches/vbox_main.patch index 7a6d01160..8401df1a8 100644 --- a/repos/ports/src/virtualbox5/patches/vbox_main.patch +++ b/repos/ports/src/virtualbox5/patches/vbox_main.patch @@ -1057,21 +1057,6 @@ index a717aff..3d52b9f 100644 int rc = RTLogGroupSettings(RTLogRelGetDefaultInstance(), useLoggingLevel.c_str()); // If failed and not the default logging level - try to use the default logging level. if (RT_FAILURE(rc)) ---- a/src/app/virtualbox/src/VBox/Runtime/r3/posix/semevent-posix.cpp -+++ b/src/app/virtualbox/src/VBox/Runtime/r3/posix/semevent-posix.cpp -@@ -49,10 +49,12 @@ - # define pthread_yield() pthread_yield_np() - #endif - -+#if 0 - #if defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) - # include - # define pthread_yield() sched_yield() - #endif -+#endif - - - /********************************************************************************************************************************* --- a/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp +++ b/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp @@ -71,6 +71,8 @@ diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc index 8fb177c2f..5dd07ffd8 100644 --- a/repos/ports/src/virtualbox5/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc @@ -41,6 +41,9 @@ /* libc memory allocator */ #include +/* libc */ +#include /* sched_yield */ + #include "mm.h" @@ -753,9 +756,9 @@ bool PGMUnmapMemoryGenode(void * vmm_local, ::size_t size) } -extern "C" void pthread_yield(void) +extern "C" int sched_yield(void) { - Nova::ec_ctrl(Nova::EC_YIELD); + return (Nova::ec_ctrl(Nova::EC_YIELD) == Nova::NOVA_OK) ? 0 : -1; }