From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 14 13:53:13 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7612106566C for ; Fri, 14 Jan 2011 13:53:13 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9BD8FC0A for ; Fri, 14 Jan 2011 13:53:12 +0000 (UTC) Received: by eyf6 with SMTP id 6so1372810eyf.13 for ; Fri, 14 Jan 2011 05:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pKE9OopzGIzZ0C6aaS2JKozE/pfMWmp9xrLlogLKPns=; b=qZxYcQMK0Xttiib7mfihUjHRQFa/3nhFnUHRcRTVU17XmwiOe86b38froT/ZX/Dvl3 fOC+wyHsd0Tb+YNVY8UVSSHd+lQ9ed7EjJ5io22FjW/HgVm3bosUIDTzKtJ9v06pKzxz rQvehHbk/VFVWosvzDNV86JY10arz095qRTXU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=oVA0fx3wm10yLSpCmezrHPdHa5NaueJk2X7kiNb+s6YUsZgCbO8NeZK9wQOxnWgflA oHjRtM/0Lqi0kkgkuUXUe4uB+AJF3xyybTUEBhyN/x7wTegCWp2YK8w/XhhxZdT5r2K2 /D2VJ82/J/kwCtx5Q0C0isR857kVPOwpA5d/8= MIME-Version: 1.0 Received: by 10.213.4.198 with SMTP id 6mr1576764ebs.74.1295013191137; Fri, 14 Jan 2011 05:53:11 -0800 (PST) Received: by 10.213.22.14 with HTTP; Fri, 14 Jan 2011 05:53:11 -0800 (PST) In-Reply-To: References: Date: Fri, 14 Jan 2011 08:53:11 -0500 Message-ID: From: Ryan Stone To: Peter Blok Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: What does the FreeBSD/i386 ABI say about stack alignment? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2011 13:53:13 -0000 On Fri, Jan 14, 2011 at 7:52 AM, Peter Blok 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.