nova: use async. map for thread/pd bootstrap

Fixes #2173
This commit is contained in:
Alexander Boettcher
2016-11-30 19:36:32 +01:00
committed by Norman Feske
parent 5a72738def
commit e93ef168a1
14 changed files with 270 additions and 295 deletions

View File

@ -20,7 +20,6 @@
#include <base/env.h>
#include <base/rpc_client.h>
#include <session/session.h>
#include <nova_native_cpu/client.h>
#include <cpu_thread/client.h>
/* base-internal includes */
@ -82,13 +81,10 @@ void Thread::_init_platform_thread(size_t weight, Type type)
if (type == MAIN || type == REINITIALIZED_MAIN) {
_thread_cap = env()->parent()->main_thread_cap();
Genode::Native_capability pager_cap =
Capability_space::import(Nova::PT_SEL_MAIN_PAGER);
native_thread().exc_pt_sel = 0;
native_thread().ec_sel = Nova::PT_SEL_MAIN_EC;
request_native_ec_cap(pager_cap, native_thread().ec_sel);
request_native_ec_cap(PT_SEL_PAGE_FAULT, native_thread().ec_sel);
return;
}
@ -126,8 +122,8 @@ void Thread::_deinit_platform_thread()
using namespace Nova;
if (native_thread().ec_sel != Native_thread::INVALID_INDEX) {
revoke(Obj_crd(native_thread().ec_sel, 1));
cap_map()->remove(native_thread().ec_sel, 1, false);
revoke(Obj_crd(native_thread().ec_sel, 0));
cap_map()->remove(native_thread().ec_sel, 0, false);
}
/* de-announce thread */
@ -151,14 +147,6 @@ void Thread::start()
using namespace Genode;
/* obtain interface to NOVA-specific CPU session operations */
Nova_native_cpu_client native_cpu(_cpu_session->native_cpu());
/* create new pager object and assign it to the new thread */
Native_capability pager_cap = native_cpu.pager_cap(_thread_cap);
if (!pager_cap.valid())
throw Cpu_session::Thread_creation_failed();
/* create EC at core */
Thread_state state;
state.sel_exc_base = native_thread().exc_pt_sel;
@ -175,20 +163,20 @@ void Thread::start()
cpu_thread.start(thread_ip, _stack->top());
/* request native EC thread cap */
native_thread().ec_sel = cap_map()->insert(1);
native_thread().ec_sel = cap_map()->insert();
if (native_thread().ec_sel == Native_thread::INVALID_INDEX)
throw Cpu_session::Thread_creation_failed();
/* requested pager cap used by request_native_ec_cap in Signal_source_client */
enum { MAP_PAGER_CAP = 1 };
request_native_ec_cap(pager_cap, native_thread().ec_sel, MAP_PAGER_CAP);
/*
* Requested ec cap that is used for recall and
* creation of portals (Nova_native_pd::alloc_rpc_cap).
*/
request_native_ec_cap(native_thread().exc_pt_sel + Nova::PT_SEL_PAGE_FAULT,
native_thread().ec_sel);
using namespace Nova;
/* request exception portals for normal threads */
if (!native_thread().vcpu) {
request_event_portal(pager_cap, native_thread().exc_pt_sel, 0, NUM_INITIAL_PT_LOG2);
/* default: we don't accept any mappings or translations */
Utcb * utcb_obj = reinterpret_cast<Utcb *>(utcb());
utcb_obj->crd_rcv = Obj_crd();