Reading thread registers

Denis Huber huber.denis at ...435...
Thu Aug 25 15:45:43 CEST 2016

Hi Christina,

thank you for your answer, it helped a lot.

Is it possible to aquire the thread's registers through simply reading 
them in the UTCB which is pointed by Thread_state::utcb? If yes, what is 
the layout of the UTCB in the memory?
Or do I also have to pause the thread to find relevant registers?

Kind regards,

On 19.08.2016 16:28, Christian Prochaska wrote:
> Hi Denis,
> On 19.08.2016 10:30, Denis Huber wrote:
>> 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.
> On Fiasco.OC, the 'Platform_thread::pause()' function forces the thread into an exception state, which is handled by the pager, who
> reads the register state (including r0-r12) from the UTCB in 'Ipc_pager::_parse()'. The 'Platform_thread::state()' function then
> returns this previously saved state. If you called 'Cpu_thread::pause()' before 'Cpu_thread::state()' and did not get the correct
> register state, perhaps the thread was just executing a syscall. In that case, the exception would only occur after the syscall
> returned, which might take a long time, so 'Platform_thread::pause()' returns without waiting for the exception when it detects this
> situation. A possible solution for this problem without having to block until the thread returns from the syscall might be to extend
> 'l4_thread_ex_regs_ret()' to return the missing registers in the UTCB.
> Regards,
> Christian
> ------------------------------------------------------------------------------
> _______________________________________________
> genode-main mailing list
> genode-main at

More information about the users mailing list