mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
foc: keep core internal pager state separately
beforehand the Lock object and more was accessible via FOC native cpu thread RPC Fixes #3809
This commit is contained in:
parent
f3efbe50bb
commit
6fa4307005
@ -33,17 +33,11 @@ struct Genode::Foc_thread_state : Thread_state
|
||||
Fiasco::l4_cap_idx_t kcap; /* thread's gate cap in its pd */
|
||||
int id; /* id of gate capability */
|
||||
addr_t utcb; /* thread's utcb in its pd */
|
||||
unsigned exceptions; /* counts exceptions raised by the thread */
|
||||
bool paused; /* indicates whether thread is stopped */
|
||||
bool in_exception; /* true if thread is in exception */
|
||||
Lock lock { };
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Foc_thread_state()
|
||||
: kcap(Fiasco::L4_INVALID_CAP), id(0), utcb(0), exceptions(0),
|
||||
paused(false), in_exception(false) { }
|
||||
Foc_thread_state() : kcap(Fiasco::L4_INVALID_CAP), id(0), utcb(0) { }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__FOC__THREAD_STATE_H_ */
|
||||
|
@ -16,6 +16,15 @@
|
||||
|
||||
#include <foc/thread_state.h>
|
||||
|
||||
namespace Genode { typedef Foc_thread_state Pager_object_exception_state; }
|
||||
namespace Genode { struct Pager_object_exception_state; }
|
||||
|
||||
struct Genode::Pager_object_exception_state
|
||||
{
|
||||
Lock lock { };
|
||||
unsigned exceptions; /* counts exceptions raised by the thread */
|
||||
bool paused; /* indicates whether thread is stopped */
|
||||
bool in_exception; /* true if thread is in exception */
|
||||
Foc_thread_state state; /* accessible via native cpu thread RPC */
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_ */
|
||||
|
@ -16,7 +16,6 @@
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <base/lock.h>
|
||||
|
||||
/* core includes */
|
||||
#include <pager.h>
|
||||
@ -59,7 +58,7 @@ void Pager_entrypoint::entry()
|
||||
{
|
||||
if (_pager.exception()) {
|
||||
Lock::Guard guard(obj->state.lock);
|
||||
_pager.get_regs(obj->state);
|
||||
_pager.get_regs(obj->state.state);
|
||||
obj->state.exceptions++;
|
||||
obj->state.in_exception = true;
|
||||
obj->submit_exception_signal();
|
||||
@ -99,7 +98,7 @@ void Pager_entrypoint::entry()
|
||||
/* revert exception flag */
|
||||
obj->state.in_exception = false;
|
||||
/* set new register contents */
|
||||
_pager.set_regs(obj->state);
|
||||
_pager.set_regs(obj->state.state);
|
||||
}
|
||||
|
||||
/* send wake up message to requested thread */
|
||||
@ -115,7 +114,7 @@ void Pager_entrypoint::entry()
|
||||
case Ipc_pager::PAUSE:
|
||||
{
|
||||
Lock::Guard guard(obj->state.lock);
|
||||
_pager.get_regs(obj->state);
|
||||
_pager.get_regs(obj->state.state);
|
||||
obj->state.exceptions++;
|
||||
obj->state.in_exception = true;
|
||||
|
||||
|
@ -41,5 +41,5 @@ void Pager_object::wake_up()
|
||||
|
||||
void Pager_object::unresolved_page_fault_occurred()
|
||||
{
|
||||
state.unresolved_page_fault = true;
|
||||
state.state.unresolved_page_fault = true;
|
||||
}
|
||||
|
@ -96,9 +96,11 @@ void Platform_thread::pause()
|
||||
return;
|
||||
}
|
||||
|
||||
Foc_thread_state ®_state = _pager_obj->state.state;
|
||||
|
||||
unsigned exc = _pager_obj->state.exceptions;
|
||||
_pager_obj->state.ip = ~0UL;
|
||||
_pager_obj->state.sp = ~0UL;
|
||||
reg_state.ip = ~0UL;
|
||||
reg_state.sp = ~0UL;
|
||||
l4_umword_t flags = L4_THREAD_EX_REGS_TRIGGER_EXCEPTION;
|
||||
|
||||
/* Mark thread to be stopped */
|
||||
@ -109,8 +111,8 @@ void Platform_thread::pause()
|
||||
* The pager thread, which also acts as exception handler, will
|
||||
* leave the thread in exception state until, it gets woken again
|
||||
*/
|
||||
l4_thread_ex_regs_ret(_thread.local.data()->kcap(), &_pager_obj->state.ip,
|
||||
&_pager_obj->state.sp, &flags);
|
||||
l4_thread_ex_regs_ret(_thread.local.data()->kcap(), ®_state.ip,
|
||||
®_state.sp, &flags);
|
||||
|
||||
/*
|
||||
* The thread state ("ready") is encoded in the lowest bit of the flags.
|
||||
@ -202,14 +204,14 @@ void Platform_thread::pager(Pager_object &pager_obj)
|
||||
void Platform_thread::state(Thread_state s)
|
||||
{
|
||||
if (_pager_obj)
|
||||
*static_cast<Thread_state *>(&_pager_obj->state) = s;
|
||||
*static_cast<Thread_state *>(&_pager_obj->state.state) = s;
|
||||
}
|
||||
|
||||
|
||||
Foc_thread_state Platform_thread::state()
|
||||
{
|
||||
Foc_thread_state s;
|
||||
if (_pager_obj) s = _pager_obj->state;
|
||||
if (_pager_obj) s = _pager_obj->state.state;
|
||||
|
||||
s.kcap = _gate.remote;
|
||||
s.id = _gate.local.local_name();
|
||||
|
Loading…
x
Reference in New Issue
Block a user