Thread switching in Genode/seL4 and registers and utcb access problem

Alexander Boettcher alexander.boettcher at genode-labs.com
Fri Sep 27 07:40:01 CEST 2019



On 27.09.19 01:21, Alexander Tormasov via users wrote:
>>>
>>> Problem 2.
>>> When I start trying to make a fast solution and try to read registers and some info from low level physical seL4 thread using seL4_TCB_ReadRegisters
>>
>> On Genode you may request the thread state like the values of registers
>> via Genode::Cpu_thread::state(). Example code you may find in our thread
>> test, see [0]. The actual structure is platform depend, look into the
>> respective cpu_state.h header file, see [1].
> 
> Thank you for reference!
> Unfortunately, this function use the same seL4_TCB_ReadRegisters and can’t read our own registers  (like setjmp/getcontext/etc) as I see in repos/base-sel4/src/core/spec/x86_64/thread.cc


This works for me without issues:


void Component::construct(Env &env)

{

   log("--- thread test started ---");



   Cpu_thread_client thread_client(Thread::myself()->cap());

   Thread_state state = thread_client.state();



   log("my ip=", Hex(state.ip), " sp=", Hex(state.sp), " - done");



   return;
}


[init -> test-thread] --- thread test started ---
[init -> test-thread] my ip=0x837c2 sp=0x401fe4c0 - done



-- 
Alexander Boettcher
Genode Labs

https://www.genode-labs.com - https://www.genode.org

Genode Labs GmbH - Amtsgericht Dresden - HRB 28424 - Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



More information about the users mailing list