From 1f8fad8fa1f889c7944475367da50b30f9e9f11c Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 17 Mar 2015 11:51:00 +0100 Subject: [PATCH] base: refactor signal_transmitter::submit Move it to platform specific .cc file, so that it may get re-implemented platform specifically if needed. Issue #1446 --- repos/base-codezero/lib/mk/base-common.mk | 2 +- repos/base-fiasco/lib/mk/base-common.mk | 2 +- repos/base-foc/lib/mk/base-common.inc | 2 +- repos/base-host/lib/mk/base-common.mk | 2 +- repos/base-hw/lib/mk/base-common.inc | 3 +- repos/base-hw/src/base/signal/platform.cc | 32 ++++++++++++++++++++++ repos/base-hw/src/base/signal/signal.cc | 5 +--- repos/base-linux/lib/mk/base-common.mk | 2 +- repos/base-nova/lib/mk/base-common.inc | 2 +- repos/base-okl4/lib/mk/base-common.mk | 2 +- repos/base-pistachio/lib/mk/base-common.mk | 2 +- repos/base/include/base/signal.h | 3 ++ repos/base/src/base/signal/platform.cc | 29 ++++++++++++++++++++ repos/base/src/base/signal/signal.cc | 9 +----- 14 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 repos/base-hw/src/base/signal/platform.cc create mode 100644 repos/base/src/base/signal/platform.cc diff --git a/repos/base-codezero/lib/mk/base-common.mk b/repos/base-codezero/lib/mk/base-common.mk index a284b7669d..2e200fe3dd 100644 --- a/repos/base-codezero/lib/mk/base-common.mk +++ b/repos/base-codezero/lib/mk/base-common.mk @@ -18,7 +18,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc SRC_CC += thread/context_allocator.cc env/utcb.cc diff --git a/repos/base-fiasco/lib/mk/base-common.mk b/repos/base-fiasco/lib/mk/base-common.mk index eaaa370782..1380eecfea 100644 --- a/repos/base-fiasco/lib/mk/base-common.mk +++ b/repos/base-fiasco/lib/mk/base-common.mk @@ -18,7 +18,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc SRC_CC += thread/context_allocator.cc diff --git a/repos/base-foc/lib/mk/base-common.inc b/repos/base-foc/lib/mk/base-common.inc index 3b124c936b..bd17c24bd6 100644 --- a/repos/base-foc/lib/mk/base-common.inc +++ b/repos/base-foc/lib/mk/base-common.inc @@ -18,7 +18,7 @@ SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc SRC_CC += env/spin_lock.cc env/cap_map.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc SRC_CC += thread/context_allocator.cc diff --git a/repos/base-host/lib/mk/base-common.mk b/repos/base-host/lib/mk/base-common.mk index c8658317ec..bb79fbc89c 100644 --- a/repos/base-host/lib/mk/base-common.mk +++ b/repos/base-host/lib/mk/base-common.mk @@ -18,7 +18,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/thread_bootstrap_empty.cc diff --git a/repos/base-hw/lib/mk/base-common.inc b/repos/base-hw/lib/mk/base-common.inc index 8980aac743..1616aa9deb 100644 --- a/repos/base-hw/lib/mk/base-common.inc +++ b/repos/base-hw/lib/mk/base-common.inc @@ -21,8 +21,7 @@ SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += console/console.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc -SRC_CC += signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc SRC_CC += server/common.cc SRC_CC += thread/bootstrap.cc diff --git a/repos/base-hw/src/base/signal/platform.cc b/repos/base-hw/src/base/signal/platform.cc new file mode 100644 index 0000000000..1fdcfdd9b6 --- /dev/null +++ b/repos/base-hw/src/base/signal/platform.cc @@ -0,0 +1,32 @@ +/* + * \brief Implementations of the signaling framework specific for HW-core + * \author Martin Stein + * \date 2012-05-05 + */ + +/* + * Copyright (C) 2012-2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + + +/* Genode includes */ +#include + +/* base-hw includes */ +#include + +using namespace Genode; + +/************************ + ** Signal transmitter ** + ************************/ +void Signal_transmitter::submit(unsigned cnt) +{ + { + Trace::Signal_submit trace_event(cnt); + } + Kernel::submit_signal(_context.dst(), cnt); +} diff --git a/repos/base-hw/src/base/signal/signal.cc b/repos/base-hw/src/base/signal/signal.cc index f56bfdf6d9..0653b421a3 100644 --- a/repos/base-hw/src/base/signal/signal.cc +++ b/repos/base-hw/src/base/signal/signal.cc @@ -79,10 +79,7 @@ void Signal_context::submit(unsigned num) ** Signal transmitter ** ************************/ -void Signal_transmitter::submit(unsigned const cnt) -{ - Kernel::submit_signal(_context.dst(), cnt); -} +Signal_connection * Signal_transmitter::connection() { return signal_connection(); } /********************* diff --git a/repos/base-linux/lib/mk/base-common.mk b/repos/base-linux/lib/mk/base-common.mk index 5077a5d61d..4f275331df 100644 --- a/repos/base-linux/lib/mk/base-common.mk +++ b/repos/base-linux/lib/mk/base-common.mk @@ -17,7 +17,7 @@ SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc SRC_CC += env/rm_session_mmap.cc env/debug.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/trace.cc thread/thread_env.cc thread/context_allocator.cc diff --git a/repos/base-nova/lib/mk/base-common.inc b/repos/base-nova/lib/mk/base-common.inc index 9834b3d47b..9b14e2e2aa 100644 --- a/repos/base-nova/lib/mk/base-common.inc +++ b/repos/base-nova/lib/mk/base-common.inc @@ -16,7 +16,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc SRC_CC += thread/thread.cc thread/thread_context.cc thread/trace.cc SRC_CC += thread/context_allocator.cc env/cap_map.cc diff --git a/repos/base-okl4/lib/mk/base-common.mk b/repos/base-okl4/lib/mk/base-common.mk index a44169aad7..05974f5fb1 100644 --- a/repos/base-okl4/lib/mk/base-common.mk +++ b/repos/base-okl4/lib/mk/base-common.mk @@ -18,7 +18,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc SRC_CC += thread/context_allocator.cc diff --git a/repos/base-pistachio/lib/mk/base-common.mk b/repos/base-pistachio/lib/mk/base-common.mk index c5ec1906cf..a98ca4a7d2 100644 --- a/repos/base-pistachio/lib/mk/base-common.mk +++ b/repos/base-pistachio/lib/mk/base-common.mk @@ -18,7 +18,7 @@ SRC_CC += child/child.cc SRC_CC += process/process.cc SRC_CC += elf/elf_binary.cc SRC_CC += lock/lock.cc -SRC_CC += signal/signal.cc signal/common.cc +SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc SRC_CC += server/server.cc server/common.cc SRC_CC += thread/thread.cc thread/trace.cc thread/thread_bootstrap.cc SRC_CC += thread/context_allocator.cc diff --git a/repos/base/include/base/signal.h b/repos/base/include/base/signal.h index a6f8852c87..4f0885ab38 100644 --- a/repos/base/include/base/signal.h +++ b/repos/base/include/base/signal.h @@ -34,6 +34,7 @@ namespace Genode { class Signal_transmitter; class Signal; class Signal_dispatcher_base; + class Signal_connection; template class Signal_dispatcher; } @@ -122,6 +123,8 @@ class Genode::Signal_transmitter Signal_context_capability _context; /* destination */ + Signal_connection * connection(); + public: /** diff --git a/repos/base/src/base/signal/platform.cc b/repos/base/src/base/signal/platform.cc new file mode 100644 index 0000000000..d175021f77 --- /dev/null +++ b/repos/base/src/base/signal/platform.cc @@ -0,0 +1,29 @@ +/* + * \brief Generic implementation parts of the signaling framework which are + * implemented platform specifically, e.g. base-hw and base-nova. + * \author Norman Feske + * \author Alexander Boettcher + */ + +/* + * Copyright (C) 2008-2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + + +#include + +using namespace Genode; + +/************************ + ** Signal transmitter ** + ************************/ +void Signal_transmitter::submit(unsigned cnt) +{ + { + Trace::Signal_submit trace_event(cnt); + } + connection()->submit(_context, cnt); +} diff --git a/repos/base/src/base/signal/signal.cc b/repos/base/src/base/signal/signal.cc index b0a53dfbf0..567b2438a4 100644 --- a/repos/base/src/base/signal/signal.cc +++ b/repos/base/src/base/signal/signal.cc @@ -228,14 +228,7 @@ void Signal_context::submit(unsigned num) ** Signal transmitter ** ************************/ -void Signal_transmitter::submit(unsigned cnt) -{ - { - Trace::Signal_submit trace_event(cnt); - } - signal_connection()->submit(_context, cnt); -} - +Signal_connection * Signal_transmitter::connection() { return signal_connection(); } /********************* ** Signal receiver **