2013-02-25 21:18:26 +01:00
|
|
|
/*
|
|
|
|
* \brief Thread bootstrap code
|
|
|
|
* \author Christian Prochaska
|
|
|
|
* \date 2013-02-15
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 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>
|
2014-02-21 17:57:59 +01:00
|
|
|
#include <base/env.h>
|
2013-02-25 21:18:26 +01:00
|
|
|
|
2016-03-11 17:32:43 +01:00
|
|
|
/* base-internal includes */
|
|
|
|
#include <base/internal/native_thread.h>
|
|
|
|
|
2013-02-25 21:18:26 +01:00
|
|
|
/* Pistachio includes */
|
2016-03-08 17:44:54 +01:00
|
|
|
namespace Pistachio {
|
2014-01-28 14:30:36 +01:00
|
|
|
#include <l4/thread.h>
|
|
|
|
}
|
|
|
|
|
2016-03-08 17:44:54 +01:00
|
|
|
Pistachio::L4_ThreadId_t main_thread_tid;
|
2014-01-28 14:30:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************
|
|
|
|
** Startup library support **
|
|
|
|
*****************************/
|
|
|
|
|
|
|
|
void prepare_init_main_thread()
|
|
|
|
{
|
|
|
|
main_thread_tid = Pistachio::L4_Myself();
|
2013-02-25 21:18:26 +01:00
|
|
|
}
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
void prepare_reinit_main_thread() { prepare_init_main_thread(); }
|
|
|
|
|
|
|
|
|
2016-05-04 12:27:17 +02:00
|
|
|
/************
|
|
|
|
** Thread **
|
|
|
|
************/
|
2014-01-28 14:30:36 +01:00
|
|
|
|
2016-05-04 12:27:17 +02:00
|
|
|
void Genode::Thread::_thread_bootstrap()
|
2013-02-25 21:18:26 +01:00
|
|
|
{
|
2016-03-11 17:32:43 +01:00
|
|
|
native_thread().l4id = Pistachio::L4_Myself();
|
2013-02-25 21:18:26 +01:00
|
|
|
}
|
2014-01-28 14:30:36 +01:00
|
|
|
|
|
|
|
|
2016-05-04 12:27:17 +02:00
|
|
|
void Genode::Thread::_init_platform_thread(size_t, Type type)
|
2014-01-28 14:30:36 +01:00
|
|
|
{
|
|
|
|
if (type == NORMAL) { return; }
|
2016-03-11 17:32:43 +01:00
|
|
|
native_thread().l4id = main_thread_tid;
|
2014-02-21 17:57:59 +01:00
|
|
|
_thread_cap = env()->parent()->main_thread_cap();
|
2014-01-28 14:30:36 +01:00
|
|
|
}
|