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

Re: [Xen-devel] [PATCH ARM v6 01/14] mini-os: x86_64: make thread stacks 16-byte aligned



On Thu, 2014-07-17 at 20:15 +0200, Samuel Thibault wrote:
> Ian Campbell, le Thu 17 Jul 2014 16:50:25 +0100, a Ãcrit :
> > On Wed, 2014-07-16 at 12:07 +0100, Thomas Leonard wrote:
> > > Otherwise, passing doubles to varargs functions causes a crash.
> > > 
> > > Signed-off-by: Thomas Leonard <talex5@xxxxxxxxx>
> > 
> > > +    /* Must ensure that (%rsp + 8) is 16-byte aligned at the start of 
> > > thread_starter. */
> > 
> > Is this really effectively a requirement for the stack to start out
> > misaligned?
> 
> Yes. From the x86_64 ABI pdf I have here:
> 
> â
> The end of the input argument area shall be aligned on a 16 byte boundary.
> In other words, the value (%rsp - 8) is always a multiple of 16 when control 
> is
> transferred to the function entry point.
> â
> 
> So the proposed comment is exactly the ABI requirement.

I see. How exciting!

I suppose this comes from the stack normally being 16-byte aligned but
the actual call to the function adding another 8 by pushing the return
address, so on funciton entry you are "misaligned" by 8 bytes. So this
offset is accounting for the fact that thread_starter is (in effect)
entered with a jmp and not a call.

>  Maybe it should
> even say
> 
> /* x86_64 ABI requires that (%rsp + 8) is 16-byte aligned at the start of 
> thread_starter. */

With your explanation I'm happy with whatever you are happy with ;-)

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.