Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jan 2011 08:53:11 -0500
From:      Ryan Stone <rysto32@gmail.com>
To:        Peter Blok <peter.blok@bsd4all.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: What does the FreeBSD/i386 ABI say about stack alignment?
Message-ID:  <AANLkTinyC_yvJmAZvX3zPD04ipmr0tnRQVVeQa0bQBCz@mail.gmail.com>
In-Reply-To: <C956059D.389E8%peter.blok@bsd4all.org>
References:  <AANLkTim1KcKRXqrPoZDHOAKWtnVpUj6QBzJ-addyCvHe@mail.gmail.com> <C956059D.389E8%peter.blok@bsd4all.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 14, 2011 at 7:52 AM, Peter Blok <peter.blok@bsd4all.org> wrote:
> Hi Ryan,
>
> Well I think gcc should not generate movdqa if it cannot guarantee the ar=
ea
> it is working on is aligned. If the stack is not aligned, it should gener=
ate
> =96 probably less efficient =96 code that works.

Well that's the trouble, in Linux at least it *can* guarantee that the
area is aligned.  And it seems that according to kib, FreeBSD also
intended to guarantee that alignment, but due to a bug always produced
an unaligned stack(which explains why the hack I tried to fix the
alignment didn't work -- the bug happened after we got to userland).

> What is this area, if it is not a local variable allocated somewhere? Is =
it
> some sort of stack probing? Is alloca used? Are variable length arrays us=
ed?

To be honest I'm really not sure.  It was dying somewhere in the
constructor of a C++ class.  Unfortunately due to a lot of inlining
and gdb being a total piece of garbage, I wasn't able to suss out
exactly what C++ code the instruction corresponded to, and once I
understood the problem with movdqa I stopped digging in the C++ code.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinyC_yvJmAZvX3zPD04ipmr0tnRQVVeQa0bQBCz>