diff --git a/repos/base-fiasco/src/lib/base/thread_bootstrap.cc b/repos/base-fiasco/src/lib/base/thread_bootstrap.cc index edf809c641..6d967c4a5f 100644 --- a/repos/base-fiasco/src/lib/base/thread_bootstrap.cc +++ b/repos/base-fiasco/src/lib/base/thread_bootstrap.cc @@ -25,8 +25,7 @@ using namespace Genode; ** Startup library support ** *****************************/ -void prepare_init_main_thread() { } -void prepare_reinit_main_thread() { } +void prepare_init_main_thread() { } /************ diff --git a/repos/base-foc/src/lib/base/thread_bootstrap.cc b/repos/base-foc/src/lib/base/thread_bootstrap.cc index 5db6cefaed..4b08b05338 100644 --- a/repos/base-foc/src/lib/base/thread_bootstrap.cc +++ b/repos/base-foc/src/lib/base/thread_bootstrap.cc @@ -38,14 +38,6 @@ void prepare_init_main_thread() } -void prepare_reinit_main_thread() -{ - construct_at(&cap_map()); - cap_idx_alloc().reinit(); - prepare_init_main_thread(); -} - - /************ ** Thread ** ************/ diff --git a/repos/base-hw/src/lib/base/thread_bootstrap.cc b/repos/base-hw/src/lib/base/thread_bootstrap.cc index deb70c52ac..0a7692c7ad 100644 --- a/repos/base-hw/src/lib/base/thread_bootstrap.cc +++ b/repos/base-hw/src/lib/base/thread_bootstrap.cc @@ -58,9 +58,6 @@ void prepare_init_main_thread() } -void prepare_reinit_main_thread() { prepare_init_main_thread(); } - - /************ ** Thread ** ************/ diff --git a/repos/base-hw/src/lib/base/thread_start.cc b/repos/base-hw/src/lib/base/thread_start.cc index 30faa995bb..83dc1033dc 100644 --- a/repos/base-hw/src/lib/base/thread_start.cc +++ b/repos/base-hw/src/lib/base/thread_start.cc @@ -56,9 +56,6 @@ void Thread::_init_platform_thread(size_t weight, Type type) addr_t const utcb_new = (addr_t)&_stack->utcb() - stack_area; Region_map * const rm = env_stack_area_region_map; - if (type == REINITIALIZED_MAIN) - rm->detach(utcb_new); - /* remap initial main-thread UTCB according to stack-area spec */ try { rm->attach_at(Hw::_main_thread_utcb_ds, utcb_new, utcb_size); } catch(...) { diff --git a/repos/base-linux/lib/mk/core-linux.inc b/repos/base-linux/lib/mk/core-linux.inc index 2d6bcd3db2..124e0d6cfa 100644 --- a/repos/base-linux/lib/mk/core-linux.inc +++ b/repos/base-linux/lib/mk/core-linux.inc @@ -31,7 +31,6 @@ SRC_CC := main.cc \ core_log.cc \ core_log_out.cc \ default_log.cc \ - env_reinit.cc \ heartbeat.cc \ thread.cc \ thread_myself.cc @@ -61,7 +60,6 @@ vpath heartbeat.cc $(GEN_CORE_DIR) vpath thread.cc $(BASE_DIR)/src/lib/base vpath thread_myself.cc $(BASE_DIR)/src/lib/base vpath trace.cc $(BASE_DIR)/src/lib/base -vpath env_reinit.cc $(REP_DIR)/src/lib/base vpath dataspace_component.cc $(REP_DIR)/src/core/spec/$(BOARD) vpath io_mem_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD) vpath irq_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD) diff --git a/repos/base-linux/src/include/base/internal/platform_env.h b/repos/base-linux/src/include/base/internal/platform_env.h index 2faf7b93a2..dbd2ea3dc1 100644 --- a/repos/base-linux/src/include/base/internal/platform_env.h +++ b/repos/base-linux/src/include/base/internal/platform_env.h @@ -91,9 +91,6 @@ class Genode::Platform_env_base : public Env_deprecated Cpu_session_capability cpu_session_cap() override { return _cpu_session_cap; } Pd_session *pd_session() override { return &_local_pd_session; } Pd_session_capability pd_session_cap() override { return _pd_session_cap; } - - void reinit(Native_capability::Raw) override; - void reinit_main_thread(Capability &) override; }; diff --git a/repos/base-linux/src/lib/base/env_reinit.cc b/repos/base-linux/src/lib/base/env_reinit.cc deleted file mode 100644 index 9944b09292..0000000000 --- a/repos/base-linux/src/lib/base/env_reinit.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - * \brief Environment reinitialization - * \author Norman Feske - * \date 2016-04-29 - * - * Support functions for implementing fork on Noux, which is not supported on - * Linux. - */ - -/* - * Copyright (C) 2016-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. - */ - -/* base-internal includes */ -#include - - -void Genode::Platform_env_base::reinit(Native_capability::Raw) { } - - -void Genode::Platform_env_base::reinit_main_thread(Capability &) { } diff --git a/repos/base-nova/src/lib/base/stack.cc b/repos/base-nova/src/lib/base/stack.cc index 05e4544dd2..ae5be5605e 100644 --- a/repos/base-nova/src/lib/base/stack.cc +++ b/repos/base-nova/src/lib/base/stack.cc @@ -100,14 +100,6 @@ void prepare_init_main_thread() } } -void prepare_reinit_main_thread() -{ - using namespace Genode; - construct_at(&cap_map()); - construct_at(&initial_cap_range()); - prepare_init_main_thread(); -} - /************ ** Thread ** diff --git a/repos/base-nova/src/lib/base/thread_start.cc b/repos/base-nova/src/lib/base/thread_start.cc index 392ff5804d..c7cfd29d83 100644 --- a/repos/base-nova/src/lib/base/thread_start.cc +++ b/repos/base-nova/src/lib/base/thread_start.cc @@ -81,7 +81,7 @@ void Thread::_init_platform_thread(size_t weight, Type type) native_thread().ec_sel = Native_thread::INVALID_INDEX; /* for main threads the member initialization differs */ - if (type == MAIN || type == REINITIALIZED_MAIN) { + if (type == MAIN) { _thread_cap = main_thread_cap(); native_thread().exc_pt_sel = 0; diff --git a/repos/base-okl4/src/lib/base/thread_bootstrap.cc b/repos/base-okl4/src/lib/base/thread_bootstrap.cc index ab68f8a9c6..7ecbc7f57d 100644 --- a/repos/base-okl4/src/lib/base/thread_bootstrap.cc +++ b/repos/base-okl4/src/lib/base/thread_bootstrap.cc @@ -65,9 +65,6 @@ void prepare_init_main_thread() } -void prepare_reinit_main_thread() { prepare_init_main_thread(); } - - /************ ** Thread ** ************/ diff --git a/repos/base-pistachio/src/lib/base/thread_bootstrap.cc b/repos/base-pistachio/src/lib/base/thread_bootstrap.cc index 9347dc99c4..de515d4b37 100644 --- a/repos/base-pistachio/src/lib/base/thread_bootstrap.cc +++ b/repos/base-pistachio/src/lib/base/thread_bootstrap.cc @@ -32,8 +32,6 @@ void prepare_init_main_thread() main_thread_tid = Pistachio::L4_Myself(); } -void prepare_reinit_main_thread() { prepare_init_main_thread(); } - /************ ** Thread ** diff --git a/repos/base-sel4/src/lib/base/ipc.cc b/repos/base-sel4/src/lib/base/ipc.cc index 49b3a6e810..fe1a4b1580 100644 --- a/repos/base-sel4/src/lib/base/ipc.cc +++ b/repos/base-sel4/src/lib/base/ipc.cc @@ -64,18 +64,6 @@ static unsigned &rcv_sel() ** Startup library support ** *****************************/ -void prepare_reinit_main_thread() -{ - /** - * Reset selector to invalid, so that a new fresh will be allocated. - * The IPC buffer of the thread must be configured to point to the - * receive selector which is done by Capability_space::alloc_rcv_sel(), - * which finally calls seL4_SetCapReceivePath(); - */ - rcv_sel() = 0; -} - - /** * Convert Genode::Msgbuf_base content into seL4 message * diff --git a/repos/base/include/base/env.h b/repos/base/include/base/env.h index db431a763f..57842dad8b 100644 --- a/repos/base/include/base/env.h +++ b/repos/base/include/base/env.h @@ -141,33 +141,6 @@ struct Genode::Env : Interface */ virtual void exec_static_constructors() = 0; - /** - * Reload parent capability and reinitialize environment resources - * - * This method is solely used for implementing fork in Noux. After forking - * a process, the new child process is executed within a copy of the - * address space of the forking process. Thereby, the new process inherits - * the original 'env' object of the forking process, which is meaningless - * in the context of the new process. By calling this function, the new - * process is able to reinitialize its 'env' with meaningful capabilities - * obtained via its updated parent capability. - * - * \noapi - */ - virtual void reinit(Native_capability::Raw) = 0; - - /** - * Reinitialize main-thread object - * - * \param stack_area_rm new region map of the stack area - * - * This function is solely used for implementing fork as provided by the - * Noux environment. - * - * \noapi - */ - virtual void reinit_main_thread(Capability &stack_area_rm) = 0; - /** * Attempt the creation of a session * diff --git a/repos/base/include/base/thread.h b/repos/base/include/base/thread.h index df282c1f9a..08f7531afb 100644 --- a/repos/base/include/base/thread.h +++ b/repos/base/include/base/thread.h @@ -138,7 +138,7 @@ class Genode::Thread * Some threads need special treatment at construction. This enum * is solely used to distinguish them at construction. */ - enum Type { NORMAL, MAIN, REINITIALIZED_MAIN }; + enum Type { NORMAL, MAIN }; private: diff --git a/repos/base/include/deprecated/env.h b/repos/base/include/deprecated/env.h index 0d77e74a96..4164e40c2c 100644 --- a/repos/base/include/deprecated/env.h +++ b/repos/base/include/deprecated/env.h @@ -87,34 +87,6 @@ struct Genode::Env_deprecated : Interface */ virtual Pd_session *pd_session() = 0; virtual Pd_session_capability pd_session_cap() = 0; - - /** - * Reload parent capability and reinitialize environment resources - * - * This function is solely used for implementing fork semantics. - * After forking a process, the new child process is executed - * within a copy of the address space of the forking process. - * Thereby, the new process inherits the original 'env' object of - * the forking process, which is meaningless in the context of the - * new process. By calling this function, the new process is able - * to reinitialize its 'env' with meaningful capabilities obtained - * via its updated parent capability. - * - * \noapi - */ - virtual void reinit(Native_capability::Raw) = 0; - - /** - * Reinitialize main-thread object - * - * \param stack_area_rm new RM session of the stack area - * - * This function is solely used for implementing fork semantics - * as provided by the Noux environment. - * - * \noapi - */ - virtual void reinit_main_thread(Capability &stack_area_rm) = 0; }; #endif /* _INCLUDE__DEPRECATED__ENV_H_ */ diff --git a/repos/base/lib/mk/base.inc b/repos/base/lib/mk/base.inc index 1c90f1ae6a..c72150c8f9 100644 --- a/repos/base/lib/mk/base.inc +++ b/repos/base/lib/mk/base.inc @@ -1,5 +1,5 @@ SRC_CC += default_log.cc -SRC_CC += env_deprecated.cc stack_area.cc env_reinit.cc main_thread_cap.cc +SRC_CC += env_deprecated.cc stack_area.cc main_thread_cap.cc SRC_CC += rpc_cap_alloc.cc heartbeat.cc SRC_CC += vm.cc diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h index 059a7cb306..9f7278ed9d 100644 --- a/repos/base/src/core/include/core_env.h +++ b/repos/base/src/core/include/core_env.h @@ -99,9 +99,6 @@ class Genode::Core_env : public Env_deprecated, Noncopyable Cpu_session *cpu_session() override { ASSERT_NEVER_CALLED; } Cpu_session_capability cpu_session_cap() override { ASSERT_NEVER_CALLED; } Pd_session_capability pd_session_cap() override { return _pd_session.cap(); } - - void reinit(Capability::Raw) override { } - void reinit_main_thread(Capability &) override { } }; #endif /* _CORE__INCLUDE__CORE_ENV_H_ */ diff --git a/repos/base/src/include/base/internal/platform_env.h b/repos/base/src/include/base/internal/platform_env.h index e73ad86aed..a4919ff640 100644 --- a/repos/base/src/include/base/internal/platform_env.h +++ b/repos/base/src/include/base/internal/platform_env.h @@ -96,12 +96,6 @@ class Genode::Platform_env : public Platform_env_base env_stack_area_region_map = &_stack_area; } - /* - * Support functions for implementing fork on Noux. - */ - void reinit(Native_capability::Raw) override; - void reinit_main_thread(Capability &) override; - /****************************** ** Env_deprecated interface ** diff --git a/repos/base/src/lib/base/component.cc b/repos/base/src/lib/base/component.cc index 59390c48a2..82b8642ca7 100644 --- a/repos/base/src/lib/base/component.cc +++ b/repos/base/src/lib/base/component.cc @@ -94,16 +94,6 @@ namespace { return Genode::env_session_id_space(); } - void reinit(Native_capability::Raw raw) override - { - Genode::env_deprecated()->reinit(raw); - } - - void reinit_main_thread(Capability &stack_area_rm) override - { - Genode::env_deprecated()->reinit_main_thread(stack_area_rm); - } - void _block_for_session() { /* diff --git a/repos/base/src/lib/base/env_reinit.cc b/repos/base/src/lib/base/env_reinit.cc deleted file mode 100644 index 9f19789be1..0000000000 --- a/repos/base/src/lib/base/env_reinit.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - * \brief Environment reinitialization - * \author Norman Feske - * \author Martin Stein - * \date 2012-02-16 - */ - -/* - * Copyright (C) 2012-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. - */ - -/* Genode includes */ -#include -#include - -/* base-internal includes */ -#include -#include - -void prepare_reinit_main_thread(); - -void reinit_main_thread(); - -namespace Genode { extern bool inhibit_tracing; } - - -void Genode::Platform_env::reinit(Native_capability::Raw raw) -{ - /* - * This function is unused during the normal operation of Genode. It is - * relevant only for implementing fork semantics such as provided by the - * Noux execution environment. - * - * The function is called by the freshly created process right after the - * fork happened. - * - * The existing 'Platform_env' object contains capabilities that are - * meaningful for the forking process but not the new process. Before the - * the environment can be used, it must be reinitialized with the resources - * provided by the actual parent. - */ - - /* avoid RPCs by the tracing framework as long as we have no valid env */ - inhibit_tracing = true; - - /* do platform specific preparation */ - prepare_reinit_main_thread(); - - /* - * Patch new parent capability into the original location as specified by - * the linker script. - */ - *(Native_capability::Raw *)(&_parent_cap) = raw; - - /* - * Re-initialize 'Platform_env' members - */ - Expanding_parent_client * const p = &_parent_client; - construct_at(p, parent_cap()); - construct_at(&_resources, _parent_client); - - /* - * Keep information about dynamically allocated memory but use the new - * resources as backing store. Note that the capabilites of the already - * allocated backing-store dataspaces are rendered meaningless. But this is - * no problem because they are used by the 'Heap' destructor only, which is - * never called for heap instance of 'Platform_env'. - */ - _heap.reassign_resources(&_resources.pd, &_resources.rm); -} - - -void -Genode::Platform_env:: -reinit_main_thread(Capability &stack_area_rm) -{ - /* reinitialize stack area RM session */ - Region_map * const rms = env_stack_area_region_map; - Region_map_client * const rmc = dynamic_cast(rms); - construct_at(rmc, stack_area_rm); - - /* reinitialize main-thread object */ - ::reinit_main_thread(); - - /* re-enable tracing */ - inhibit_tracing = false; -} diff --git a/repos/base/src/lib/base/thread.cc b/repos/base/src/lib/base/thread.cc index 8cfe9ab7b8..b7ee561a44 100644 --- a/repos/base/src/lib/base/thread.cc +++ b/repos/base/src/lib/base/thread.cc @@ -204,8 +204,7 @@ Thread::Thread(size_t weight, const char *name, size_t stack_size, _cpu_session(cpu_session), _affinity(affinity), _trace_control(nullptr), - _stack(type == REINITIALIZED_MAIN ? - _stack : _alloc_stack(stack_size, name, type == MAIN)) + _stack(_alloc_stack(stack_size, name, type == MAIN)) { _init_platform_thread(weight, type); } diff --git a/repos/base/src/lib/startup/init_main_thread.cc b/repos/base/src/lib/startup/init_main_thread.cc index 209832ab4e..fcd7209eaa 100644 --- a/repos/base/src/lib/startup/init_main_thread.cc +++ b/repos/base/src/lib/startup/init_main_thread.cc @@ -56,32 +56,24 @@ extern unsigned char __initial_stack_base[]; /** * The first thread in a program */ -class Main_thread : public Thread +struct Main_thread : Thread { - public: + Main_thread() + : + Thread(Weight::DEFAULT_WEIGHT, "main", MAIN_THREAD_STACK_SIZE, Type::MAIN) + { } - /** - * Constructor - * - * \param reinit wether this is called for reinitialization - */ - Main_thread(bool reinit) - : - Thread(Weight::DEFAULT_WEIGHT, "main", MAIN_THREAD_STACK_SIZE, - reinit ? Type::REINITIALIZED_MAIN : Type::MAIN) - { } + /********************** + ** Thread interface ** + **********************/ - /********************** - ** Thread interface ** - **********************/ - - void entry() override { } + void entry() override { } }; Main_thread * main_thread() { - static Main_thread s(false); + static Main_thread s { }; return &s; } @@ -134,9 +126,3 @@ extern "C" void init_main_thread() for (;;); } } - - -/** - * Reinitialize main-thread object according to a reinitialized environment - */ -void reinit_main_thread() { construct_at(main_thread(), true); } diff --git a/repos/libports/src/app/qt5/qt_launchpad/main.cpp b/repos/libports/src/app/qt5/qt_launchpad/main.cpp index 208e3cee88..320323eabe 100644 --- a/repos/libports/src/app/qt5/qt_launchpad/main.cpp +++ b/repos/libports/src/app/qt5/qt_launchpad/main.cpp @@ -74,14 +74,6 @@ struct Qt_launchpad_namespace::Local_env : Genode::Env void close(Parent::Client::Id id) override { return genode_env.close(id); } void exec_static_constructors() override { } - - void reinit(Native_capability::Raw raw) override { - genode_env.reinit(raw); - } - - void reinit_main_thread(Capability &stack_area_rm) override { - genode_env.reinit_main_thread(stack_area_rm); - } }; diff --git a/repos/libports/src/lib/libc/internal/env.h b/repos/libports/src/lib/libc/internal/env.h index e94515c10d..245a13c158 100644 --- a/repos/libports/src/lib/libc/internal/env.h +++ b/repos/libports/src/lib/libc/internal/env.h @@ -129,12 +129,6 @@ class Libc::Env_implementation : public Libc::Env, public Config_accessor /* already done by the libc */ void exec_static_constructors() override { } - - void reinit(Native_capability::Raw raw) override { - _env.reinit(raw); } - - void reinit_main_thread(Capability &stack_area_rm) override { - _env.reinit_main_thread(stack_area_rm); } }; #endif /* _LIBC__INTERNAL__ENV_H_ */ diff --git a/repos/ports/src/app/gdb_monitor/app_child.h b/repos/ports/src/app/gdb_monitor/app_child.h index de48a3efb3..69f1016410 100644 --- a/repos/ports/src/app/gdb_monitor/app_child.h +++ b/repos/ports/src/app/gdb_monitor/app_child.h @@ -98,14 +98,6 @@ class Gdb_monitor::App_child : public Child_policy, void close(Parent::Client::Id id) override { return genode_env.close(id); } void exec_static_constructors() override { } - - void reinit(Native_capability::Raw raw) override { - genode_env.reinit(raw); - } - - void reinit_main_thread(Capability &stack_area_rm) override { - genode_env.reinit_main_thread(stack_area_rm); - } }; Local_env _env;