From owner-freebsd-amd64@FreeBSD.ORG Mon Dec 1 14:08:41 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 8A00D16A4CE for ; Mon, 1 Dec 2003 14:08:41 -0800 (PST) Received: from bigtex.jrv.org (rrcs-sw-24-73-246-106.biz.rr.com [24.73.246.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41C4243F75 for ; Mon, 1 Dec 2003 14:08:40 -0800 (PST) (envelope-from james@bigtex.jrv.org) Received: from bigtex.jrv.org (localhost [127.0.0.1]) by bigtex.jrv.org (8.12.1/8.12.1) with ESMTP id hB1M8Vo8064331 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Dec 2003 16:08:32 -0600 (CST) Received: (from james@localhost) by bigtex.jrv.org (8.12.1/8.12.1/Submit) id hB1M8V1O064328; Mon, 1 Dec 2003 16:08:31 -0600 (CST) Date: Mon, 1 Dec 2003 16:08:31 -0600 (CST) Message-Id: <200312012208.hB1M8V1O064328@bigtex.jrv.org> From: James Van Artsdalen To: freebsd-amd64@freebsd.org Subject: Varargs issues X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list 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:08:41 -0000 I don't have my Opteron hardware yet but I did build a gcc cross-compiler to look at your earlier bug report. When a function takes a variable number of arguments it appears that the caller passes, among other things, the number of floating 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. The function prologue writes these floats to stack slots with the MOVAPS opcode. The "AMD64 Architecture Programmer's Manual Volume 4: 128-Bit Media Instructions" manual states "A memory operand that is not aligned on a 16-byte boundary causes a general protection exception" for MOVAPS. 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. This problem with this theory of course is that I'd expect a lot of crashes, more than are apparently being seen. I don't have the documentation on the ABI calling conventions so I'm just guessing based on gcc's output (and I might not be using the right compiler). If you can build an x86-64 gdb you might look at a core dump and tell me what opcode generated the fault (either symbolic or in hex) and the value in %rsp. From: Adriaan de Groot Subject: Varargs issues To: freebsd-amd64@freebsd.org [aside: most-recent cvsup doesn't compile without options SMP, due to that mp_maxid issue] amd64/59650 is a PR of mine that I'd like to pimp for attention. The real and present effect is that the ogg123 program from the vorbis-tools port bus errors, but there's several test programs - even a short one - in the PR. The problem still persists in a system rebuilt on the 23rd, and I'm still waiting to see if today's builds are stable (ie. boot at all) to test it on that. The problem with the problem is that (a) I've no idea if I'm linking everything correcly or need to do other thread magic (if so, the ogg12 app has the same issues) and (b) I only have one amd64 box, so there's a chance that the problem is purely local, even. Could someone, anyone, run the test program in order to confirm (or deny) the problem? 'cause if it _is_ a problem, then it potentially affects any application that does threading.