parent
dea4123053
commit
e53ba5ee3e
|
@ -44,6 +44,7 @@ namespace Genode {
|
||||||
MAIN_THREAD = 0x1U,
|
MAIN_THREAD = 0x1U,
|
||||||
VCPU = 0x2U,
|
VCPU = 0x2U,
|
||||||
WORKER = 0x4U,
|
WORKER = 0x4U,
|
||||||
|
SC_CREATED = 0x8U,
|
||||||
};
|
};
|
||||||
uint8_t _features;
|
uint8_t _features;
|
||||||
uint8_t _priority;
|
uint8_t _priority;
|
||||||
|
@ -58,6 +59,7 @@ namespace Genode {
|
||||||
inline bool main_thread() const { return _features & MAIN_THREAD; }
|
inline bool main_thread() const { return _features & MAIN_THREAD; }
|
||||||
inline bool vcpu() const { return _features & VCPU; }
|
inline bool vcpu() const { return _features & VCPU; }
|
||||||
inline bool worker() const { return _features & WORKER; }
|
inline bool worker() const { return _features & WORKER; }
|
||||||
|
inline bool sc_created() const { return _features & SC_CREATED; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,8 @@ int Platform_thread::start(void *ip, void *sp)
|
||||||
|
|
||||||
error("create_sc returned ", res);
|
error("create_sc returned ", res);
|
||||||
goto cleanup_ec;
|
goto cleanup_ec;
|
||||||
}
|
} else
|
||||||
|
_features |= SC_CREATED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -210,24 +211,26 @@ void Platform_thread::resume()
|
||||||
{
|
{
|
||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
|
|
||||||
if (!worker()) {
|
if (worker() || sc_created()) {
|
||||||
uint8_t res;
|
if (_pager)
|
||||||
do {
|
_pager->wake_up();
|
||||||
if (!_pd) {
|
return;
|
||||||
error("protection domain undefined - resuming thread failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
|
|
||||||
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
|
||||||
} while (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK == _pager->handle_oom());
|
|
||||||
|
|
||||||
if (res == NOVA_OK) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pager) return;
|
uint8_t res;
|
||||||
|
do {
|
||||||
|
if (!_pd) {
|
||||||
|
error("protection domain undefined - resuming thread failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
|
||||||
|
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
||||||
|
} while (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK == _pager->handle_oom());
|
||||||
|
|
||||||
/* Thread was paused beforehand and blocked in pager - wake up pager */
|
if (res == NOVA_OK)
|
||||||
_pager->wake_up();
|
_features |= SC_CREATED;
|
||||||
|
else
|
||||||
|
error("create_sc failed ", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,11 +318,8 @@ unsigned long long Platform_thread::execution_time() const
|
||||||
{
|
{
|
||||||
unsigned long long time = 0;
|
unsigned long long time = 0;
|
||||||
|
|
||||||
/*
|
/* for ECs without a SC we simply return 0 */
|
||||||
* For local ECs, we simply return 0 as local ECs are executed with the
|
if (!sc_created())
|
||||||
* time of their callers.
|
|
||||||
*/
|
|
||||||
if (worker())
|
|
||||||
return time;
|
return time;
|
||||||
|
|
||||||
uint8_t res = Nova::sc_ctrl(_sel_sc(), time);
|
uint8_t res = Nova::sc_ctrl(_sel_sc(), time);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user