From 2000b7c0e675376a1bf5cd93b9ca8b197b062cd4 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Fri, 24 Feb 2017 14:50:21 +0100 Subject: [PATCH] noux: add generic construction function This function ('noux_construct') is called from each back-end's construct method (libc or Genode component). fixes #2291 --- repos/ports/src/noux/construct.h | 21 +++++++++++++++++++++ repos/ports/src/noux/main.cc | 12 +++++------- repos/ports/src/noux/minimal/construct.cc | 20 ++++++++++++++++++++ repos/ports/src/noux/minimal/target.mk | 2 +- repos/ports/src/noux/net/construct.cc | 20 ++++++++++++++++++++ repos/ports/src/noux/net/target.mk | 2 +- 6 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 repos/ports/src/noux/construct.h create mode 100644 repos/ports/src/noux/minimal/construct.cc create mode 100644 repos/ports/src/noux/net/construct.cc diff --git a/repos/ports/src/noux/construct.h b/repos/ports/src/noux/construct.h new file mode 100644 index 0000000000..3021e37ca8 --- /dev/null +++ b/repos/ports/src/noux/construct.h @@ -0,0 +1,21 @@ +/** + * \brief Noux initialization + * \author Sebastian Sumpf + * \date 2017-02-24 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef __NOUX_CONSTRUCT_H_ +#define __NOUX_CONSTRUCT_H_ + +namespace Genode { class Env; } + +void noux_construct(Genode::Env &env); + +#endif /* __NOUX_CONSTRUCT_H_ */ diff --git a/repos/ports/src/noux/main.cc b/repos/ports/src/noux/main.cc index b8af927d64..db9042cb5e 100644 --- a/repos/ports/src/noux/main.cc +++ b/repos/ports/src/noux/main.cc @@ -18,6 +18,7 @@ /* Noux includes */ #include +#include #include #include #include @@ -307,10 +308,7 @@ struct Noux::Main }; -void Component::construct(Genode::Env &env) { static Noux::Main main(env); } - - -/** - * Support for the noux/net version - */ -void Libc::Component::construct(Libc::Env &env) { Component::construct(env); } +void noux_construct(Genode::Env &env) +{ + static Noux::Main main(env); +} diff --git a/repos/ports/src/noux/minimal/construct.cc b/repos/ports/src/noux/minimal/construct.cc new file mode 100644 index 0000000000..f0eae330a9 --- /dev/null +++ b/repos/ports/src/noux/minimal/construct.cc @@ -0,0 +1,20 @@ +/** + * \brief Noux initialization + * \author Sebastian Sumpf + * \date 2017-02-24 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#include +#include + +void Component::construct(Genode::Env &env) +{ + noux_construct(env); +} diff --git a/repos/ports/src/noux/minimal/target.mk b/repos/ports/src/noux/minimal/target.mk index 7b82b0f327..845154b4a9 100644 --- a/repos/ports/src/noux/minimal/target.mk +++ b/repos/ports/src/noux/minimal/target.mk @@ -1,6 +1,6 @@ TARGET = noux LIBS = alarm vfs -SRC_CC = main.cc syscall.cc dummy_net.cc +SRC_CC = main.cc syscall.cc dummy_net.cc construct.cc INC_DIR += $(PRG_DIR) INC_DIR += $(PRG_DIR)/../ diff --git a/repos/ports/src/noux/net/construct.cc b/repos/ports/src/noux/net/construct.cc new file mode 100644 index 0000000000..3c4f5c115f --- /dev/null +++ b/repos/ports/src/noux/net/construct.cc @@ -0,0 +1,20 @@ +/** + * \brief Noux initialization + * \author Sebastian Sumpf + * \date 2017-02-24 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#include +#include + +void Libc::Component::construct(Libc::Env &env) +{ + noux_construct(env); +} diff --git a/repos/ports/src/noux/net/target.mk b/repos/ports/src/noux/net/target.mk index dd40c7fb3d..aea8a240d6 100644 --- a/repos/ports/src/noux/net/target.mk +++ b/repos/ports/src/noux/net/target.mk @@ -1,6 +1,6 @@ TARGET = noux_net LIBS += alarm libc libc_lwip_nic_dhcp vfs -SRC_CC = main.cc syscall.cc net.cc +SRC_CC = main.cc syscall.cc net.cc construct.cc INC_DIR += $(PRG_DIR) INC_DIR += $(PRG_DIR)/../