patch #2 to add pointer to errno in TCB (Re: The time has come for a kernel interfacing library layer)

Sepherosa Ziehau sepherosa at gmail.com
Tue May 10 03:21:24 PDT 2005


On 5/10/05, YONETANI Tomokazu <qhwt+dfly at xxxxxxxxxx> wrote:
> Not essential for this patch, but before it looses its context,
> 
> On Tue, May 10, 2005 at 12:19:27AM -0700, Matthew Dillon wrote:
> > @@ -78,14 +81,7 @@
> >  {
> >       void *self;
> >
> > -#if 0
> > -     __asm __volatile ("movl %%gs:%1, %0"
> > -         : "=r" (self)
> > -         : "i" (__offsetof(struct tls_tcb, tcb_pthread)));
> > -#else
> >       __asm __volatile ("movl %%gs:8, %0" : "=r" (self));
> > -#endif
> > -
> >       return(self);
> >  }
> >
> 
> this part(and other similar parts) could be written to avoid hard-coded
> constants in __asm code by using an "m" constraint and a faked lvalue
> for a member of the structure whose base address is zero:
> 
> __asm __volatile ("movl %%gs:%1, %0"
>     : "=r" (self)
>     : "m" (((struct tls_tcb *)0)->tcb_pthread));
> 

Why not move __offsetof() from machine/stdint.h to sys/cdefs.h and
resurrect `#if 0' code in tls.h

-- 
Live Free or Die






More information about the Kernel mailing list