tech-kern archive

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

Re: Possible incorrect usage of STACKALIGN in kern_exec



On Tue, 24 Jan 2012 21:55:30 +0100
Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:

> On Tue, Jan 24, 2012 at 03:30:37PM -0500, Matthew Mondor wrote:
> > There is also a related PR but which is for threads stack alignment:
> > lib/39465
> 
> That bug is wrong. NetBSD uses SYSV ABI and that mandates 4 Bytes
> alignment for the stack. GCC versions before ~4.5 or so are just
> completely broken in this regard.

I know that some OSs do it for i386 to reduce the overhead of SSE
instructions setup, but I wasn't aware that this could be problematic
with the i386 SYSV ABI (since 16 is a multiple of 4).  Having just
looked at both i386 and x86-64 SYSV ABI docs now, I think that you're
right for i386.

It's in the x86-64 case that stack frames are 16-byte aligned, with
arrays larger than 16 bytes also needing to be 16-byte aligned
(possibly including the stack)...

Thanks,
-- 
Matt


Home | Main Index | Thread Index | Old Index