foc: check result of bind_thread

Issue #1418
This commit is contained in:
Alexander Boettcher 2015-02-24 13:18:35 +01:00 committed by Christian Helmuth
parent d7b88afb68
commit 75ab803ea2
3 changed files with 13 additions and 4 deletions

View File

@ -53,13 +53,18 @@ void Thread_base::_init_platform_thread(size_t, Type type)
_thread_cap = _cpu_session->create_thread(0, buf);
/* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap);
if (!_thread_cap.valid() ||
env()->pd_session()->bind_thread(_thread_cap))
throw Cpu_session::Thread_creation_failed();
return;
}
/* adjust values whose computation differs for a main thread */
_tid = Fiasco::MAIN_THREAD_CAP;
_thread_cap = env()->parent()->main_thread_cap();
if (!_thread_cap.valid())
throw Cpu_session::Thread_creation_failed();
/* make thread object known to the Fiasco environment */
addr_t const t = (addr_t)this;
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_THREAD_OBJ] = t;

View File

@ -140,7 +140,8 @@ Platform::Core_pager::Core_pager(Platform_pd *core_pd, Sigma0 *sigma0)
{
Platform_thread::pager(sigma0);
core_pd->bind_thread(this);
if (core_pd->bind_thread(this))
panic("Binding thread failed");
cap(thread().local);
/* stack begins at the top end of the '_core_pager_stack' array */
@ -499,7 +500,8 @@ Platform::Platform() :
Platform_thread(thi, irqi, "core.main");
core_thread->pager(&_sigma0);
_core_pd->bind_thread(core_thread);
if (_core_pd->bind_thread(core_thread))
panic("Binding thread failed");
}

View File

@ -46,7 +46,9 @@ void Thread_base::start()
Platform_thread *pt =
new(platform()->core_mem_alloc()) Platform_thread(_context->name);
platform_specific()->core_pd()->bind_thread(pt);
if (platform_specific()->core_pd()->bind_thread(pt))
throw Cpu_session::Thread_creation_failed();
_tid = pt->gate().remote;
_thread_cap =
reinterpret_cap_cast<Cpu_thread>(Native_capability(pt->thread().local));