diff --git a/repos/base-nova/include/nova_native_cpu/client.h b/repos/base-nova/include/nova_native_cpu/client.h deleted file mode 100644 index 252172ab5..000000000 --- a/repos/base-nova/include/nova_native_cpu/client.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * \brief Client-side NOVA-specific CPU session interface - * \author Norman Feske - * \date 2016-04-21 - */ - -/* - * Copyright (C) 2016 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. - */ - -#ifndef _INCLUDE__NOVA_NATIVE_CPU__CLIENT_H_ -#define _INCLUDE__NOVA_NATIVE_CPU__CLIENT_H_ - -#include -#include - -namespace Genode { struct Nova_native_cpu_client; } - - -struct Genode::Nova_native_cpu_client : Rpc_client -{ - explicit Nova_native_cpu_client(Capability cap) - : Rpc_client(static_cap_cast(cap)) { } - - Native_capability pager_cap(Thread_capability cap) { - return call(cap); } -}; - -#endif /* _INCLUDE__NOVA_NATIVE_CPU__CLIENT_H_ */ diff --git a/repos/base-nova/include/nova_native_cpu/nova_native_cpu.h b/repos/base-nova/include/nova_native_cpu/nova_native_cpu.h deleted file mode 100644 index 582346002..000000000 --- a/repos/base-nova/include/nova_native_cpu/nova_native_cpu.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * \brief NOVA-specific part of the CPU session interface - * \author Norman Feske - * \date 2016-04-21 - */ - -/* - * Copyright (C) 2016 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. - */ - -#ifndef _INCLUDE__NOVA_NATIVE_CPU__FOC_NATIVE_CPU_H_ -#define _INCLUDE__NOVA_NATIVE_CPU__FOC_NATIVE_CPU_H_ - -#include -#include - -namespace Genode { struct Nova_native_cpu; } - - -struct Genode::Nova_native_cpu : Cpu_session::Native_cpu -{ - virtual Native_capability pager_cap(Thread_capability) = 0; - - - /********************* - ** RPC declaration ** - *********************/ - - GENODE_RPC(Rpc_pager_cap, Native_capability, pager_cap, Thread_capability); - GENODE_RPC_INTERFACE(Rpc_pager_cap); -}; - -#endif /* _INCLUDE__NOVA_NATIVE_CPU__FOC_NATIVE_CPU_H_ */ diff --git a/repos/base-nova/lib/mk/core.inc b/repos/base-nova/lib/mk/core.inc index ab8150fd7..73338a54f 100644 --- a/repos/base-nova/lib/mk/core.inc +++ b/repos/base-nova/lib/mk/core.inc @@ -24,7 +24,6 @@ SRC_CC += stack_area.cc \ pager.cc \ pd_session_component.cc \ native_pd_component.cc \ - native_cpu_component.cc \ pd_upgrade_ram_quota.cc \ pd_assign_pci.cc \ rpc_cap_factory.cc \ diff --git a/repos/base-nova/src/core/include/cpu_session_component.h b/repos/base-nova/src/core/include/cpu_session_component.h deleted file mode 100644 index 8b179a5cc..000000000 --- a/repos/base-nova/src/core/include/cpu_session_component.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * \brief Core-specific instance of the CPU session/thread interfaces - * \author Christian Helmuth - * \author Norman Feske - * \author Alexander Boettcher - * \date 2006-07-17 - */ - -/* - * Copyright (C) 2006-2016 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. - */ - -#ifndef _CORE__INCLUDE__CPU_SESSION_COMPONENT_H_ -#define _CORE__INCLUDE__CPU_SESSION_COMPONENT_H_ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include - -/* core includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Genode { class Cpu_session_component; } - - -class Genode::Cpu_session_component : public Rpc_object -{ - private: - - Session_label const _label; - Rpc_entrypoint *_session_ep; - Rpc_entrypoint *_thread_ep; - Pager_entrypoint *_pager_ep; - Allocator_guard _md_alloc; /* guarded meta-data allocator */ - Cpu_thread_allocator _thread_alloc; /* meta-data allocator */ - Lock _thread_alloc_lock; /* protect allocator access */ - List _thread_list; - Lock _thread_list_lock; /* protect thread list */ - unsigned _priority; /* priority of threads - created with this - session */ - Affinity::Location _location; /* CPU affinity of this - session */ - Trace::Source_registry &_trace_sources; - Trace::Control_area _trace_control_area; - - /* - * Members for quota accounting - */ - - size_t _weight; - size_t _quota; - Cpu_session_component * _ref; - List _ref_members; - Lock _ref_members_lock; - - Native_cpu_component _native_cpu; - - friend class Native_cpu_component; - - void _incr_weight(size_t); - void _decr_weight(size_t); - size_t _weight_to_quota(size_t) const; - void _decr_quota(size_t); - void _incr_quota(size_t); - void _update_thread_quota(Cpu_thread_component &) const; - void _update_each_thread_quota(); - void _transfer_quota(Cpu_session_component *, size_t); - void _insert_ref_member(Cpu_session_component *) { } - void _unsync_remove_ref_member(Cpu_session_component *) { } - void _remove_ref_member(Cpu_session_component *) { } - void _deinit_ref_account(); - void _deinit_threads(); - - /** - * Exception handler to be invoked unless overridden by a - * thread-specific handler via 'Cpu_thread::exception_sigh' - */ - Signal_context_capability _exception_sigh; - - /** - * Raw thread-killing functionality - * - * This function is called from the 'kill_thread' function and - * the destructor. Each these functions grab the list lock - * by themselves and call this function to perform the actual - * killing. - */ - void _unsynchronized_kill_thread(Thread_capability cap); - - /** - * Convert session-local affinity location to physical location - */ - Affinity::Location _thread_affinity(Affinity::Location) const; - - public: - - /** - * Constructor - */ - Cpu_session_component(Rpc_entrypoint *session_ep, - Rpc_entrypoint *thread_ep, - Pager_entrypoint *pager_ep, - Allocator *md_alloc, - Trace::Source_registry &trace_sources, - const char *args, Affinity const &affinity, - size_t quota); - - /** - * Destructor - */ - ~Cpu_session_component(); - - /** - * Register quota donation at allocator guard - */ - void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); } - - - /*************************** - ** CPU session interface ** - ***************************/ - - Thread_capability create_thread(Capability, Name const &, - Affinity::Location, Weight, addr_t) override; - void kill_thread(Thread_capability) override; - void exception_sigh(Signal_context_capability) override; - Affinity::Space affinity_space() const override; - Dataspace_capability trace_control() override; - int ref_account(Cpu_session_capability c) override; - int transfer_quota(Cpu_session_capability, size_t) override; - Quota quota() override; - - Capability native_cpu() { return _native_cpu.cap(); } -}; - -#endif /* _CORE__INCLUDE__CPU_SESSION_COMPONENT_H_ */ diff --git a/repos/base-nova/src/core/include/native_cpu_component.h b/repos/base-nova/src/core/include/native_cpu_component.h deleted file mode 100644 index dd318bad8..000000000 --- a/repos/base-nova/src/core/include/native_cpu_component.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * \brief Kernel-specific part of the CPU-session interface - * \author Norman Feske - * \date 2016-04-21 - */ - -/* - * Copyright (C) 2016 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. - */ - -#ifndef _CORE__INCLUDE__NATIVE_CPU_COMPONENT_H_ -#define _CORE__INCLUDE__NATIVE_CPU_COMPONENT_H_ - -/* Genode includes */ -#include -#include - -namespace Genode { - - class Cpu_session_component; - class Native_cpu_component; -} - - -class Genode::Native_cpu_component : public Rpc_object -{ - private: - - Cpu_session_component &_cpu_session; - Rpc_entrypoint &_thread_ep; - - public: - - Native_cpu_component(Cpu_session_component &, char const *); - ~Native_cpu_component(); - - Native_capability pager_cap(Thread_capability) override; -}; - -#endif /* _CORE__INCLUDE__NATIVE_CPU_COMPONENT_H_ */ diff --git a/repos/base-nova/src/core/native_cpu_component.cc b/repos/base-nova/src/core/native_cpu_component.cc deleted file mode 100644 index e2a8955fb..000000000 --- a/repos/base-nova/src/core/native_cpu_component.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* - * \brief Core implementation of the CPU session interface extension - * \author Norman Feske - * \date 2016-04-21 - */ - -/* - * Copyright (C) 2016 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 - -/* core-local includes */ -#include -#include - -using namespace Genode; - - -Native_capability -Native_cpu_component::pager_cap(Thread_capability thread_cap) -{ - auto lambda = [] (Cpu_thread_component *thread) { - if (!thread) - return Native_capability(); - - return thread->platform_thread().pager()->cap(); - }; - return _thread_ep.apply(thread_cap, lambda); -} - - -Native_cpu_component::Native_cpu_component(Cpu_session_component &cpu_session, char const *) -: - _cpu_session(cpu_session), _thread_ep(*_cpu_session._thread_ep) -{ - _thread_ep.manage(this); -} - - -Genode::Native_cpu_component::~Native_cpu_component() -{ - _thread_ep.dissolve(this); -} diff --git a/repos/gems/src/server/cpu_sampler/spec/nova/native_cpu.cc b/repos/gems/src/server/cpu_sampler/spec/nova/native_cpu.cc deleted file mode 100644 index e71303b96..000000000 --- a/repos/gems/src/server/cpu_sampler/spec/nova/native_cpu.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - * \brief NOVA-specific 'Native_cpu' setup - * \author Christian Prochaska - * \date 2016-05-13 - */ - -/* - * Copyright (C) 2016 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 - -/* Cpu_sampler includes */ -#include "cpu_session_component.h" -#include "cpu_thread_component.h" - - -namespace Cpu_sampler { - class Native_cpu_component; -} - - -using namespace Genode; - - -class Cpu_sampler::Native_cpu_component : public Rpc_object -{ - private: - - Cpu_session_component &_cpu_session_component; - Nova_native_cpu_client _nova_native_cpu; - - public: - - Native_cpu_component(Cpu_session_component &cpu_session_component) - : _cpu_session_component(cpu_session_component), - _nova_native_cpu(_cpu_session_component.parent_cpu_session().native_cpu()) - { - _cpu_session_component.thread_ep().manage(this); - } - - ~Native_cpu_component() - { - _cpu_session_component.thread_ep().dissolve(this); - } - - Native_capability pager_cap(Thread_capability thread_cap) override - { - auto lambda = [&] (Cpu_sampler::Cpu_thread_component *cpu_thread) { - return _nova_native_cpu.pager_cap(cpu_thread->parent_thread()); - }; - - return _cpu_session_component.thread_ep().apply(thread_cap, lambda); - } -}; - - -Capability -Cpu_sampler::Cpu_session_component::_setup_native_cpu() -{ - Native_cpu_component *native_cpu_component = - new (_md_alloc) Native_cpu_component(*this); - - return native_cpu_component->cap(); -} - - -void Cpu_sampler::Cpu_session_component::_cleanup_native_cpu() -{ - Native_cpu_component *native_cpu_component = nullptr; - _thread_ep.apply(_native_cpu_cap, - [&] (Native_cpu_component *c) { native_cpu_component = c; }); - - if (!native_cpu_component) return; - - destroy(_md_alloc, native_cpu_component); -} diff --git a/repos/gems/src/server/cpu_sampler/spec/nova/target.mk b/repos/gems/src/server/cpu_sampler/spec/nova/target.mk index 215848b54..68334fceb 100644 --- a/repos/gems/src/server/cpu_sampler/spec/nova/target.mk +++ b/repos/gems/src/server/cpu_sampler/spec/nova/target.mk @@ -2,6 +2,6 @@ REQUIRES += nova SRC_CC += native_cpu.cc -vpath native_cpu.cc $(PRG_DIR) +vpath native_cpu.cc $(PRG_DIR)/../.. include $(PRG_DIR)/../../target.inc diff --git a/repos/ports/lib/mk/spec/nova_x86_32/gdbserver_platform.mk b/repos/ports/lib/mk/spec/nova_x86_32/gdbserver_platform.mk index e173570aa..1796b311f 100644 --- a/repos/ports/lib/mk/spec/nova_x86_32/gdbserver_platform.mk +++ b/repos/ports/lib/mk/spec/nova_x86_32/gdbserver_platform.mk @@ -1,4 +1,3 @@ -SRC_CC = spec/nova_x86_32/low.cc \ - spec/nova/native_cpu.cc +SRC_CC = spec/nova_x86_32/low.cc native_cpu.cc include $(REP_DIR)/lib/mk/spec/x86_32/gdbserver_platform.inc diff --git a/repos/ports/lib/mk/spec/nova_x86_64/gdbserver_platform.mk b/repos/ports/lib/mk/spec/nova_x86_64/gdbserver_platform.mk index 6ad2c50f4..f0f29f54d 100644 --- a/repos/ports/lib/mk/spec/nova_x86_64/gdbserver_platform.mk +++ b/repos/ports/lib/mk/spec/nova_x86_64/gdbserver_platform.mk @@ -1,4 +1,3 @@ -SRC_CC = spec/nova_x86_64/low.cc \ - spec/nova/native_cpu.cc +SRC_CC = spec/nova_x86_64/low.cc native_cpu.cc include $(REP_DIR)/lib/mk/spec/x86_64/gdbserver_platform.inc diff --git a/repos/ports/src/lib/gdbserver_platform/native_cpu.cc b/repos/ports/src/lib/gdbserver_platform/native_cpu.cc new file mode 100644 index 000000000..a7fd6d78e --- /dev/null +++ b/repos/ports/src/lib/gdbserver_platform/native_cpu.cc @@ -0,0 +1,22 @@ +/* + * \brief Generic dummy 'Native_cpu' setup + * \author Christian Prochaska + * \date 2016-05-13 + */ + +/* + * Copyright (C) 2016 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. + */ + + +/* GDB monitor includes */ +#include "cpu_session_component.h" + +Genode::Capability +Gdb_monitor::Cpu_session_component::_setup_native_cpu() { + return Genode::Capability(); } + +void Gdb_monitor::Cpu_session_component::_cleanup_native_cpu() { } diff --git a/repos/ports/src/lib/gdbserver_platform/spec/nova/native_cpu.cc b/repos/ports/src/lib/gdbserver_platform/spec/nova/native_cpu.cc deleted file mode 100644 index 1ab8c0a6d..000000000 --- a/repos/ports/src/lib/gdbserver_platform/spec/nova/native_cpu.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * \brief NOVA-specific 'Native_cpu' setup - * \author Christian Prochaska - * \date 2016-05-13 - */ - -/* - * Copyright (C) 2016 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 - -/* GDB monitor includes */ -#include "cpu_session_component.h" -#include "cpu_thread_component.h" - - -namespace Gdb_monitor { - class Native_cpu_component; -} - - -using namespace Genode; - - -class Gdb_monitor::Native_cpu_component : public Rpc_object -{ - private: - - Cpu_session_component &_cpu_session_component; - Nova_native_cpu_client _nova_native_cpu; - - public: - - Native_cpu_component(Cpu_session_component &cpu_session_component) - : _cpu_session_component(cpu_session_component), - _nova_native_cpu(_cpu_session_component.parent_cpu_session().native_cpu()) - { - _cpu_session_component.thread_ep().manage(this); - } - - ~Native_cpu_component() - { - _cpu_session_component.thread_ep().dissolve(this); - } - - Native_capability pager_cap(Thread_capability thread_cap) override - { - Cpu_thread_component *cpu_thread = _cpu_session_component.lookup_cpu_thread(thread_cap); - return _nova_native_cpu.pager_cap(cpu_thread->parent_thread_cap()); - } -}; - - -Capability -Gdb_monitor::Cpu_session_component::_setup_native_cpu() -{ - Native_cpu_component *native_cpu_component = - new (_md_alloc) Native_cpu_component(*this); - - return native_cpu_component->cap(); -} - - -void Gdb_monitor::Cpu_session_component::_cleanup_native_cpu() -{ - Native_cpu_component *native_cpu_component = nullptr; - _ep.apply(_native_cpu_cap, [&] (Native_cpu_component *c) { native_cpu_component = c; }); - - if (!native_cpu_component) return; - - destroy(_md_alloc, native_cpu_component); -}