From owner-freebsd-amd64@FreeBSD.ORG Mon Dec 1 14:45:50 2003 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A40816A4CE for ; Mon, 1 Dec 2003 14:45:50 -0800 (PST) Received: from pandora.cs.kun.nl (pandora.cs.kun.nl [131.174.33.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id D918243F85 for ; Mon, 1 Dec 2003 14:45:44 -0800 (PST) (envelope-from adridg@cs.kun.nl) Received: from odin.cs.kun.nl by pandora.cs.kun.nl id hB1Mjhxc016602 (8.12.10/3.58); Mon, 1 Dec 2003 23:45:43 +0100 (MET) Date: Mon, 1 Dec 2003 23:45:43 +0100 (MET) From: Adriaan de Groot To: freebsd-amd64@freebsd.org In-Reply-To: <200312012208.hB1M8V1O064328@bigtex.jrv.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: Varargs issues X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: adridg@cs.kun.nl List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2003 22:45:50 -0000 'avond, James, On Mon, 1 Dec 2003, James Van Artsdalen wrote: > I don't have my Opteron hardware yet but I did build a gcc > cross-compiler to look at your earlier bug report. Ah, thanks. > point values passed in registers as opposed to on the stack. > The function prologue writes those registers to stack slots so > var_args can refer to them later. OK, that's pretty sure to be it. You can see in the disassembly in the PR that it _is_ a movaps instruction causing the bus error. > The trick is that gcc 3.3 doesn't seem to try to keep the stack > aligned to 16-bytes, so on entry to a function the stack may be 8-byte > aligned, 16-byte aligned, etc. If the AMD book is not out-of-date > then a fault is bound to happen on MOVAPS at some point. The $rbp and $rsp are both 8-aligned when it bus errors. In the main thread, the stack is 16-aligned at every call to PrintF (I'm working with the third example program, maybe I should attach iot somewhere). I'll get the hard numbers for you in a minute, next message. -- Adriaan de Groot adridg@cs.kun.nl Kamer A6020 024-3652272 GPG Key Fingerprint 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE http://www.cs.kun.nl/~adridg/research/