DragonFly BSD
DragonFly kernel List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: Sepherosa Ziehau <sepherosa@xxxxxxxxx>
Date: Tue, 10 May 2005 18:17:51 +0800

On 5/10/05, YONETANI Tomokazu <qhwt+dfly@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




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]