I'm trying to implement Platform_thread::execution_time() for Fiasco.OC. However, when using the code below, I'm getting a null pointer error when trying to read the UTCB's message register:
Possible null pointer READ at 0 IP 704c0d7c
unsigned long long Platform_thread::execution_time() const { unsigned long long time = 0;
if (_utcb) { l4_thread_stats_time(_thread.local.dst()); time = *(l4_kernel_clock_t*)l4_utcb_mr()->mr[0]; }
return time; }
The doc for l4_thread_stats_time(...) says
/** * \brief Get consumed timed of thread in µs. * \ingroup l4_thread_api * \param thread Thread to get the consumed time from. * * The consumed time is returned as l4_kernel_clock_t at UTCB message * register 0. */ L4_INLINE l4_msgtag_t l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;
So my usage should be about right. What am I missing?