committed by
Norman Feske
parent
6fa4307005
commit
997a77b3de
@@ -17,7 +17,6 @@
|
|||||||
#define _INCLUDE__FOC__THREAD_STATE_H_
|
#define _INCLUDE__FOC__THREAD_STATE_H_
|
||||||
|
|
||||||
#include <base/capability.h>
|
#include <base/capability.h>
|
||||||
#include <base/lock.h>
|
|
||||||
#include <base/thread_state.h>
|
#include <base/thread_state.h>
|
||||||
|
|
||||||
/* Fiasco includes */
|
/* Fiasco includes */
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
#ifndef _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
|
#ifndef _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
|
||||||
#define _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
|
#define _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
|
||||||
|
|
||||||
|
#include <base/mutex.h>
|
||||||
#include <foc/thread_state.h>
|
#include <foc/thread_state.h>
|
||||||
|
|
||||||
namespace Genode { struct Pager_object_exception_state; }
|
namespace Genode { struct Pager_object_exception_state; }
|
||||||
|
|
||||||
struct Genode::Pager_object_exception_state
|
struct Genode::Pager_object_exception_state
|
||||||
{
|
{
|
||||||
Lock lock { };
|
Mutex mutex { };
|
||||||
unsigned exceptions; /* counts exceptions raised by the thread */
|
unsigned exceptions; /* counts exceptions raised by the thread */
|
||||||
bool paused; /* indicates whether thread is stopped */
|
bool paused; /* indicates whether thread is stopped */
|
||||||
bool in_exception; /* true if thread is in exception */
|
bool in_exception; /* true if thread is in exception */
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void Pager_entrypoint::entry()
|
|||||||
case Ipc_pager::EXCEPTION:
|
case Ipc_pager::EXCEPTION:
|
||||||
{
|
{
|
||||||
if (_pager.exception()) {
|
if (_pager.exception()) {
|
||||||
Lock::Guard guard(obj->state.lock);
|
Mutex::Guard guard(obj->state.mutex);
|
||||||
_pager.get_regs(obj->state.state);
|
_pager.get_regs(obj->state.state);
|
||||||
obj->state.exceptions++;
|
obj->state.exceptions++;
|
||||||
obj->state.in_exception = true;
|
obj->state.in_exception = true;
|
||||||
@@ -94,7 +94,7 @@ void Pager_entrypoint::entry()
|
|||||||
_pager.acknowledge_wakeup();
|
_pager.acknowledge_wakeup();
|
||||||
|
|
||||||
{
|
{
|
||||||
Lock::Guard guard(obj->state.lock);
|
Mutex::Guard guard(obj->state.mutex);
|
||||||
/* revert exception flag */
|
/* revert exception flag */
|
||||||
obj->state.in_exception = false;
|
obj->state.in_exception = false;
|
||||||
/* set new register contents */
|
/* set new register contents */
|
||||||
@@ -113,7 +113,7 @@ void Pager_entrypoint::entry()
|
|||||||
*/
|
*/
|
||||||
case Ipc_pager::PAUSE:
|
case Ipc_pager::PAUSE:
|
||||||
{
|
{
|
||||||
Lock::Guard guard(obj->state.lock);
|
Mutex::Guard guard(obj->state.mutex);
|
||||||
_pager.get_regs(obj->state.state);
|
_pager.get_regs(obj->state.state);
|
||||||
obj->state.exceptions++;
|
obj->state.exceptions++;
|
||||||
obj->state.in_exception = true;
|
obj->state.in_exception = true;
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ void Platform_thread::pause()
|
|||||||
if (!_pager_obj)
|
if (!_pager_obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pager_obj->state.lock.lock();
|
_pager_obj->state.mutex.acquire();
|
||||||
|
|
||||||
if (_pager_obj->state.paused == true) {
|
if (_pager_obj->state.paused == true) {
|
||||||
_pager_obj->state.lock.unlock();
|
_pager_obj->state.mutex.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ void Platform_thread::pause()
|
|||||||
* The thread state ("ready") is encoded in the lowest bit of the flags.
|
* The thread state ("ready") is encoded in the lowest bit of the flags.
|
||||||
*/
|
*/
|
||||||
bool in_syscall = (flags & 1) == 0;
|
bool in_syscall = (flags & 1) == 0;
|
||||||
_pager_obj->state.lock.unlock();
|
_pager_obj->state.mutex.release();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the thread was in ongoing ipc, if so it won't raise
|
* Check whether the thread was in ongoing ipc, if so it won't raise
|
||||||
@@ -151,11 +151,11 @@ void Platform_thread::resume()
|
|||||||
if (!_pager_obj)
|
if (!_pager_obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pager_obj->state.lock.lock();
|
_pager_obj->state.mutex.acquire();
|
||||||
|
|
||||||
/* Mark thread to be runable again */
|
/* Mark thread to be runable again */
|
||||||
_pager_obj->state.paused = false;
|
_pager_obj->state.paused = false;
|
||||||
_pager_obj->state.lock.unlock();
|
_pager_obj->state.mutex.release();
|
||||||
|
|
||||||
/* Send a message to the exception handler, to unblock the client */
|
/* Send a message to the exception handler, to unblock the client */
|
||||||
Msgbuf<16> snd, rcv;
|
Msgbuf<16> snd, rcv;
|
||||||
|
|||||||
Reference in New Issue
Block a user