Re: Misalignment of local SSE variables in thread function

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

 



Brian Dessent writes:
 > Andrew Haley wrote:
 > 
 > >  > So, neither CreateThread nor MSVCRT align the stack, so I guess you'll
 > >  > have to do it yourself.  You should be able to do this with something
 > >  > like:
 > >  >
 > >  >   asm  __volatile__  ("andl $-16, %%esp" : : : "%esp");
 > >  >
 > >  > at the beginning of your thread function.
 > > 
 > > Ouch.  I don't think that would work.
 > 
 > It looked a little iffy to me too, but I copied it directly from mingw's
 > crt1.c where it has this comment:
 > 
 >   /* Align the stack to 16 bytes for the sake of SSE ops in main
 >      or in functions inlined into main.  */

I think that's a special case: it's written with carnal knowledge of
the state at the time.  I guess the clobber of SP doesn't cause the
compiler to reload SP from BP+offset, but I don't know why it doesn't.

In any case, it's rather hairy.  :-)

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux