diff --git a/repos/base-foc/include/foc/thread_state.h b/repos/base-foc/include/foc/thread_state.h index f42a02b73f..5f9a860fdf 100644 --- a/repos/base-foc/include/foc/thread_state.h +++ b/repos/base-foc/include/foc/thread_state.h @@ -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_ */ diff --git a/repos/base-foc/src/core/include/pager_object_exception_state.h b/repos/base-foc/src/core/include/pager_object_exception_state.h index d0fe9968b2..df21d9b3e3 100644 --- a/repos/base-foc/src/core/include/pager_object_exception_state.h +++ b/repos/base-foc/src/core/include/pager_object_exception_state.h @@ -16,6 +16,15 @@ #include -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_ */ diff --git a/repos/base-foc/src/core/pager.cc b/repos/base-foc/src/core/pager.cc index 06a70514d2..439d16fe88 100644 --- a/repos/base-foc/src/core/pager.cc +++ b/repos/base-foc/src/core/pager.cc @@ -16,7 +16,6 @@ /* Genode includes */ #include #include -#include /* core includes */ #include @@ -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; diff --git a/repos/base-foc/src/core/pager_object.cc b/repos/base-foc/src/core/pager_object.cc index f0501672ff..fc0ad089e5 100644 --- a/repos/base-foc/src/core/pager_object.cc +++ b/repos/base-foc/src/core/pager_object.cc @@ -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; } diff --git a/repos/base-foc/src/core/platform_thread.cc b/repos/base-foc/src/core/platform_thread.cc index 000a677b2f..d7f3227b0a 100644 --- a/repos/base-foc/src/core/platform_thread.cc +++ b/repos/base-foc/src/core/platform_thread.cc @@ -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(&_pager_obj->state) = s; + *static_cast(&_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();