From f153bc9a747c75b5e2dd1945b223c308cbd60aee Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 29 Mar 2016 11:50:50 +0200 Subject: [PATCH] platform_drv: use server framework for device_pd Fixes #1927 --- .../platform/spec/x86/device_pd/main.cc | 41 ++++++++++--------- .../platform/spec/x86/device_pd/target.mk | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/repos/os/src/drivers/platform/spec/x86/device_pd/main.cc b/repos/os/src/drivers/platform/spec/x86/device_pd/main.cc index ddcd6774fc..712003ad48 100644 --- a/repos/os/src/drivers/platform/spec/x86/device_pd/main.cc +++ b/repos/os/src/drivers/platform/spec/x86/device_pd/main.cc @@ -15,6 +15,8 @@ #include #include +#include + #include #include #include @@ -160,29 +162,28 @@ void Platform::Device_pd_component::assign_pci(Genode::Io_mem_dataspace_capabili rm_session()->detach(page); } -int main(int argc, char **argv) +using namespace Genode; + +struct Main { - using namespace Genode; + Server::Entrypoint &ep; - /* - * Initialize server entry point - */ - enum { - STACK_SIZE = 1024*sizeof(Genode::addr_t) - }; + Platform::Device_pd_component pd_component; + Static_root root; - static Cap_connection cap; - static Rpc_entrypoint ep(&cap, STACK_SIZE, "device_pd_ep"); + Main(Server::Entrypoint &ep) + : ep(ep), root(ep.manage(pd_component)) + { + env()->parent()->announce(ep.manage(root)); + } +}; - static Platform::Device_pd_component pd_component; +/************ + ** Server ** + ************/ - /* - * Attach input root interface to the entry point - */ - static Static_root root(ep.manage(&pd_component)); - - env()->parent()->announce(ep.manage(&root)); - - Genode::sleep_forever(); - return 0; +namespace Server { + char const *name() { return "device_pd_ep"; } + size_t stack_size() { return 1024*sizeof(long); } + void construct(Entrypoint &ep) { static Main server(ep); } } diff --git a/repos/os/src/drivers/platform/spec/x86/device_pd/target.mk b/repos/os/src/drivers/platform/spec/x86/device_pd/target.mk index e37f1cde61..163d229b2b 100644 --- a/repos/os/src/drivers/platform/spec/x86/device_pd/target.mk +++ b/repos/os/src/drivers/platform/spec/x86/device_pd/target.mk @@ -1,6 +1,6 @@ TARGET = device_pd SRC_CC = main.cc -LIBS = base +LIBS = base server REQUIRES = nova