Varargs issues

Adriaan de Groot adridg at cs.kun.nl
Mon Dec 1 14:45:50 PST 2003


'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 at 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/




More information about the freebsd-amd64 mailing list