diff --git a/repos/libports/include/qemu/usb.h b/repos/libports/include/qemu/usb.h
index 7f25f9e7b1..5a001595ae 100644
--- a/repos/libports/include/qemu/usb.h
+++ b/repos/libports/include/qemu/usb.h
@@ -17,6 +17,7 @@
#include
#include
+#include
namespace Qemu {
@@ -102,7 +103,7 @@ namespace Qemu {
* \return Pointer to Controller object that is used to access the xHCI device state
*/
Controller *usb_init(Timer_queue &tq, Pci_device &pd,
- Genode::Signal_receiver &sr,
+ Genode::Entrypoint &ep,
Genode::Allocator &, Genode::Env &);
/**
diff --git a/repos/libports/src/lib/libc/libc_init.h b/repos/libports/src/lib/libc/libc_init.h
index ea6c304cd6..c0dfa1fd7b 100644
--- a/repos/libports/src/lib/libc/libc_init.h
+++ b/repos/libports/src/lib/libc/libc_init.h
@@ -16,6 +16,7 @@
/* Genode includes */
#include
+#include
#include
namespace Libc {
diff --git a/repos/libports/src/lib/libc/task.cc b/repos/libports/src/lib/libc/task.cc
index f2ae19c89f..771c550e9f 100644
--- a/repos/libports/src/lib/libc/task.cc
+++ b/repos/libports/src/lib/libc/task.cc
@@ -185,15 +185,6 @@ class Libc::Env_implementation : public Libc::Env
void close(Parent::Client::Id id) override {
return _env.close(id); }
- /*
- * \deprecated
- *
- * Emulation of deprecated part of the 'Env' interface. To be
- * removed once they are removed from 'Genode::Env'.
- */
- Pd_session &ram() override { return pd(); }
- Pd_session_capability ram_session_cap() override { return pd_session_cap(); }
-
/* already done by the libc */
void exec_static_constructors() override { }
diff --git a/repos/libports/src/lib/qemu-usb/dummies.cc b/repos/libports/src/lib/qemu-usb/dummies.cc
index a22346e08a..bbf608f4c5 100644
--- a/repos/libports/src/lib/qemu-usb/dummies.cc
+++ b/repos/libports/src/lib/qemu-usb/dummies.cc
@@ -13,8 +13,8 @@
*/
/* Genode includes */
-#include
#include
+#include
/* local includes */
#include
@@ -30,14 +30,14 @@ enum {
#define TRACE_AND_STOP \
do { \
- PWRN("%s not implemented called from: %p", __func__, __builtin_return_address(0)); \
+ Genode::warning(__func__, " not implemented called from: ", __builtin_return_address(0)); \
Genode::sleep_forever(); \
} while (0)
#define TRACE \
do { \
if (SHOW_TRACE) \
- PWRN("%s not implemented", __func__); \
+ Genode::warning(__func__, " not implemented"); \
} while (0)
diff --git a/repos/libports/src/lib/qemu-usb/host.cc b/repos/libports/src/lib/qemu-usb/host.cc
index b6c1f4f146..a122133598 100644
--- a/repos/libports/src/lib/qemu-usb/host.cc
+++ b/repos/libports/src/lib/qemu-usb/host.cc
@@ -220,14 +220,14 @@ struct Usb_host_device : List::Element
Fifo isoc_read_queue { };
Reconstructible isoc_write_packet { Usb::Packet_descriptor(), nullptr };
- Signal_receiver &sig_rec;
- Signal_dispatcher state_dispatcher { sig_rec, *this, &Usb_host_device::state_change };
+ Entrypoint &_ep;
+ Signal_handler state_dispatcher { _ep, *this, &Usb_host_device::state_change };
Allocator &_alloc;
Allocator_avl _usb_alloc { &_alloc };
Usb::Connection usb_raw; //{ &_usb_alloc, label, 1024*1024, state_dispatcher };
- Signal_dispatcher ack_avail_dispatcher { sig_rec, *this, &Usb_host_device::ack_avail };
+ Signal_handler ack_avail_dispatcher { _ep, *this, &Usb_host_device::ack_avail };
void _release_interfaces()
{
@@ -265,13 +265,13 @@ struct Usb_host_device : List::Element
return result;
}
- Usb_host_device(Signal_receiver &sig_rec, Allocator &alloc,
+ Usb_host_device(Entrypoint &ep, Allocator &alloc,
Env &env, char const *label,
Dev_info info)
:
label(label), _alloc(alloc),
usb_raw(env, &_usb_alloc, label, 6*1024*1024, state_dispatcher),
- info(info), sig_rec(sig_rec)
+ info(info), _ep(ep)
{
usb_raw.tx_channel()->sigh_ack_avail(ack_avail_dispatcher);
@@ -300,7 +300,7 @@ struct Usb_host_device : List::Element
}
}
- void ack_avail(unsigned)
+ void ack_avail()
{
Lock::Guard g(_lock);
@@ -461,7 +461,7 @@ struct Usb_host_device : List::Element
qemu_dev = nullptr;
}
- void state_change(unsigned)
+ void state_change()
{
Lock::Guard g(_lock);
if (usb_raw.plugged())
@@ -876,10 +876,10 @@ static void usb_host_register_types(void)
struct Usb_devices : List
{
- Signal_receiver &_sig_rec;
+ Entrypoint &_ep;
Env &_env;
Allocator &_alloc;
- Signal_dispatcher _device_dispatcher { _sig_rec, *this, &Usb_devices::_devices_update };
+ Signal_handler _device_dispatcher { _ep, *this, &Usb_devices::_devices_update };
Attached_rom_dataspace _devices_rom = { _env, "usb_devices" };
void _garbage_collect()
@@ -903,7 +903,7 @@ struct Usb_devices : List
fn(*d);
}
- void _devices_update(unsigned)
+ void _devices_update()
{
Lock::Guard g(_lock);
@@ -953,7 +953,7 @@ struct Usb_devices : List
try {
Usb_host_device *new_device = new (_alloc)
- Usb_host_device(_sig_rec, _alloc, _env, label.string(),
+ Usb_host_device(_ep, _alloc, _env, label.string(),
dev_info);
insert(new_device);
@@ -974,8 +974,8 @@ struct Usb_devices : List
_garbage_collect();
}
- Usb_devices(Signal_receiver *sig_rec, Allocator &alloc, Env &env)
- : _sig_rec(*sig_rec), _env(env), _alloc(alloc)
+ Usb_devices(Entrypoint &ep, Allocator &alloc, Env &env)
+ : _ep(ep), _env(env), _alloc(alloc)
{
_devices_rom.sigh(_device_dispatcher);
}
@@ -1005,19 +1005,19 @@ extern "C" void usb_host_update_devices()
{
if (_devices == nullptr) return;
- _devices->_devices_update(0);
+ _devices->_devices_update();
}
/*
* Do not use type_init macro because of name mangling
*/
-extern "C" void _type_init_usb_host_register_types(Signal_receiver *sig_rec,
+extern "C" void _type_init_usb_host_register_types(Entrypoint *ep,
Allocator *alloc,
Env *env)
{
usb_host_register_types();
- static Usb_devices devices(sig_rec, *alloc, *env);
+ static Usb_devices devices(*ep, *alloc, *env);
_devices = &devices;
}
diff --git a/repos/libports/src/lib/qemu-usb/qemu_emul.cc b/repos/libports/src/lib/qemu-usb/qemu_emul.cc
index f4d5118c0a..ace84d6f66 100644
--- a/repos/libports/src/lib/qemu-usb/qemu_emul.cc
+++ b/repos/libports/src/lib/qemu-usb/qemu_emul.cc
@@ -14,7 +14,6 @@
/* Genode includes */
#include
-#include
#include
#include
@@ -36,7 +35,7 @@ static bool const verbose_iov = false;
static bool const verbose_mmio = false;
extern "C" void _type_init_usb_register_types();
-extern "C" void _type_init_usb_host_register_types(Genode::Signal_receiver*,
+extern "C" void _type_init_usb_host_register_types(Genode::Entrypoint*,
Genode::Allocator*,
Genode::Env *);
extern "C" void _type_init_xhci_register_types();
@@ -52,7 +51,7 @@ static Qemu::Pci_device* _pci_device;
static Genode::Allocator *_heap = nullptr;
Qemu::Controller *Qemu::usb_init(Timer_queue &tq, Pci_device &pci,
- Genode::Signal_receiver &sig_rec,
+ Genode::Entrypoint &ep,
Genode::Allocator &alloc, Genode::Env &env)
{
_heap = &alloc;
@@ -61,7 +60,7 @@ Qemu::Controller *Qemu::usb_init(Timer_queue &tq, Pci_device &pci,
_type_init_usb_register_types();
_type_init_xhci_register_types();
- _type_init_usb_host_register_types(&sig_rec, &alloc, &env);
+ _type_init_usb_host_register_types(&ep, &alloc, &env);
return qemu_controller();
}
@@ -108,10 +107,14 @@ void *memset(void *s, int c, size_t n) {
void q_printf(char const *fmt, ...)
{
- va_list va;
- va_start(va, fmt);
- Genode::vprintf(fmt, va);
- va_end(va);
+ enum { BUF_SIZE = 128 };
+ char buf[BUF_SIZE] { };
+ va_list args;
+ va_start(args, fmt);
+ Genode::String_console sc(buf, BUF_SIZE);
+ sc.vprintf(fmt, args);
+ Genode::log(Genode::Cstring(buf));
+ va_end(args);
}
diff --git a/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc b/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc
index d98d5ff9b0..9773ea8ade 100644
--- a/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc
+++ b/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc
@@ -27,7 +27,6 @@
*/
#include
-#include
#include
#include
#include
@@ -155,7 +154,7 @@ void _eglutNativeEventLoop()
if (win->display_cb)
win->display_cb();
- if (eglut_win.is_constructed()) {
+ if (eglut_win.constructed()) {
eglWaitClient();
eglSwapBuffers(_eglut->dpy, win->surface);
eglut_win->refresh();
diff --git a/repos/libports/src/test/stdcxx/main.cc b/repos/libports/src/test/stdcxx/main.cc
index ad892b8ff1..a46a270d71 100644
--- a/repos/libports/src/test/stdcxx/main.cc
+++ b/repos/libports/src/test/stdcxx/main.cc
@@ -12,8 +12,6 @@
* under the terms of the GNU Affero General Public License version 3.
*/
-#include
-
#include
#include
#include
diff --git a/repos/os/include/gpio/component.h b/repos/os/include/gpio/component.h
index 9bbbf4e7b6..27aaeb9165 100644
--- a/repos/os/include/gpio/component.h
+++ b/repos/os/include/gpio/component.h
@@ -14,7 +14,6 @@
#ifndef _INCLUDE__GPIO__COMPONENT_H_
#define _INCLUDE__GPIO__COMPONENT_H_
-#include
#include
#include
#include
diff --git a/repos/os/include/spec/rpi/platform/property_message.h b/repos/os/include/spec/rpi/platform/property_message.h
index b2f68bde62..d080f9837c 100644
--- a/repos/os/include/spec/rpi/platform/property_message.h
+++ b/repos/os/include/spec/rpi/platform/property_message.h
@@ -16,7 +16,7 @@
/* Genode includes */
#include
-#include
+#include
/* board-specific includes */
#include
@@ -207,14 +207,13 @@ struct Platform::Property_message
void dump(char const *label)
{
unsigned const *buf = (unsigned *)this;
- printf("%s message:\n", label);
+ log(label, " message:");
for (unsigned i = 0;; i++) {
for (unsigned j = 0; j < 8; j++) {
unsigned const msg_word_idx = i*8 + j;
- printf(" %08x", buf[msg_word_idx]);
+ log(" ", Hex(buf[msg_word_idx]));
if (msg_word_idx*sizeof(unsigned) < buf_size)
continue;
- printf("\n");
return;
}
}
diff --git a/repos/os/src/drivers/gpio/spec/exynos4/gpio.h b/repos/os/src/drivers/gpio/spec/exynos4/gpio.h
index 0093111399..40207b089c 100644
--- a/repos/os/src/drivers/gpio/spec/exynos4/gpio.h
+++ b/repos/os/src/drivers/gpio/spec/exynos4/gpio.h
@@ -21,8 +21,6 @@
#include
#include
-#include
-
namespace Gpio {
class Reg;
@@ -72,7 +70,7 @@ struct Gpio::Reg : Attached_io_mem_dataspace, Mmio
case 5: write(value); break;
case 6: write(value); break;
case 7: write(value); break;
- default: PWRN("Not is valid irq con!");
+ default: warning("Not is valid irq con!");
}
}
};
diff --git a/repos/os/src/drivers/gpio/spec/imx/driver.h b/repos/os/src/drivers/gpio/spec/imx/driver.h
index b50a93b652..0cd2224c06 100644
--- a/repos/os/src/drivers/gpio/spec/imx/driver.h
+++ b/repos/os/src/drivers/gpio/spec/imx/driver.h
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
/* local includes */
#include
diff --git a/repos/os/src/drivers/gpio/spec/omap4/main.cc b/repos/os/src/drivers/gpio/spec/omap4/main.cc
index 77eb83c7f7..db87024e13 100644
--- a/repos/os/src/drivers/gpio/spec/omap4/main.cc
+++ b/repos/os/src/drivers/gpio/spec/omap4/main.cc
@@ -20,7 +20,6 @@
#include
#include
#include
-#include
/* local includes */
#include
diff --git a/repos/os/src/drivers/gpio/spec/rpi/gpio.h b/repos/os/src/drivers/gpio/spec/rpi/gpio.h
index eb34d4108c..6470a7f532 100644
--- a/repos/os/src/drivers/gpio/spec/rpi/gpio.h
+++ b/repos/os/src/drivers/gpio/spec/rpi/gpio.h
@@ -18,7 +18,6 @@
#define _DRIVERS__GPIO__SPEC__RPI__GPIO_H_
/* Genode includes */
-#include
#include
#include
#include
diff --git a/repos/os/src/drivers/gpio/spec/rpi/main.cc b/repos/os/src/drivers/gpio/spec/rpi/main.cc
index 324107e928..82088c6546 100644
--- a/repos/os/src/drivers/gpio/spec/rpi/main.cc
+++ b/repos/os/src/drivers/gpio/spec/rpi/main.cc
@@ -20,7 +20,6 @@
#include
#include
#include
-#include
/* local includes */
#include "driver.h"
diff --git a/repos/os/src/drivers/input/spec/imx53/irq_handler.h b/repos/os/src/drivers/input/spec/imx53/irq_handler.h
index a6c34371bf..75f8b37464 100644
--- a/repos/os/src/drivers/input/spec/imx53/irq_handler.h
+++ b/repos/os/src/drivers/input/spec/imx53/irq_handler.h
@@ -21,25 +21,31 @@ class Irq_handler
{
private:
- Genode::Irq_connection _irq;
- Genode::Signal_receiver _sig_rec { };
- Genode::Signal_dispatcher _dispatcher;
+ Genode::Env &_env;
+ Genode::Irq_connection _irq;
+ Genode::Signal_handler _handler;
- void _handle(unsigned) { }
+ unsigned _sem_cnt = 1;
+ void _handle() { _sem_cnt = 0; }
public:
Irq_handler(Genode::Env &env, int irq_number)
:
- _irq(env, irq_number),
- _dispatcher(_sig_rec, *this, &Irq_handler::_handle)
+ _env(env), _irq(env, irq_number),
+ _handler(env.ep(), *this, &Irq_handler::_handle)
{
- _irq.sigh(_dispatcher);
+ _irq.sigh(_handler);
_irq.ack_irq();
}
- void wait() { _sig_rec.wait_for_signal(); }
+ void wait()
+ {
+ _sem_cnt++;
+ while (_sem_cnt > 0)
+ _env.ep().wait_and_dispatch_one_io_signal();
+ }
void ack() { _irq.ack_irq(); }
};
diff --git a/repos/os/src/drivers/input/spec/imx53/main.cc b/repos/os/src/drivers/input/spec/imx53/main.cc
index 0df3de1524..da0559fa09 100644
--- a/repos/os/src/drivers/input/spec/imx53/main.cc
+++ b/repos/os/src/drivers/input/spec/imx53/main.cc
@@ -20,7 +20,6 @@
#include
#include
#include
-#include
/* local includes */
#include
diff --git a/repos/os/src/drivers/nic/spec/gem/cadence_gem.h b/repos/os/src/drivers/nic/spec/gem/cadence_gem.h
index 9e887d8e14..56f0eec982 100644
--- a/repos/os/src/drivers/nic/spec/gem/cadence_gem.h
+++ b/repos/os/src/drivers/nic/spec/gem/cadence_gem.h
@@ -448,7 +448,7 @@ namespace Genode
/* Wait till MDIO interface is ready to accept a new transaction. */
while (!read()) {
if (timeout <= 0) {
- PWRN("%s: Timeout\n", __func__);
+ warning(__func__, ": Timeout");
throw Phy_timeout_for_idle();
}
@@ -644,7 +644,7 @@ namespace Genode
Genode::Packet_descriptor packet = _tx.sink()->get_packet();
if (!packet.size()) {
- PWRN("Invalid tx packet");
+ Genode::warning("Invalid tx packet");
return true;
}
diff --git a/repos/os/src/drivers/nic/spec/gem/marvell_phy.h b/repos/os/src/drivers/nic/spec/gem/marvell_phy.h
index 94747bfdf5..23b81107f2 100644
--- a/repos/os/src/drivers/nic/spec/gem/marvell_phy.h
+++ b/repos/os/src/drivers/nic/spec/gem/marvell_phy.h
@@ -16,7 +16,6 @@
#define _INCLUDE__DRIVERS__NIC__GEM__MARVELL_PHY_H_
/* Genode includes */
-#include
#include
#include
#include
@@ -483,7 +482,7 @@ namespace Genode
}
if ((i++ % 500) == 0)
- Genode::printf(".");
+ Genode::log(".");
_timer.msleep(1);
mii_reg = phy_read();
@@ -525,7 +524,7 @@ namespace Genode
}
if ((i++ % 1000) == 0)
- Genode::printf(".");
+ Genode::log(".");
_timer.msleep(1);
}
log(" done");
diff --git a/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h b/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h
index fb4ef36a75..3edb90a3e8 100644
--- a/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h
+++ b/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h
@@ -16,7 +16,7 @@
/* Genode includes */
#include
-#include
+#include
/* board-specific includes */
#include
@@ -42,19 +42,19 @@ struct Platform::Framebuffer_message : Framebuffer_info
void dump(char const *label)
{
- using Genode::printf;
+ using Genode::log;
- printf("%s message:\n", label);
- printf(" phys_width: %u\n", phys_width);
- printf(" phys_height: %u\n", phys_height);
- printf(" virt_width: %u\n", virt_width);
- printf(" virt_height: %u\n", virt_height);
- printf(" pitch: %u\n", pitch);
- printf(" depth: %d\n", depth);
- printf(" x_offset: %d\n", x_offset);
- printf(" y_offset: %d\n", y_offset);
- printf(" addr: 0x%08x\n", addr);
- printf(" size: 0x%08x\n", size);
+ log(label, " message:");
+ log(" phys_width: ", phys_width);
+ log(" phys_height: ", phys_height);
+ log(" virt_width: ", virt_width);
+ log(" virt_height: ", virt_height);
+ log(" pitch: ", pitch);
+ log(" depth: ", depth);
+ log(" x_offset: ", x_offset);
+ log(" y_offset: ", y_offset);
+ log(" addr: ", Genode::Hex(addr));
+ log(" size: ", Genode::Hex(size));
}
inline void *operator new (__SIZE_TYPE__, void *ptr) { return ptr; }
diff --git a/repos/ports/include/vmm/utcb_guard.h b/repos/ports/include/vmm/utcb_guard.h
index 905096dee1..a8e29356b0 100644
--- a/repos/ports/include/vmm/utcb_guard.h
+++ b/repos/ports/include/vmm/utcb_guard.h
@@ -15,7 +15,6 @@
#define _INCLUDE__VMM__UTCB_GUARD_H_
/* Genode includes */
-#include
#include
/* NOVA syscalls */
diff --git a/repos/ports/lib/mk/virtualbox5-devices.mk b/repos/ports/lib/mk/virtualbox5-devices.mk
index ece8c50ee8..6b1a904b86 100644
--- a/repos/ports/lib/mk/virtualbox5-devices.mk
+++ b/repos/ports/lib/mk/virtualbox5-devices.mk
@@ -72,6 +72,7 @@ SRC_CC += GuestHost/HGSMI/HGSMICommon.cpp
SRC_CC += GuestHost/HGSMI/HGSMIMemAlloc.cpp
SRC_CC += devxhci.cc
+INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(VBOX_DIR)/Devices/build
INC_DIR += $(VBOX_DIR)/Devices/Bus
diff --git a/repos/ports/lib/mk/virtualbox5-drivers.mk b/repos/ports/lib/mk/virtualbox5-drivers.mk
index b530eb7799..eba03f8e86 100644
--- a/repos/ports/lib/mk/virtualbox5-drivers.mk
+++ b/repos/ports/lib/mk/virtualbox5-drivers.mk
@@ -21,6 +21,7 @@ SRC_CC += network.cpp
SRC_CC += audio.cc
INC_DIR += $(VBOX_DIR)/Devices/Audio
+INC_DIR += $(call select_from_repositories,src/lib/libc)
vpath network.cpp $(REP_DIR)/src/virtualbox5
vpath audio.cc $(REP_DIR)/src/virtualbox5
diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc
index 9dfa959ec0..4743746431 100644
--- a/repos/ports/src/app/seoul/main.cc
+++ b/repos/ports/src/app/seoul/main.cc
@@ -994,7 +994,7 @@ class Machine : public StaticReceiver
if (!_pd_vcpus)
_pd_vcpus = new Genode::Pd_connection(_env, "VM");
- vcpu_thread = new Vmm::Vcpu_other_pd(&_cpu_session, location, *_pd_vcpus);
+ vcpu_thread = new Vmm::Vcpu_other_pd(&_cpu_session, location, _pd_vcpus->rpc_cap());
}
Vcpu_dispatcher *vcpu_dispatcher =
@@ -1418,7 +1418,7 @@ void Component::construct(Genode::Env &env)
Genode::log("--- Vancouver VMM starting ---");
/* request max available memory */
- vm_size = env.ram().avail_ram().value;
+ vm_size = env.pd().avail_ram().value;
/* reserve some memory for the VMM */
vm_size -= 10 * 1024 * 1024;
/* calculate max memory for the VM */
diff --git a/repos/ports/src/test/vmm_utils/main.cc b/repos/ports/src/test/vmm_utils/main.cc
index 9df15de8ad..34e47e16a2 100644
--- a/repos/ports/src/test/vmm_utils/main.cc
+++ b/repos/ports/src/test/vmm_utils/main.cc
@@ -95,6 +95,6 @@ void Component::construct(Genode::Env &env)
typedef Vcpu_dispatcher Vcpu_o;
static Genode::Pd_connection remote_pd(env, "VM");
- static Vcpu_o vcpu_o_1(env, Vcpu_o::SVM, "vcpu_o_1", remote_pd);
- static Vcpu_o vcpu_o_2(env, Vcpu_o::SVM, "vcpu_o_2", remote_pd);
+ static Vcpu_o vcpu_o_1(env, Vcpu_o::SVM, "vcpu_o_1", remote_pd.rpc_cap());
+ static Vcpu_o vcpu_o_2(env, Vcpu_o::SVM, "vcpu_o_2", remote_pd.rpc_cap());
}
diff --git a/repos/ports/src/virtualbox5/devxhci.cc b/repos/ports/src/virtualbox5/devxhci.cc
index dd8258f62f..1e86406616 100644
--- a/repos/ports/src/virtualbox5/devxhci.cc
+++ b/repos/ports/src/virtualbox5/devxhci.cc
@@ -20,6 +20,9 @@
/* qemu-usb includes */
#include
+/* libc internal includes */
+#include
+
/* Virtualbox includes */
#define LOG_GROUP LOG_GROUP_DEV_EHCI
#include
@@ -54,7 +57,6 @@ static bool const verbose_timer = false;
************************/
struct Timer_queue;
-struct Destruction_helper;
struct XHCI
@@ -74,15 +76,11 @@ struct XHCI
/** Address of the MMIO region assigned by PCI. */
RTGCPHYS32 MMIOBase;
- /** Receiver thread that handles all USB signals. */
- PPDMTHREAD pThread;
-
PTMTIMERR3 controller_timer;
Timer_queue *timer_queue;
Qemu::Controller *ctl;
- Genode::Signal_receiver *usb_sig_rec;
- Destruction_helper *destruction_helper;
+ Genode::Entrypoint *usb_ep;
};
@@ -317,56 +315,6 @@ struct Pci_device : public Qemu::Pci_device
};
-/*************************************
- ** Qemu::Usb signal thread backend **
- *************************************/
-
-struct Destruction_helper
-{
- Genode::Signal_receiver &sig_rec;
-
- Genode::Signal_dispatcher dispatcher {
- sig_rec, *this, &Destruction_helper::handle };
-
- void handle(unsigned) { }
-
- Destruction_helper(Genode::Signal_receiver &sig_rec)
- : sig_rec(sig_rec) { }
-};
-
-
-static DECLCALLBACK(int) usb_signal_thread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
-{
- PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
- if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
- return VINF_SUCCESS;
-
- while (pThread->enmState == PDMTHREADSTATE_RUNNING)
- {
- Genode::Signal sig = pThis->usb_sig_rec->wait_for_signal();
- int num = sig.num();
-
- Genode::Signal_dispatcher_base *dispatcher;
- dispatcher = dynamic_cast(sig.context());
- if (dispatcher) {
- dispatcher->dispatch(num);
- }
- }
-
- return VINF_SUCCESS;
-}
-
-
-static DECLCALLBACK(int) usb_signal_thread_wakeup(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
-{
- PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
-
- Genode::Signal_transmitter(pThis->destruction_helper->dispatcher).submit();
-
- return VINF_SUCCESS;
-}
-
-
/***********************************************
** Virtualbox Device function implementation **
***********************************************/
@@ -451,6 +399,33 @@ static DECLCALLBACK(int) xhciDestruct(PPDMDEVINS pDevIns)
}
+struct Usb_ep : Genode::Entrypoint
+{
+ pthread_t _pthread;
+
+ void _handle_pthread_registration()
+ {
+ Genode::Thread *myself = Genode::Thread::myself();
+ if (!myself || Libc::pthread_create(&_pthread, *myself)) {
+ Genode::error("USB passthough will not work - thread for "
+ "pthread registration invalid");
+ }
+ }
+
+ Genode::Signal_handler _pthread_reg_sigh;
+
+ enum { USB_EP_STACK = 32u << 10, };
+
+ Usb_ep(Genode::Env &env)
+ :
+ Entrypoint(env, USB_EP_STACK, "usb_ep", Genode::Affinity::Location()),
+ _pthread_reg_sigh(*this, *this, &Usb_ep::_handle_pthread_registration)
+ {
+ Genode::Signal_transmitter(_pthread_reg_sigh).submit();
+ }
+};
+
+
/**
* @interface_method_impl{PDMDEVREG,pfnConstruct,XHCI constructor}
*/
@@ -459,9 +434,7 @@ static DECLCALLBACK(int) xhciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
- pThis->usb_sig_rec = new (vmm_heap()) Genode::Signal_receiver();
- pThis->destruction_helper = new (vmm_heap())
- Destruction_helper(*(pThis->usb_sig_rec));
+ pThis->usb_ep = new Usb_ep(genode_env());
int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, Timer_queue::tm_timer_cb,
pThis, TMTIMER_FLAGS_NO_CRIT_SECT,
@@ -471,11 +444,7 @@ static DECLCALLBACK(int) xhciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
pThis->timer_queue = &timer_queue;
static Pci_device pci_device(pDevIns);
- rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pThread, pThis,
- usb_signal_thread, usb_signal_thread_wakeup,
- 32 * 1024 , RTTHREADTYPE_IO, "usb_signal");
-
- pThis->ctl = Qemu::usb_init(timer_queue, pci_device, *pThis->usb_sig_rec,
+ pThis->ctl = Qemu::usb_init(timer_queue, pci_device, *pThis->usb_ep,
vmm_heap(), genode_env());
/*
diff --git a/repos/ports/src/virtualbox5/network.cpp b/repos/ports/src/virtualbox5/network.cpp
index f922e22afe..a73cc302d9 100644
--- a/repos/ports/src/virtualbox5/network.cpp
+++ b/repos/ports/src/virtualbox5/network.cpp
@@ -41,6 +41,8 @@
#include
#include
+#include
+
/* VBox Genode specific */
#include "vmm.h"
@@ -74,6 +76,17 @@ typedef struct DRVNIC
} DRVNIC, *PDRVNIC;
+/**
+ * Return lock to synchronize the destruction of the
+ * PDRVNIC, i.e., the Nic_client.
+ */
+static Genode::Lock *destruct_lock()
+{
+ static Genode::Lock lock(Genode::Lock::LOCKED);
+ return &lock;
+}
+
+
class Nic_client
{
private:
@@ -85,12 +98,15 @@ class Nic_client
Nic::Packet_allocator *_tx_block_alloc;
Nic::Connection _nic;
- Genode::Signal_receiver _sig_rec;
- Genode::Signal_dispatcher _link_state_dispatcher;
- Genode::Signal_dispatcher _rx_packet_avail_dispatcher;
- Genode::Signal_dispatcher _rx_ready_to_ack_dispatcher;
- Genode::Signal_dispatcher _destruct_dispatcher;
+ enum { NIC_EP_STACK = 32u << 10, };
+ Genode::Entrypoint _ep;
+ pthread_t _pthread;
+
+ Genode::Signal_handler _link_state_dispatcher;
+ Genode::Signal_handler _rx_packet_avail_dispatcher;
+ Genode::Signal_handler _rx_ready_to_ack_dispatcher;
+ Genode::Signal_handler _destruct_dispatcher;
bool _link_up = false;
@@ -98,7 +114,7 @@ class Nic_client
PPDMINETWORKDOWN _down_rx;
PPDMINETWORKCONFIG _down_rx_config;
- void _handle_rx_packet_avail(unsigned)
+ void _handle_rx_packet_avail()
{
while (_nic.rx()->packet_avail() && _nic.rx()->ready_to_ack()) {
Nic::Packet_descriptor rx_packet = _nic.rx()->get_packet();
@@ -116,9 +132,9 @@ class Nic_client
}
}
- void _handle_rx_ready_to_ack(unsigned) { _handle_rx_packet_avail(0); }
+ void _handle_rx_ready_to_ack() { _handle_rx_packet_avail(); }
- void _handle_link_state(unsigned)
+ void _handle_link_state()
{
_link_up = _nic.link_state();
@@ -127,12 +143,14 @@ class Nic_client
: PDMNETWORKLINKSTATE_DOWN);
}
- /**
- * By handling this signal the I/O thread gets unblocked
- * and will leave its loop when the DRVNIC instance is
- * being destructed.
- */
- void _handle_destruct(unsigned) { }
+ void _handle_destruct()
+ {
+ _nic.link_state_sigh(Genode::Signal_context_capability());
+ _nic.rx_channel()->sigh_packet_avail(Genode::Signal_context_capability());
+ _nic.rx_channel()->sigh_ready_to_ack(Genode::Signal_context_capability());
+
+ destruct_lock()->unlock();
+ }
void _tx_ack(bool block = false)
{
@@ -161,22 +179,39 @@ class Nic_client
return new (vmm_heap()) Nic::Packet_allocator(&vmm_heap());
}
+ void _handle_pthread_registration()
+ {
+ Genode::Thread *myself = Genode::Thread::myself();
+ if (!myself || Libc::pthread_create(&_pthread, *myself)) {
+ Genode::error("network will not work - thread for pthread "
+ "registration invalid");
+ return;
+ }
+ }
+
+ Genode::Signal_handler _pthread_reg_sigh {
+ _ep, *this, &Nic_client::_handle_pthread_registration };
+
public:
Nic_client(Genode::Env &env, PDRVNIC drvtap, char const *label)
:
_tx_block_alloc(_packet_allocator()),
_nic(env, _tx_block_alloc, BUF_SIZE, BUF_SIZE, label),
- _link_state_dispatcher(_sig_rec, *this, &Nic_client::_handle_link_state),
- _rx_packet_avail_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_packet_avail),
- _rx_ready_to_ack_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_ready_to_ack),
- _destruct_dispatcher(_sig_rec, *this, &Nic_client::_handle_destruct),
+ _ep(env, NIC_EP_STACK, "nic_ep", Genode::Affinity::Location()),
+ _link_state_dispatcher(_ep, *this, &Nic_client::_handle_link_state),
+ _rx_packet_avail_dispatcher(_ep, *this, &Nic_client::_handle_rx_packet_avail),
+ _rx_ready_to_ack_dispatcher(_ep, *this, &Nic_client::_handle_rx_ready_to_ack),
+ _destruct_dispatcher(_ep, *this, &Nic_client::_handle_destruct),
_down_rx(drvtap->pIAboveNet),
_down_rx_config(drvtap->pIAboveConfig)
- { }
+ {
+ Genode::Signal_transmitter(_pthread_reg_sigh).submit();
+ }
~Nic_client()
{
+ /* XXX Libc::pthread_free(&_pthread); */
destroy(vmm_heap(), _tx_block_alloc);
}
@@ -187,11 +222,10 @@ class Nic_client
_nic.rx_channel()->sigh_ready_to_ack(_rx_ready_to_ack_dispatcher);
/* set initial link-state */
- _handle_link_state(1);
+ _handle_link_state();
}
Genode::Signal_context_capability dispatcher() { return _destruct_dispatcher; }
- Genode::Signal_receiver &sig_rec() { return _sig_rec; }
Nic::Mac_address mac_address() { return _nic.mac_address(); }
int send_packet(void *packet, uint32_t packet_len)
@@ -211,17 +245,6 @@ class Nic_client
};
-/**
- * Return lock to synchronize the destruction of the
- * PDRVNIC, i.e., the Nic_client.
- */
-static Genode::Lock *destruct_lock()
-{
- static Genode::Lock lock(Genode::Lock::LOCKED);
- return &lock;
-}
-
-
/** Converts a pointer to Nic::INetworkUp to a PRDVNic. */
#define PDMINETWORKUP_2_DRVNIC(pInterface) ( (PDRVNIC)((uintptr_t)pInterface - RT_OFFSETOF(DRVNIC, INetworkUp)) )
#define PDMINETWORKCONFIG_2_DRVNIC(pInterface) ( (PDRVNIC)((uintptr_t)pInterface - RT_OFFSETOF(DRVNIC, INetworkConfig)) )
@@ -393,58 +416,6 @@ static DECLCALLBACK(int) drvGetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)
}
-/**
- * Asynchronous I/O thread for handling receive.
- *
- * @returns VINF_SUCCESS (ignored).
- * @param Thread Thread handle.
- * @param pvUser Pointer to a DRVNIC structure.
- */
-static DECLCALLBACK(int) drvNicAsyncIoThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
-{
- PDRVNIC pThis = PDMINS_2_DATA(pDrvIns, PDRVNIC);
- LogFlow(("drvNicAsyncIoThread: pThis=%p\n", pThis));
-
- if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
- return VINF_SUCCESS;
-
- Genode::Signal_receiver &sig_rec = pThis->nic_client->sig_rec();
-
- while (pThread->enmState == PDMTHREADSTATE_RUNNING)
- {
- Genode::Signal sig = sig_rec.wait_for_signal();
- int num = sig.num();
-
- Genode::Signal_dispatcher_base *dispatcher;
- dispatcher = dynamic_cast(sig.context());
- dispatcher->dispatch(num);
- }
-
- destruct_lock()->unlock();
-
- return VINF_SUCCESS;
-}
-
-
-/**
- * Unblock the asynchronous I/O thread.
- *
- * @returns VBox status code.
- * @param pDevIns The pcnet device instance.
- * @param pThread The asynchronous I/O thread.
- */
-static DECLCALLBACK(int) drvNicAsyncIoWakeup(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
-{
- PDRVNIC pThis = PDMINS_2_DATA(pDrvIns, PDRVNIC);
- Nic_client *nic_client = pThis->nic_client;
-
- if (nic_client)
- Genode::Signal_transmitter(nic_client->dispatcher()).submit();
-
- return VINF_SUCCESS;
-}
-
-
/* -=-=-=-=- PDMIBASE -=-=-=-=- */
/**
@@ -549,15 +520,7 @@ static DECLCALLBACK(int) drvNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
return VERR_HOSTIF_INIT_FAILED;
}
- /*
- * Create the asynchronous I/O thread.
- */
- rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pThread, pThis,
- drvNicAsyncIoThread, drvNicAsyncIoWakeup,
- 128 * _1K, RTTHREADTYPE_IO, "nic_thread");
- AssertRCReturn(rc, rc);
-
- return rc;
+ return 0;
}
diff --git a/repos/ports/src/virtualbox5/rt.cc b/repos/ports/src/virtualbox5/rt.cc
index 8f3b886bdb..08392c3c29 100644
--- a/repos/ports/src/virtualbox5/rt.cc
+++ b/repos/ports/src/virtualbox5/rt.cc
@@ -75,7 +75,7 @@ class Avl_ds : public Genode::Avl_node
genode_env().ram().free(_ds);
Genode::log("free up ", _size, " ", _mem_allocated, "/",
_mem_unused, " hit=", hit, "/", hit_coarse, " avail=",
- genode_env().ram().avail_ram());
+ genode_env().pd().avail_ram());
}
void unused()
@@ -140,7 +140,7 @@ class Avl_ds : public Genode::Avl_node
while (_unused_ds.first() && cbx &&
(_mem_allocated + cb > MEMORY_MAX ||
_mem_unused + cb > MEMORY_CACHED ||
- genode_env().ram().avail_ram().value < cb * 2
+ genode_env().pd().avail_ram().value < cb * 2
)
)
{
diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc
index ad09ed0111..dde21ea4bb 100644
--- a/repos/ports/src/virtualbox5/spec/nova/sup.cc
+++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc
@@ -798,13 +798,13 @@ bool create_emt_vcpu(pthread_t * pthread, ::size_t stack,
vcpu_handler = new (0x10) Vcpu_handler_vmx(genode_env(),
stack, start_routine,
arg, cpu_session, location,
- cpu_id, name, pd_vcpus);
+ cpu_id, name, pd_vcpus.rpc_cap());
if (svm)
vcpu_handler = new (0x10) Vcpu_handler_svm(genode_env(),
stack, start_routine,
arg, cpu_session, location,
- cpu_id, name, pd_vcpus);
+ cpu_id, name, pd_vcpus.rpc_cap());
Assert(!(reinterpret_cast(vcpu_handler) & 0xf));
diff --git a/repos/ports/src/virtualbox5/sup.cc b/repos/ports/src/virtualbox5/sup.cc
index f4c241c6ea..aa7408f3b1 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)
return rc;
/* Request max available memory */
- size_t memory_genode = genode_env().ram().avail_ram().value >> 20;
+ size_t memory_genode = genode_env().pd().avail_ram().value >> 20;
size_t memory_vmm = 28;
if (memory_vbox + memory_vmm > memory_genode) {