Never mind, I discovered that I in order to access a TLS variable you need to call
`seL4_TCB_SetTLSBase` on seL4_CapInitThreadTCB first in the root server, as I'm
trying to work on a bare bone usage of seL4 to better understand it, this part was not
obvious from the existing more complex samples!
From: Devel <devel-bounces(a)sel4.systems> on behalf of Alexandre Mutel
Sent: Friday, November 22, 2019 22:12
To: devel(a)sel4.systems <devel(a)sel4.systems>
Subject: [seL4] Understand how TLS is setup in the root server for x64
I'm trying to understand how the TLS is setup for the root server on x64 (to access
for example the IPC buffer)
but I'm failing to connect the pieces and how the server is correctly setting the FS
For example the sel4_Send function is codegen like this (using -ftls-model=local-exec)
The instruction `mov rax,[fs:0]` is accessing the seL4_IPCBuffer* and the the
executable has a TLS segments of 8 bytes for the pointer. all good.
Now, I'm failing to find in the codebase where the ELF loader is actually detecting
the TLS segment and the according setup with the TLS register.
And I'm wondering if the setup for the codegen is not wrong on my side (e.g the
local-exec is not working), so that instead of having a FS register
it would be a direct memory access.
Does anyone have a clue about this?