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)
On Tue, May 10, 2005 at 06:17:51PM +0800, Sepherosa Ziehau wrote:
> 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
Because it gets assembled to something as below, and it's not something
expected here(that's why it's #ifdef'ed out):
movl %gs:$8, %eax
movl %eax, self
`%gs:$8' is an integer constant 8 prefixed by %gs, which is not a valid
operand for movl instruction.
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]