2014-10-15 10:06:18 UTC
assembler in mcontext.h:
static __inline void *
register void *tcb __asm("r0");
__asm("chmk %0" :: "i"(SYS__lwp_getprivate) : "r0");
The result from chmk will be in r0.
The asm line says that r0 will be destroyed in the asm statement. In
this particular case it will most likely work because gcc handles tcb as
an uninitialized variable and it will get the r0 value anyway as long as
the code is not reordered (which it may be). If tcb is assigned 0 before
the asm statement it will fail.
Correct would be to write something like
__asm("chmk %0" : "=r"(tcb): "i"(SYS__lwp_getprivate));
which tells that the result will be in tcb (e.g. r0).
Comments? Otherwise I will go ahead and fix this.