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

Alexander Tormasov a.tormasov at innopolis.ru
Thu Sep 26 12:53:04 CEST 2019


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?

Seems that I found answer in the seL4 code. They do not allow ReadReginster from myself:

In file object/tcb.c
exception_t
decodeReadRegisters(cap_t cap, word_t length, bool_t call,
                    word_t *buffer)
{
…
   thread = TCB_PTR(cap_thread_cap_get_capTCBPtr(cap));
    if (thread == NODE_STATE(ksCurThread)) {
        userError("TCB ReadRegisters: Attempted to read our own registers.");
        current_syscall_error.type = seL4_IllegalOperation;
        return EXCEPTION_SYSCALL_ERROR;
    }

Seems that this is my fault (while this is not anyhow specified in the docs, only some innuendo about stopped thread read)

So, the  function used from library seL4_TCB_ReadRegisters incorrectly return 0 - everything is ok while it is not.

Also seems that seL4_TCB_WriteRegisters do not work in such conditions as well - it return without errors and not changing rip to new function specified in appropriate field …

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20190926/f5cd22bf/attachment.html>


More information about the users mailing list