From 6aa0ab1bf96bd9e73633cdccc12e44bdd6f6991e Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 5 Dec 2013 00:08:09 +0100 Subject: [PATCH] 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 --- base-hw/include/base/native_types.h | 13 ++++++++++--- base-hw/src/core/kernel/kernel.cc | 2 +- base-hw/src/core/platform_thread.cc | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/base-hw/include/base/native_types.h b/base-hw/include/base/native_types.h index d48d3ec1e..c6b4ee489 100644 --- a/base-hw/include/base/native_types.h +++ b/base-hw/include/base/native_types.h @@ -234,7 +234,8 @@ class Genode::Start_info { private: - Native_thread_id _thread_id; + Native_thread_id _thread_id; + Native_capability _utcb_ds; public: @@ -243,7 +244,12 @@ class Genode::Start_info * * \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_capability utcb_ds() const { return _utcb_ds; } }; 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() { diff --git a/base-hw/src/core/kernel/kernel.cc b/base-hw/src/core/kernel/kernel.cc index 8f82d0113..aab5efae4 100644 --- a/base-hw/src/core/kernel/kernel.cc +++ b/base-hw/src/core/kernel/kernel.cc @@ -250,7 +250,7 @@ extern "C" void kernel() static Native_utcb utcb; static Thread t(Priority::MAX, "core"); _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.sp = (addr_t)s + STACK_SIZE; t.init(0, core_id(), &utcb, 1); diff --git a/base-hw/src/core/platform_thread.cc b/base-hw/src/core/platform_thread.cc index 6ffd4caaa..89c6ed572 100644 --- a/base-hw/src/core/platform_thread.cc +++ b/base-hw/src/core/platform_thread.cc @@ -189,7 +189,7 @@ int Platform_thread::start(void * const ip, void * const sp, return -1; } /* 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); if (!_tlb) { PERR("failed to start thread");