I am trying to get working getcontext/setcontext/makecontext prototype on seL4/Genode (I can’t use anything except seL4 in this moment due to some reasons). I need both for x86_64 and aarm64 arch. I started from x86.
So, question one. May be someone know kind of rough implementation for user-space context switching? I read information that this is not implemented yet in the main genode - but may be some projects does this already?
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 I found that: In returned successfully data rip register is always 0 for current thread, tcb selector myself.native_thread().tcb_sel also 0, and rsp = 0x13! Probably I can’t read myself?
Problem 3. I try to take address of IPC buffer bounded to utcb() field of Genode::Thread using code below. It successfully compiled and linked. Anyway, in attempt to run the program I found the following error in log:
[init -> test-go] Error: LD: jump slot relocation failed for symbol: 'Genode::Thread::utcb()’
While access for similar fields in the same Thread structure successfully works! Eg Name name() const; can be printed, native_thread() also give results.
I even found in the .o file the name of field (function technically) marked as U , and literally the same name mangled in the sym file for ld.lib.so compiled: 000000000003a09a T _ZN6Genode6Thread4utcbEv
genode/repos/base/lib/symbols/ld:_ZN6Genode6Thread4utcbEv T How to fix this?
// take info about genode thread Thread &myself = *Thread::myself(); log("myself ", &myself, " size ", sizeof(myself)); addr_t const ipc_buffer = reinterpret_cast<addr_t>(myself.utcb()); log(" name ",myself.name(), " sb ", myself.stack_base(), " svb ", myself.stack_area_virtual_base(), " tcb ", (addr_t)myself.native_thread().tcb_sel);
seL4_IPCBuffer &ipc_buffer = *reinterpret_cast<seL4_IPCBuffer *>(myself.utcb());
Sincerely, Alexander Tormasov・