Reading thread registers

Denis Huber huber.denis at ...435...
Fri Aug 19 10:30:41 CEST 2016


Hello Genode community,

in my checkpoint component I intercepted the Cpu session of a child, 
through which I get all Thread_capabilities created for and by the 
child. To store the state of a component I need to store the registers 
of the threads used by the child.

I tried reading the registers through the "Thread_state 
Cpu_thread::state()" method, but it did not contain any information 
about (just zeros).

I'm using Genode 16.05, kernel Fiasco.OC (pbax9 build). By inspecting 
the kernel API of foc, I found out that the function 
l4_thread_ex_regs_ret can read the sp and ip register. By changing the 
state method in platform_thread.cc (in base-foc) I could get the registers:

Thread_state Platform_thread::state()
{
	Thread_state s;
	if (_pager_obj) s = _pager_obj->state;

	_pager_obj->state.ip  = ~0UL;
	_pager_obj->state.sp  = ~0UL;
	l4_umword_t flags = 0;
	l4_thread_ex_regs_ret(_thread.local.dst(), &_pager_obj->state.ip, 
&_pager_obj->state.sp, &flags);

	s.sp = _pager_obj->state.sp;
	s.ip = _pager_obj->state.ip;
	s.kcap = _gate.remote;
	s.id   = _gate.local.local_name();
	s.utcb = _utcb;

	return s;
}

But other registers like r0 - r12 are missing.

Is there a simple way in Genode to get them? Can I utilize the utcb 
memory location to find the missing registers?


Kind regards
Denis




More information about the users mailing list