mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 15:43:56 +00:00
core: unify and simplify paging code (Fix #1641)
For most platforms except of NOVA a distinction between pager entrypoint and pager activation is not needed, and only exists due to historical reasons. Moreover, the pager thread's execution path is almost identical between most platforms excluding NOVA, HW, and Fisco.OC. Therefore, this commit unifies the pager loop for the other platforms, and removes the pager activation class.
This commit is contained in:
committed by
Christian Helmuth
parent
a574f73005
commit
eafe5e81e3
@ -47,15 +47,7 @@ namespace Genode
|
||||
*/
|
||||
class Pager_entrypoint;
|
||||
|
||||
/**
|
||||
* A thread that processes one page fault of a pager object at a time
|
||||
*/
|
||||
class Pager_activation_base;
|
||||
|
||||
/**
|
||||
* Pager-activation base with custom stack size
|
||||
*/
|
||||
template <unsigned STACK_SIZE> class Pager_activation;
|
||||
enum { PAGER_EP_STACK_SIZE = sizeof(addr_t) * 2048 };
|
||||
}
|
||||
|
||||
struct Genode::Mapping
|
||||
@ -198,26 +190,30 @@ class Genode::Pager_object
|
||||
void thread_cap(Thread_capability const & c);
|
||||
};
|
||||
|
||||
class Genode::Pager_activation_base
|
||||
: public Thread_base,
|
||||
public Kernel_object<Kernel::Signal_receiver>,
|
||||
public Ipc_pager
|
||||
|
||||
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
|
||||
public Thread<PAGER_EP_STACK_SIZE>,
|
||||
public Kernel_object<Kernel::Signal_receiver>,
|
||||
public Ipc_pager
|
||||
{
|
||||
private:
|
||||
|
||||
Lock _startup_lock;
|
||||
Pager_entrypoint * _ep;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param name name of the new thread
|
||||
* \param stack_size stack size of the new thread
|
||||
* \param a activation that shall handle the objects of the entrypoint
|
||||
*/
|
||||
Pager_activation_base(char const * const name,
|
||||
size_t const stack_size);
|
||||
Pager_entrypoint(Cap_session * cap_session);
|
||||
|
||||
/**
|
||||
* Associate pager object 'obj' with entry point
|
||||
*/
|
||||
Pager_capability manage(Pager_object * const obj);
|
||||
|
||||
/**
|
||||
* Dissolve pager object 'obj' from entry point
|
||||
*/
|
||||
void dissolve(Pager_object * const obj);
|
||||
|
||||
/**
|
||||
* Bring current mapping data into effect
|
||||
@ -233,55 +229,6 @@ class Genode::Pager_activation_base
|
||||
**********************/
|
||||
|
||||
void entry();
|
||||
|
||||
|
||||
/***************
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
void ep(Pager_entrypoint * const ep);
|
||||
};
|
||||
|
||||
class Genode::Pager_entrypoint : public Object_pool<Pager_object>
|
||||
{
|
||||
private:
|
||||
|
||||
Pager_activation_base * const _activation;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param a activation that shall handle the objects of the entrypoint
|
||||
*/
|
||||
Pager_entrypoint(Cap_session *, Pager_activation_base * const a);
|
||||
|
||||
/**
|
||||
* Associate pager object 'obj' with entry point
|
||||
*/
|
||||
Pager_capability manage(Pager_object * const obj);
|
||||
|
||||
/**
|
||||
* Dissolve pager object 'obj' from entry point
|
||||
*/
|
||||
void dissolve(Pager_object * const obj);
|
||||
};
|
||||
|
||||
template <unsigned STACK_SIZE>
|
||||
class Genode::Pager_activation : public Pager_activation_base
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Pager_activation()
|
||||
:
|
||||
Pager_activation_base("pager_activation", STACK_SIZE)
|
||||
{
|
||||
start();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__PAGER_H_ */
|
||||
|
@ -97,21 +97,6 @@ Pager_object::Pager_object(unsigned const badge, Affinity::Location)
|
||||
{ }
|
||||
|
||||
|
||||
/***************************
|
||||
** Pager_activation_base **
|
||||
***************************/
|
||||
|
||||
void Pager_activation_base::ep(Pager_entrypoint * const ep) { _ep = ep; }
|
||||
|
||||
|
||||
Pager_activation_base::Pager_activation_base(char const * const name,
|
||||
size_t const stack_size)
|
||||
: Thread_base(0, name, stack_size),
|
||||
Kernel_object<Kernel::Signal_receiver>(true),
|
||||
_startup_lock(Lock::LOCKED), _ep(0)
|
||||
{ }
|
||||
|
||||
|
||||
/**********************
|
||||
** Pager_entrypoint **
|
||||
**********************/
|
||||
@ -122,15 +107,16 @@ void Pager_entrypoint::dissolve(Pager_object * const o)
|
||||
}
|
||||
|
||||
|
||||
Pager_entrypoint::Pager_entrypoint(Cap_session *,
|
||||
Pager_activation_base * const activation)
|
||||
: _activation(activation) {
|
||||
_activation->ep(this); }
|
||||
Pager_entrypoint::Pager_entrypoint(Cap_session *)
|
||||
: Thread<PAGER_EP_STACK_SIZE>("pager_ep"),
|
||||
Kernel_object<Kernel::Signal_receiver>(true)
|
||||
{ start(); }
|
||||
|
||||
|
||||
Pager_capability Pager_entrypoint::manage(Pager_object * const o)
|
||||
{
|
||||
o->start_paging(_activation->kernel_object());
|
||||
o->start_paging(kernel_object());
|
||||
insert(o);
|
||||
return reinterpret_cap_cast<Pager_object>(o->cap());
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
|
||||
}
|
||||
|
||||
|
||||
/***************************
|
||||
** Pager_activation_base **
|
||||
***************************/
|
||||
/**********************
|
||||
** Pager_entrypoint **
|
||||
**********************/
|
||||
|
||||
int Pager_activation_base::apply_mapping()
|
||||
int Pager_entrypoint::apply_mapping()
|
||||
{
|
||||
Page_flags const flags =
|
||||
Page_flags::apply_mapping(_mapping.writable,
|
||||
@ -54,10 +54,8 @@ int Pager_activation_base::apply_mapping()
|
||||
}
|
||||
|
||||
|
||||
void Pager_activation_base::entry()
|
||||
void Pager_entrypoint::entry()
|
||||
{
|
||||
/* get ready to receive faults */
|
||||
_startup_lock.unlock();
|
||||
while (1)
|
||||
{
|
||||
/* receive fault */
|
||||
@ -71,7 +69,7 @@ void Pager_activation_base::entry()
|
||||
* FIXME: The implicit lookup of the oject isn't needed.
|
||||
*/
|
||||
unsigned const pon = po->cap().local_name();
|
||||
Object_pool<Pager_object>::Guard pog(_ep->lookup_and_lock(pon));
|
||||
Object_pool<Pager_object>::Guard pog(lookup_and_lock(pon));
|
||||
if (!pog) continue;
|
||||
|
||||
/* fetch fault data */
|
||||
|
Reference in New Issue
Block a user