On Wed, Dec 01, 2021 at 07:24:33PM +0100, Florian Weimer wrote: > * Stefan Hajnoczi: > > > +#elif defined(__x86_64__) > > +#define QEMU_CO_TLS_ADDR(ret, var) \ > > + asm volatile("rdfsbase %0\n\t" \ > > + "lea "#var"@tpoff(%0), %0" : "=r"(ret)) > > +#endif > > RDFSBASE needs quite recent kernels. I think you should use > > movq %%fs:0, %0 > > instead, which is equivalent for the x86-64 psABI. Nice trick! I remember reading that the address of the thread data is stored in the first element of the thread data itself, so this makes sense :). Stefan