From e20bbe70022108c97498ee67d50d4597b2844ef8 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 14 Apr 2016 16:29:07 +0200 Subject: [PATCH] base: remove integer return codes from PD-session The return code of assign_parent remained unused. So this patch removes it. The bind_thread function fails only due to platform-specific limitations such as the exhaustion of ID name spaces, which cannot be sensibly handled by the PD-session client. If occurred, such conditions used to be reflected by integer return codes that were used for diagnostic messages only. The patch removes the return codes and leaves the diagnostic output to core. Fixes #1842 --- .../src/core/include/platform_pd.h | 9 ++------- repos/base-fiasco/src/core/platform_pd.cc | 5 ++--- .../base-foc/src/base/thread/thread_start.cc | 5 +++-- repos/base-foc/src/core/include/platform_pd.h | 9 ++------- repos/base-foc/src/core/platform.cc | 6 ++---- repos/base-foc/src/core/platform_pd.cc | 15 +++++++-------- repos/base-foc/src/core/thread_start.cc | 3 +-- repos/base-hw/src/core/include/platform_pd.h | 7 ++----- .../src/core/include/platform_thread.h | 8 ++++---- repos/base-hw/src/core/platform_pd.cc | 14 +++++--------- repos/base-hw/src/core/platform_thread.cc | 7 +++---- .../src/core/pd_session_component.cc | 5 ++--- .../base-nova/src/base/thread/thread_nova.cc | 4 +--- .../base-nova/src/core/include/platform_pd.h | 7 ++----- repos/base-nova/src/core/platform_pd.cc | 12 ++++-------- .../base-okl4/src/core/include/platform_pd.h | 7 ++----- repos/base-okl4/src/core/platform_pd.cc | 5 ++--- repos/base-okl4/src/core/thread_start.cc | 3 +-- .../src/core/include/platform_pd.h | 8 +++----- repos/base-pistachio/src/core/platform_pd.cc | 5 ++--- .../base-sel4/src/core/include/platform_pd.h | 7 ++----- repos/base-sel4/src/core/platform_pd.cc | 7 ++----- repos/base/include/pd_session/client.h | 8 ++++---- repos/base/include/pd_session/pd_session.h | 16 +++++++--------- repos/base/src/base/process/process.cc | 19 +++++-------------- repos/base/src/base/thread/thread_start.cc | 3 +-- repos/base/src/core/include/core_pd_session.h | 4 ++-- .../src/core/include/pd_session_component.h | 4 ++-- repos/base/src/core/pd_session_component.cc | 16 ++++++---------- 29 files changed, 83 insertions(+), 145 deletions(-) diff --git a/repos/base-fiasco/src/core/include/platform_pd.h b/repos/base-fiasco/src/core/include/platform_pd.h index d74d7e5949..6878e13690 100644 --- a/repos/base-fiasco/src/core/include/platform_pd.h +++ b/repos/base-fiasco/src/core/include/platform_pd.h @@ -163,13 +163,8 @@ namespace Genode { /** * Bind thread to protection domain - * - * \return 0 on success or - * -1 if thread ID allocation failed. - * - * This function allocates the physical L4 thread ID. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); /** * Unbind thread from protection domain @@ -181,7 +176,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent) { return 0; } + void assign_parent(Native_capability parent) { } int pd_id() const { return _pd_id; } diff --git a/repos/base-fiasco/src/core/platform_pd.cc b/repos/base-fiasco/src/core/platform_pd.cc index 11cf50ffe2..fe727f6b9e 100644 --- a/repos/base-fiasco/src/core/platform_pd.cc +++ b/repos/base-fiasco/src/core/platform_pd.cc @@ -199,7 +199,7 @@ void Platform_pd::_free_thread(int thread_id) ** Public object members ** ***************************/ -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { /* thread_id is THREAD_INVALID by default - only core is the special case */ int thread_id = thread->thread_id(); @@ -208,7 +208,7 @@ int Platform_pd::bind_thread(Platform_thread *thread) int t = _alloc_thread(thread_id, thread); if (t < 0) { PERR("Thread alloc failed"); - return -1; + return; } thread_id = t; @@ -219,7 +219,6 @@ int Platform_pd::bind_thread(Platform_thread *thread) thread->bind(thread_id, l4_thread_id, this); if (verbose) _debug_log_threads(); - return 0; } diff --git a/repos/base-foc/src/base/thread/thread_start.cc b/repos/base-foc/src/base/thread/thread_start.cc index c44b2076d2..ae337590b5 100644 --- a/repos/base-foc/src/base/thread/thread_start.cc +++ b/repos/base-foc/src/base/thread/thread_start.cc @@ -56,9 +56,10 @@ void Thread_base::_init_platform_thread(size_t weight, Type type) _thread_cap = _cpu_session->create_thread(weight, buf); /* assign thread to protection domain */ - if (!_thread_cap.valid() || - env()->pd_session()->bind_thread(_thread_cap)) + if (!_thread_cap.valid()) throw Cpu_session::Thread_creation_failed(); + + env()->pd_session()->bind_thread(_thread_cap); return; } /* adjust values whose computation differs for a main thread */ diff --git a/repos/base-foc/src/core/include/platform_pd.h b/repos/base-foc/src/core/include/platform_pd.h index 6a043616f3..7a19ee4778 100644 --- a/repos/base-foc/src/core/include/platform_pd.h +++ b/repos/base-foc/src/core/include/platform_pd.h @@ -81,13 +81,8 @@ namespace Genode { /** * Bind thread to protection domain - * - * \return 0 on success or - * -1 if thread ID allocation failed. - * - * This function allocates the physical L4 thread ID. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); /** * Unbind thread from protection domain @@ -99,7 +94,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent); + void assign_parent(Native_capability parent); /******************************* diff --git a/repos/base-foc/src/core/platform.cc b/repos/base-foc/src/core/platform.cc index e3ab1c0f58..17a87e6a43 100644 --- a/repos/base-foc/src/core/platform.cc +++ b/repos/base-foc/src/core/platform.cc @@ -144,8 +144,7 @@ Platform::Core_pager::Core_pager(Platform_pd *core_pd, Sigma0 *sigma0) { Platform_thread::pager(sigma0); - if (core_pd->bind_thread(this)) - panic("Binding thread failed"); + core_pd->bind_thread(this); cap(thread().local); /* stack begins at the top end of the '_core_pager_stack' array */ @@ -516,8 +515,7 @@ Platform::Platform() : Platform_thread(thi, irqi, "core.main"); core_thread->pager(&_sigma0); - if (_core_pd->bind_thread(core_thread)) - panic("Binding thread failed"); + _core_pd->bind_thread(core_thread); } diff --git a/repos/base-foc/src/core/platform_pd.cc b/repos/base-foc/src/core/platform_pd.cc index 0c18371135..2cd026db5b 100644 --- a/repos/base-foc/src/core/platform_pd.cc +++ b/repos/base-foc/src/core/platform_pd.cc @@ -41,7 +41,7 @@ static addr_t core_utcb_base() { ** Public object members ** ***************************/ -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { /* * Fiasco.OC limits the UTCB area for roottask to 16K. Therefore, the @@ -76,11 +76,10 @@ int Platform_pd::bind_thread(Platform_thread *thread) /* inform thread about binding */ thread->bind(this); - return 0; + return; } PERR("thread alloc failed"); - return -1; } @@ -97,12 +96,12 @@ void Platform_pd::unbind_thread(Platform_thread *thread) } -int Platform_pd::assign_parent(Native_capability parent) +void Platform_pd::assign_parent(Native_capability parent) { - if (!parent.valid()) return -1; - _parent.local = parent; - _parent.remote = PARENT_CAP; - return 0; + if (_parent.remote == Fiasco::L4_INVALID_CAP && parent.valid()) { + _parent.local = parent; + _parent.remote = PARENT_CAP; + } } diff --git a/repos/base-foc/src/core/thread_start.cc b/repos/base-foc/src/core/thread_start.cc index 7fc88f5bd8..ac50bd0243 100644 --- a/repos/base-foc/src/core/thread_start.cc +++ b/repos/base-foc/src/core/thread_start.cc @@ -48,8 +48,7 @@ void Thread_base::start() Platform_thread *pt = new(platform()->core_mem_alloc()) Platform_thread(_stack->name().string()); - if (platform_specific()->core_pd()->bind_thread(pt)) - throw Cpu_session::Thread_creation_failed(); + platform_specific()->core_pd()->bind_thread(pt); l4_utcb_t *foc_utcb = (l4_utcb_t *)(pt->utcb()); diff --git a/repos/base-hw/src/core/include/platform_pd.h b/repos/base-hw/src/core/include/platform_pd.h index 8c1500a685..b176dc9aa5 100644 --- a/repos/base-hw/src/core/include/platform_pd.h +++ b/repos/base-hw/src/core/include/platform_pd.h @@ -187,11 +187,8 @@ class Genode::Platform_pd : public Hw::Address_space, /** * Bind thread 't' to protection domain - * - * \return 0 on success or - * -1 if failed */ - int bind_thread(Platform_thread * t); + void bind_thread(Platform_thread * t); /** * Unbind thread 't' from protection domain @@ -202,7 +199,7 @@ class Genode::Platform_pd : public Hw::Address_space, /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent); + void assign_parent(Native_capability parent); /*************** diff --git a/repos/base-hw/src/core/include/platform_thread.h b/repos/base-hw/src/core/include/platform_thread.h index 875c303e1d..89afced765 100644 --- a/repos/base-hw/src/core/include/platform_thread.h +++ b/repos/base-hw/src/core/include/platform_thread.h @@ -115,11 +115,11 @@ namespace Genode { * \param main_thread wether thread is the first in protection domain * \param address_space corresponding Genode address space * - * \retval 0 succeeded - * \retval -1 failed + * This function has no effect when called more twice for a + * given thread. */ - int join_pd(Platform_pd * const pd, bool const main_thread, - Weak_ptr address_space); + void join_pd(Platform_pd * const pd, bool const main_thread, + Weak_ptr address_space); /** * Run this thread diff --git a/repos/base-hw/src/core/platform_pd.cc b/repos/base-hw/src/core/platform_pd.cc index 7b108f8712..fc47bcdd99 100644 --- a/repos/base-hw/src/core/platform_pd.cc +++ b/repos/base-hw/src/core/platform_pd.cc @@ -131,12 +131,12 @@ void Capability_space::upgrade_slab(Allocator &alloc) ** Platform_pd implementation ** ********************************/ -int Platform_pd::bind_thread(Platform_thread * t) +void Platform_pd::bind_thread(Platform_thread * t) { /* is this the first and therefore main thread in this PD? */ bool main_thread = !_thread_associated; _thread_associated = true; - return t->join_pd(this, main_thread, Address_space::weak_ptr()); + t->join_pd(this, main_thread, Address_space::weak_ptr()); } @@ -144,14 +144,10 @@ void Platform_pd::unbind_thread(Platform_thread *t) { t->join_pd(nullptr, false, Address_space::weak_ptr()); } -int Platform_pd::assign_parent(Native_capability parent) +void Platform_pd::assign_parent(Native_capability parent) { - if (!parent.valid()) { - PERR("parent invalid"); - return -1; - } - _parent = parent; - return 0; + if (!_parent.valid() && parent.valid()) + _parent = parent; } diff --git a/repos/base-hw/src/core/platform_thread.cc b/repos/base-hw/src/core/platform_thread.cc index 2935d01d18..91f59241d6 100644 --- a/repos/base-hw/src/core/platform_thread.cc +++ b/repos/base-hw/src/core/platform_thread.cc @@ -99,20 +99,19 @@ Platform_thread::Platform_thread(size_t const quota, } -int Platform_thread::join_pd(Platform_pd * pd, bool const main_thread, - Weak_ptr address_space) +void Platform_thread::join_pd(Platform_pd * pd, bool const main_thread, + Weak_ptr address_space) { /* check if thread is already in another protection domain */ if (_pd && _pd != pd) { PERR("thread already in another protection domain"); - return -1; + return; } /* join protection domain */ _pd = pd; _main_thread = main_thread; _address_space = address_space; - return 0; } diff --git a/repos/base-linux/src/core/pd_session_component.cc b/repos/base-linux/src/core/pd_session_component.cc index a661453732..c512997a45 100644 --- a/repos/base-linux/src/core/pd_session_component.cc +++ b/repos/base-linux/src/core/pd_session_component.cc @@ -17,13 +17,12 @@ using namespace Genode; -int Pd_session_component::bind_thread(Thread_capability) { return -1; } +void Pd_session_component::bind_thread(Thread_capability) { } -int Pd_session_component::assign_parent(Capability parent) +void Pd_session_component::assign_parent(Capability parent) { _parent = parent; - return 0; } diff --git a/repos/base-nova/src/base/thread/thread_nova.cc b/repos/base-nova/src/base/thread/thread_nova.cc index 2e652a03aa..c08349a651 100644 --- a/repos/base-nova/src/base/thread/thread_nova.cc +++ b/repos/base-nova/src/base/thread/thread_nova.cc @@ -121,9 +121,7 @@ void Thread_base::_init_platform_thread(size_t weight, Type type) throw Cpu_session::Thread_creation_failed(); /* assign thread to protection domain */ - if (env()->pd_session()->bind_thread(_thread_cap)) - throw Cpu_session::Thread_creation_failed(); - + env()->pd_session()->bind_thread(_thread_cap); } diff --git a/repos/base-nova/src/core/include/platform_pd.h b/repos/base-nova/src/core/include/platform_pd.h index c22424c44d..168f4b54f8 100644 --- a/repos/base-nova/src/core/include/platform_pd.h +++ b/repos/base-nova/src/core/include/platform_pd.h @@ -50,11 +50,8 @@ namespace Genode { /** * Bind thread to protection domain - * - * \return 0 on success or - * -1 if thread ID allocation failed. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); /** * Unbind thread from protection domain @@ -66,7 +63,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent); + void assign_parent(Native_capability parent); /** * Return portal capability selector for parent interface diff --git a/repos/base-nova/src/core/platform_pd.cc b/repos/base-nova/src/core/platform_pd.cc index 07889ef5ba..b198a04a0d 100644 --- a/repos/base-nova/src/core/platform_pd.cc +++ b/repos/base-nova/src/core/platform_pd.cc @@ -25,11 +25,10 @@ using namespace Genode; ** Public object members ** ***************************/ -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { thread->bind_to_pd(this, _thread_cnt == 0); _thread_cnt++; - return 0; } @@ -39,13 +38,10 @@ void Platform_pd::unbind_thread(Platform_thread *thread) } -int Platform_pd::assign_parent(Native_capability parent) +void Platform_pd::assign_parent(Native_capability parent) { - if (_parent.valid()) return -1; - if (!parent.valid()) return -2; - - _parent = parent; - return 0; + if (!_parent.valid() && parent.valid()) + _parent = parent; } diff --git a/repos/base-okl4/src/core/include/platform_pd.h b/repos/base-okl4/src/core/include/platform_pd.h index 37a3d8e1bb..e50392e886 100644 --- a/repos/base-okl4/src/core/include/platform_pd.h +++ b/repos/base-okl4/src/core/include/platform_pd.h @@ -171,12 +171,9 @@ namespace Genode { /** * Bind thread to protection domain * - * \return 0 on success or - * -1 if thread ID allocation failed. - * * This function allocates the physical L4 thread ID. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); /** * Unbind thread from protection domain @@ -188,7 +185,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent) { return 0; } + void assign_parent(Native_capability parent) { } Platform_thread* space_pager() const { return _space_pager; } diff --git a/repos/base-okl4/src/core/platform_pd.cc b/repos/base-okl4/src/core/platform_pd.cc index 9511e208b5..234a11b4c6 100644 --- a/repos/base-okl4/src/core/platform_pd.cc +++ b/repos/base-okl4/src/core/platform_pd.cc @@ -176,7 +176,7 @@ void Platform_pd::_free_thread(int thread_id) ** Public object members ** ***************************/ -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { using namespace Okl4; @@ -187,14 +187,13 @@ int Platform_pd::bind_thread(Platform_thread *thread) int t = _alloc_thread(thread_id, thread); if (t < 0) { PERR("thread alloc failed"); - return -1; + return; } thread_id = t; l4_thread_id = make_l4_id(_pd_id, thread_id); /* finally inform thread about binding */ thread->bind(thread_id, l4_thread_id, this); - return 0; } diff --git a/repos/base-okl4/src/core/thread_start.cc b/repos/base-okl4/src/core/thread_start.cc index b2978f9aba..04dd3d9f48 100644 --- a/repos/base-okl4/src/core/thread_start.cc +++ b/repos/base-okl4/src/core/thread_start.cc @@ -40,8 +40,7 @@ void Thread_base::start() native_thread().pt = new(platform_specific()->thread_slab()) Platform_thread(0, _stack->name().string()); - if (platform_specific()->core_pd()->bind_thread(native_thread().pt)) - throw Cpu_session::Thread_creation_failed(); + platform_specific()->core_pd()->bind_thread(native_thread().pt); native_thread().pt->start((void *)_thread_start, stack_top()); } diff --git a/repos/base-pistachio/src/core/include/platform_pd.h b/repos/base-pistachio/src/core/include/platform_pd.h index efdad61a85..c5cb994f91 100644 --- a/repos/base-pistachio/src/core/include/platform_pd.h +++ b/repos/base-pistachio/src/core/include/platform_pd.h @@ -203,12 +203,10 @@ namespace Genode { /** * Bind thread to protection domain * - * \return 0 on success or - * -1 if thread ID allocation failed. - * * This function allocates the physical L4 thread ID. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); + int bind_initial_thread(Platform_thread *thread); /** @@ -221,7 +219,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent) { return 0; } + void assign_parent(Native_capability parent) { } int pd_id() const { return _pd_id; } diff --git a/repos/base-pistachio/src/core/platform_pd.cc b/repos/base-pistachio/src/core/platform_pd.cc index 048c00b9dc..b31e206675 100644 --- a/repos/base-pistachio/src/core/platform_pd.cc +++ b/repos/base-pistachio/src/core/platform_pd.cc @@ -192,7 +192,7 @@ void Platform_pd::_free_thread(int thread_id) ** Public object members ** ***************************/ -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { using namespace Pistachio; @@ -203,7 +203,7 @@ int Platform_pd::bind_thread(Platform_thread *thread) int t = _alloc_thread(thread_id, thread); if (t < 0) { PERR("thread alloc failed"); - return -1; + return; } thread_id = t; l4_thread_id = make_l4_id(_pd_id, thread_id, _version); @@ -212,7 +212,6 @@ int Platform_pd::bind_thread(Platform_thread *thread) thread->bind(thread_id, l4_thread_id, this); if (verbose) _debug_log_threads(); - return 0; } diff --git a/repos/base-sel4/src/core/include/platform_pd.h b/repos/base-sel4/src/core/include/platform_pd.h index eca19553f7..b3d2cfd7db 100644 --- a/repos/base-sel4/src/core/include/platform_pd.h +++ b/repos/base-sel4/src/core/include/platform_pd.h @@ -74,11 +74,8 @@ class Genode::Platform_pd : public Address_space /** * Bind thread to protection domain - * - * \return 0 on success or - * -1 if thread ID allocation failed. */ - int bind_thread(Platform_thread *thread); + void bind_thread(Platform_thread *thread); /** * Unbind thread from protection domain @@ -90,7 +87,7 @@ class Genode::Platform_pd : public Address_space /** * Assign parent interface to protection domain */ - int assign_parent(Native_capability parent); + void assign_parent(Native_capability parent); /***************************** diff --git a/repos/base-sel4/src/core/platform_pd.cc b/repos/base-sel4/src/core/platform_pd.cc index 8340ac9373..e86d2a4228 100644 --- a/repos/base-sel4/src/core/platform_pd.cc +++ b/repos/base-sel4/src/core/platform_pd.cc @@ -52,7 +52,7 @@ static Pd_id_alloc &pd_id_alloc() } -int Platform_pd::bind_thread(Platform_thread *thread) +void Platform_pd::bind_thread(Platform_thread *thread) { ASSERT(thread); @@ -73,8 +73,6 @@ int Platform_pd::bind_thread(Platform_thread *thread) } else { _vm_space.map(thread->_info.ipc_buffer_phys, thread->INITIAL_IPC_BUFFER_VIRT, 1); } - - return 0; } @@ -84,7 +82,7 @@ void Platform_pd::unbind_thread(Platform_thread *thread) } -int Platform_pd::assign_parent(Native_capability parent) +void Platform_pd::assign_parent(Native_capability parent) { Capability_space::Ipc_cap_data const ipc_cap_data = Capability_space::ipc_cap_data(parent); @@ -98,7 +96,6 @@ int Platform_pd::assign_parent(Native_capability parent) _cspace_cnode.copy(platform_specific()->core_cnode(), Cnode_index(ipc_cap_data.sel), Cnode_index(INITIAL_SEL_PARENT)); - return 0; } diff --git a/repos/base/include/pd_session/client.h b/repos/base/include/pd_session/client.h index ff00be5daf..d8971849f4 100644 --- a/repos/base/include/pd_session/client.h +++ b/repos/base/include/pd_session/client.h @@ -25,11 +25,11 @@ struct Genode::Pd_session_client : Rpc_client explicit Pd_session_client(Pd_session_capability session) : Rpc_client(session) { } - int bind_thread(Thread_capability thread) override { - return call(thread); } + void bind_thread(Thread_capability thread) override { + call(thread); } - int assign_parent(Capability parent) override { - return call(parent); } + void assign_parent(Capability parent) override { + call(parent); } bool assign_pci(addr_t pci_config_memory_address, uint16_t bdf) override { return call(pci_config_memory_address, bdf); } diff --git a/repos/base/include/pd_session/pd_session.h b/repos/base/include/pd_session/pd_session.h index c1f6f26f76..b819d834d9 100644 --- a/repos/base/include/pd_session/pd_session.h +++ b/repos/base/include/pd_session/pd_session.h @@ -41,20 +41,18 @@ struct Genode::Pd_session : Session * * \param thread capability of thread to bind * - * \return 0 on success or negative error code - * - * After successful bind, the thread will execute inside this - * protection domain when started. + * After binding, the thread will execute inside this protection domain + * when started. A thread can be bound to a PD only once. Subsequent + * attempts to bind the thread to another PD are ignored. */ - virtual int bind_thread(Thread_capability thread) = 0; + virtual void bind_thread(Thread_capability thread) = 0; /** * Assign parent to protection domain * * \param parent capability of parent interface - * \return 0 on success, or negative error code */ - virtual int assign_parent(Capability parent) = 0; + virtual void assign_parent(Capability parent) = 0; /** * Assign PCI device to PD @@ -176,8 +174,8 @@ struct Genode::Pd_session : Session ** RPC declaration ** *********************/ - GENODE_RPC(Rpc_bind_thread, int, bind_thread, Thread_capability); - GENODE_RPC(Rpc_assign_parent, int, assign_parent, Capability); + GENODE_RPC(Rpc_bind_thread, void, bind_thread, Thread_capability); + GENODE_RPC(Rpc_assign_parent, void, assign_parent, Capability); GENODE_RPC(Rpc_assign_pci, bool, assign_pci, addr_t, uint16_t); GENODE_RPC_THROW(Rpc_alloc_signal_source, Signal_source_capability, diff --git a/repos/base/src/base/process/process.cc b/repos/base/src/base/process/process.cc index 27d8992727..6a83dbf31c 100644 --- a/repos/base/src/base/process/process.cc +++ b/repos/base/src/base/process/process.cc @@ -188,8 +188,8 @@ Process::Process(Dataspace_capability elf_ds_cap, enum Local_exception { - THREAD_FAIL, ELF_FAIL, ASSIGN_PARENT_FAIL, THREAD_ADD_FAIL, - THREAD_BIND_FAIL, THREAD_PAGER_FAIL, THREAD_START_FAIL, + THREAD_FAIL, ELF_FAIL, THREAD_ADD_FAIL, + THREAD_PAGER_FAIL, THREAD_START_FAIL, }; /* XXX this only catches local exceptions */ @@ -240,24 +240,17 @@ Process::Process(Dataspace_capability elf_ds_cap, } /* register parent interface for new protection domain */ - if (_pd_session_client.assign_parent(parent_cap)) { - PERR("Could not assign parent interface to new PD"); - throw ASSIGN_PARENT_FAIL; - } + _pd_session_client.assign_parent(parent_cap); /* bind thread0 */ - err = _pd_session_client.bind_thread(_thread0_cap); - if (err) { - PERR("Thread binding failed (%d)", err); - throw THREAD_BIND_FAIL; - } + _pd_session_client.bind_thread(_thread0_cap); /* register thread0 at region manager session */ Pager_capability pager; try { pager = _rm_session_client.add_client(_thread0_cap); } catch (...) { - PERR("Pager setup failed (%d)", err); + PERR("Pager setup failed"); throw THREAD_ADD_FAIL; } @@ -290,8 +283,6 @@ Process::Process(Dataspace_capability elf_ds_cap, case THREAD_START_FAIL: case THREAD_PAGER_FAIL: case THREAD_ADD_FAIL: - case THREAD_BIND_FAIL: - case ASSIGN_PARENT_FAIL: case ELF_FAIL: _cpu_session_client.kill_thread(_thread0_cap); diff --git a/repos/base/src/base/thread/thread_start.cc b/repos/base/src/base/thread/thread_start.cc index 3ea6bca610..b0b9a5c05d 100644 --- a/repos/base/src/base/thread/thread_start.cc +++ b/repos/base/src/base/thread/thread_start.cc @@ -64,8 +64,7 @@ void Thread_base::start() throw Cpu_session::Thread_creation_failed(); /* assign thread to protection domain */ - if (env()->pd_session()->bind_thread(_thread_cap)) - throw Cpu_session::Thread_creation_failed(); + env()->pd_session()->bind_thread(_thread_cap); /* create new pager object and assign it to the new thread */ Pager_capability pager_cap = env()->rm_session()->add_client(_thread_cap); diff --git a/repos/base/src/core/include/core_pd_session.h b/repos/base/src/core/include/core_pd_session.h index d738354cd4..26b4ba8bcf 100644 --- a/repos/base/src/core/include/core_pd_session.h +++ b/repos/base/src/core/include/core_pd_session.h @@ -45,12 +45,12 @@ class Genode::Core_pd_session_component : public Rpc_object _signal_source_ep(signal_source_ep) { } - int bind_thread(Thread_capability thread) override + void bind_thread(Thread_capability thread) override { ASSERT_NEVER_CALLED; } - int assign_parent(Capability parent) override + void assign_parent(Capability parent) override { ASSERT_NEVER_CALLED; } diff --git a/repos/base/src/core/include/pd_session_component.h b/repos/base/src/core/include/pd_session_component.h index dd07a18587..61a6fd2058 100644 --- a/repos/base/src/core/include/pd_session_component.h +++ b/repos/base/src/core/include/pd_session_component.h @@ -106,8 +106,8 @@ class Genode::Pd_session_component : public Rpc_object ** PD session interface ** **************************/ - int bind_thread(Thread_capability) override; - int assign_parent(Capability) override; + void bind_thread(Thread_capability) override; + void assign_parent(Capability) override; bool assign_pci(addr_t, uint16_t) override; Signal_source_capability alloc_signal_source() override diff --git a/repos/base/src/core/pd_session_component.cc b/repos/base/src/core/pd_session_component.cc index 71d1a7c214..efdd301775 100644 --- a/repos/base/src/core/pd_session_component.cc +++ b/repos/base/src/core/pd_session_component.cc @@ -24,30 +24,26 @@ using namespace Genode; -int Pd_session_component::bind_thread(Thread_capability thread) +void Pd_session_component::bind_thread(Thread_capability thread) { return _thread_ep.apply(thread, [&] (Cpu_thread_component *cpu_thread) { - if (!cpu_thread) return -1; + if (!cpu_thread) return; if (cpu_thread->bound()) { PWRN("rebinding of threads not supported"); - return -2; + return; } Platform_thread *p_thread = cpu_thread->platform_thread(); - int res = _pd.bind_thread(p_thread); - - if (res) - return res; + _pd.bind_thread(p_thread); cpu_thread->bound(true); - return 0; }); } -int Pd_session_component::assign_parent(Parent_capability parent) +void Pd_session_component::assign_parent(Parent_capability parent) { - return _pd.assign_parent(parent); + _pd.assign_parent(parent); }