hw: communicate UTCB dataspace through start info
To remap its UTCB to its context area later, a main thread needs to know the according dataspace capability. This is done through the start-info it receives from its creator at startup. ref #989
This commit is contained in:
parent
42f51cd802
commit
6aa0ab1bf9
|
@ -234,7 +234,8 @@ class Genode::Start_info
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Native_thread_id _thread_id;
|
Native_thread_id _thread_id;
|
||||||
|
Native_capability _utcb_ds;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -243,7 +244,12 @@ class Genode::Start_info
|
||||||
*
|
*
|
||||||
* \param thread_id kernel name of the thread that is started
|
* \param thread_id kernel name of the thread that is started
|
||||||
*/
|
*/
|
||||||
void init(Native_thread_id const thread_id) { _thread_id = thread_id; }
|
void init(Native_thread_id const thread_id,
|
||||||
|
Native_capability const & utcb_ds)
|
||||||
|
{
|
||||||
|
_thread_id = thread_id;
|
||||||
|
_utcb_ds = utcb_ds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
|
@ -251,6 +257,7 @@ class Genode::Start_info
|
||||||
***************/
|
***************/
|
||||||
|
|
||||||
Native_thread_id thread_id() const { return _thread_id; }
|
Native_thread_id thread_id() const { return _thread_id; }
|
||||||
|
Native_capability utcb_ds() const { return _utcb_ds; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Genode::Native_utcb
|
class Genode::Native_utcb
|
||||||
|
@ -285,7 +292,7 @@ namespace Genode
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return virtual UTCB location of main threads
|
* Return virtual UTCB location of main threads
|
||||||
*/
|
*/
|
||||||
inline Native_utcb * main_thread_utcb()
|
inline Native_utcb * main_thread_utcb()
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,7 +250,7 @@ extern "C" void kernel()
|
||||||
static Native_utcb utcb;
|
static Native_utcb utcb;
|
||||||
static Thread t(Priority::MAX, "core");
|
static Thread t(Priority::MAX, "core");
|
||||||
_main_thread_utcb = &utcb;
|
_main_thread_utcb = &utcb;
|
||||||
_main_thread_utcb->start_info()->init(t.id());
|
_main_thread_utcb->start_info()->init(t.id(), Genode::Native_capability());
|
||||||
t.ip = (addr_t)CORE_MAIN;;
|
t.ip = (addr_t)CORE_MAIN;;
|
||||||
t.sp = (addr_t)s + STACK_SIZE;
|
t.sp = (addr_t)s + STACK_SIZE;
|
||||||
t.init(0, core_id(), &utcb, 1);
|
t.init(0, core_id(), &utcb, 1);
|
||||||
|
|
|
@ -189,7 +189,7 @@ int Platform_thread::start(void * const ip, void * const sp,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* start executing new thread */
|
/* start executing new thread */
|
||||||
_utcb_phys->start_info()->init(_id);
|
_utcb_phys->start_info()->init(_id, _utcb);
|
||||||
_tlb = Kernel::start_thread(_id, cpu_id, _pd_id, _utcb_phys);
|
_tlb = Kernel::start_thread(_id, cpu_id, _pd_id, _utcb_phys);
|
||||||
if (!_tlb) {
|
if (!_tlb) {
|
||||||
PERR("failed to start thread");
|
PERR("failed to start thread");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user