Reading thread registers

Christian Prochaska christian.prochaska at ...1...
Tue Aug 30 14:34:04 CEST 2016

Hi Denis,

On 25.08.2016 15:45, Denis Huber wrote:
> 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?

the thread's registers can be read from the UTCB in userland if the
kernel saved them there. On Fiasco.OC, this currently only happens when
an exception occurs ('Thread::exception()' in thread-ipc.cpp links
'_utcb_handler' to the trap state, which is then copied into the UTCB in
'Thread::copy_ts_to_utcb()' in thread-arm.cpp). When pausing the thread,
an artificial exception is triggered, which causes the kernel to copy
the thread state into the UTCB. Therefore, it is necessary to pause the
thread before the register values are available in the UTCB.


More information about the users mailing list