nova: avoid sc_ctrl syscalls on invalid caps

Avoids kernel log messages if TRACE_ERROR is enabled in kernel.

Discovered during Turmvilla scenario #1552 and issue #1733.
This commit is contained in:
Alexander Boettcher 2015-09-04 17:01:23 +02:00 committed by Christian Helmuth
parent 7f1641e460
commit 94f64ef464
2 changed files with 9 additions and 5 deletions

View File

@ -53,9 +53,9 @@ namespace Genode {
addr_t _sel_sc() const { return _id_base + 2; }
/* convenience function to access _feature variable */
inline bool is_main_thread() { return _features & MAIN_THREAD; }
inline bool is_vcpu() { return _features & VCPU; }
inline bool is_worker() { return _features & WORKER; }
inline bool is_main_thread() const { return _features & MAIN_THREAD; }
inline bool is_vcpu() const { return _features & VCPU; }
inline bool is_worker() const { return _features & WORKER; }
public:

View File

@ -324,11 +324,15 @@ unsigned long long Platform_thread::execution_time() const
unsigned long long time = 0;
/*
* Ignore the return value, which indicates success only for global ECs.
* For local ECs, we simply return 0 as local ECs are executed with the
* time of their callers.
*/
(void) Nova::sc_ctrl(_sel_sc(), time);
if (is_worker())
return time;
uint8_t res = Nova::sc_ctrl(_sel_sc(), time);
if (res != Nova::NOVA_OK)
PDBG("sc_ctrl failed res=%x", res);
return time;
}