genode/base-foc/src/core/thread_start.cc
Norman Feske 297538678e foc: Create thread at core at construction time
Originally, a thread was created at core not before calling the 'start'
function. In order to configure the thread affinity before starting the
thread, we have to make the thread known at core right at construction
time. This patch moves the needed thread-creation sequence from the
'start' function to the '_init_platform_thread' function.
2013-03-21 12:47:42 +01:00

69 lines
1.5 KiB
C++

/*
* \brief Fiasco.OC-specific implementation of core's startup Thread API.
* \author Norman Feske
* \author Stefan Kalkowski
* \date 2006-05-03
*/
/*
* Copyright (C) 2006-2013 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 <base/thread.h>
#include <base/sleep.h>
/* core includes */
#include <cap_session_component.h>
#include <platform.h>
#include <core_env.h>
namespace Fiasco {
#include <l4/sys/debugger.h>
#include <l4/sys/factory.h>
}
using namespace Genode;
void Thread_base::_deinit_platform_thread()
{
PWRN("%s: not implemented yet!", __func__);
}
void Genode::Thread_base::_init_platform_thread() { }
void Thread_base::start()
{
using namespace Fiasco;
/* create and start platform thread */
Platform_thread *pt =
new(platform()->core_mem_alloc()) Platform_thread(_context->name);
platform_specific()->core_pd()->bind_thread(pt);
_tid = pt->gate().remote;
_thread_cap =
reinterpret_cap_cast<Cpu_thread>(Native_capability(pt->thread().local));
pt->pager(platform_specific()->core_pager());
_context->utcb = pt->utcb();
l4_utcb_tcr_u(pt->utcb())->user[UTCB_TCR_BADGE] = (unsigned long) pt->gate().local.idx();
l4_utcb_tcr_u(pt->utcb())->user[UTCB_TCR_THREAD_OBJ] = (addr_t)this;
pt->start((void *)_thread_start, _context->stack);
}
void Thread_base::cancel_blocking()
{
/*
* Within core, we never need to unblock threads
*/
}