hw: use platform-thread pointer as pager badge

ref #953
This commit is contained in:
Martin Stein 2013-11-15 13:47:55 +01:00 committed by Norman Feske
parent e0419b2401
commit 87da21d967
4 changed files with 17 additions and 12 deletions

View File

@ -133,7 +133,7 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
Signal_context_capability _signal_context_cap; Signal_context_capability _signal_context_cap;
Thread_capability _thread_cap; Thread_capability _thread_cap;
char _signal_buf[sizeof(Signal)]; char _signal_buf[sizeof(Signal)];
unsigned const _thread_id; unsigned const _badge;
/*************** /***************
@ -147,9 +147,9 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
/** /**
* Constructor * Constructor
* *
* \param thread_id kernel name of faulter thread * \param badge user identifaction of pager object
*/ */
Pager_object(unsigned const thread_id, Affinity::Location); Pager_object(unsigned const badge, Affinity::Location);
/** /**
* Destructor * Destructor

View File

@ -72,7 +72,7 @@ void Pager_object::exception_handler(Signal_context_capability) { }
void Pager_object::fault_resolved() { _signal()->~Signal(); } void Pager_object::fault_resolved() { _signal()->~Signal(); }
unsigned Pager_object::badge() const { return _thread_id; } unsigned Pager_object::badge() const { return _badge; }
void Pager_object::fault_occured(Signal const & s) void Pager_object::fault_occured(Signal const & s)
@ -87,9 +87,9 @@ void Pager_object::cap(Native_capability const & c)
} }
Pager_object::Pager_object(unsigned const thread_id, Affinity::Location) Pager_object::Pager_object(unsigned const badge, Affinity::Location)
: :
_thread_id(thread_id) _badge(badge)
{ } { }

View File

@ -140,7 +140,7 @@ namespace Genode {
/** /**
* Return unique identification of this thread as faulter * Return unique identification of this thread as faulter
*/ */
unsigned pager_object_badge() { return _id; } unsigned pager_object_badge() { return (unsigned)this; }
/** /**
* Set the executing CPU for this thread * Set the executing CPU for this thread

View File

@ -31,14 +31,14 @@ using namespace Genode;
void Rm_client::unmap(addr_t, addr_t virt_base, size_t size) void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
{ {
/* get software TLB of the thread that we serve */ /* get software TLB of the thread that we serve */
Platform_thread * const pt = Kernel::get_thread(badge()); Platform_thread * const pt = (Platform_thread *)badge();
if (!pt) { if (!pt) {
PERR("failed to get RM client-thread"); PERR("failed to get platform thread of RM client");
return; return;
} }
Tlb * const tlb = pt->tlb(); Tlb * const tlb = pt->tlb();
if (!tlb) { if (!tlb) {
PERR("failed to get PD of RM client-thread"); PERR("failed to get page table of RM client");
return; return;
} }
/* update all translation caches */ /* update all translation caches */
@ -108,7 +108,12 @@ void Pager_activation_base::entry()
PERR("unknown pager object"); PERR("unknown pager object");
} }
/* fetch fault data */ /* fetch fault data */
unsigned const thread_id = o->badge(); Platform_thread * const pt = (Platform_thread *)o->badge();
if (!pt) {
PERR("failed to get platform thread of faulter");
continue;
}
unsigned const thread_id = pt->id();
typedef Kernel::Thread_reg_id Reg_id; typedef Kernel::Thread_reg_id Reg_id;
static addr_t const read_regs[] = { static addr_t const read_regs[] = {
Reg_id::FAULT_TLB, Reg_id::IP, Reg_id::FAULT_ADDR, Reg_id::FAULT_TLB, Reg_id::IP, Reg_id::FAULT_ADDR,
@ -118,7 +123,7 @@ void Pager_activation_base::entry()
memcpy(utcb, read_regs, sizeof(read_regs)); memcpy(utcb, read_regs, sizeof(read_regs));
addr_t * const read_values = (addr_t *)&_fault; addr_t * const read_values = (addr_t *)&_fault;
if (Kernel::access_thread_regs(thread_id, READS, 0, read_values, 0)) { if (Kernel::access_thread_regs(thread_id, READS, 0, read_values, 0)) {
PERR("failed to read page-fault data"); PERR("failed to read fault data");
continue; continue;
} }
/* handle fault */ /* handle fault */