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