From e38060d81e68a98a06f9ba9cba18cee2107df78d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 6 Mar 2014 13:39:08 +0100 Subject: [PATCH] hw: get a thread cap in Thread_base constructor Previously this was not done before Thread_base::start(..) in base-hw as it was not needed to have a valid cap that early. However, when changing the affinity of a thread we need the cap to be valid before Thread_base::start(..). ref #1076 --- base-hw/src/base/thread/thread_bootstrap.cc | 10 +++++++++- base-hw/src/base/thread_support.cc | 6 ------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/base-hw/src/base/thread/thread_bootstrap.cc b/base-hw/src/base/thread/thread_bootstrap.cc index 999cdb9375..7c3cc925de 100644 --- a/base-hw/src/base/thread/thread_bootstrap.cc +++ b/base-hw/src/base/thread/thread_bootstrap.cc @@ -74,7 +74,15 @@ void Thread_base::_thread_bootstrap() void Thread_base::_init_platform_thread(Type type) { /* nothing platform specific to do if this is not a special thread */ - if (type == NORMAL) { return; } + if (type == NORMAL) + { + /* create server object */ + char buf[48]; + name(buf, sizeof(buf)); + Cpu_session * cpu = env()->cpu_session(); + _thread_cap = cpu->create_thread(buf, (addr_t)&_context->utcb); + return; + } /* if we got reinitialized we have to get rid of the old UTCB */ size_t const utcb_size = sizeof(Native_utcb); diff --git a/base-hw/src/base/thread_support.cc b/base-hw/src/base/thread_support.cc index 2703183b6d..da20d98928 100644 --- a/base-hw/src/base/thread_support.cc +++ b/base-hw/src/base/thread_support.cc @@ -61,12 +61,6 @@ void Thread_base::_deinit_platform_thread() void Thread_base::start() { - /* create server object */ - char buf[48]; - name(buf, sizeof(buf)); - Cpu_session * cpu = env()->cpu_session(); - _thread_cap = cpu->create_thread(buf, (addr_t)&_context->utcb); - /* assign thread to protection domain */ env()->pd_session()->bind_thread(_thread_cap);