Date: Sat, 9 Apr 2011 15:37:09 -0700 From: Peter Wemm <peter@wemm.org> To: Kostik Belousov <kostikbel@gmail.com> Cc: d@delphij.net, freebsd-amd64@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Where to find amd64 ABI information for FreeBSD? Message-ID: <BANLkTikTKB7eyzdDgR%2BcNf-X2C0w4oNjJg@mail.gmail.com> In-Reply-To: <20110405224913.GF78089@deviant.kiev.zoral.com.ua> References: <4D9B935D.4010705@delphij.net> <20110405224913.GF78089@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 5, 2011 at 3:49 PM, Kostik Belousov <kostikbel@gmail.com> wrote= : > On Tue, Apr 05, 2011 at 03:10:37PM -0700, Xin LI wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> Hi, >> >> Is there a place to find ABI information for GCC on FreeBSD? >> =A0Specifically, I'm looking for which registers has to be preserved >> across function call? =A0(Or do we follow System V Application Binary >> Interface AMD64 Architecture Processor Supplement Draft Version 0.99.5?) > > The parts of the mentioned document that depend on compiler and > toolchain, are fully valid for FreeBSD. Our non-compliance is mostly > in the specified bits of the kernel/usermode interface. > There is also an accidental deviation with register usage in the way we start up applications. But as far as calling conventions go for preserved/scratch registers, we are compliant. Of note our i386 syscall abi is not consistent with i386 calling conventions. In particular, i386 syscalls save/restore ALL registers except for those used in return values. eg: %eax is changed, and %edx is changed for SOME syscalls that have a 64 bit or dual return (and preserved otherwise). Unlike i386, our amd64 syscalls do not preserve registers that are designated as scratch in the abi. There is an inconsistency between the syscall instruction and the ABI, but that is "repaired" in the libc syscall wrappers. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTikTKB7eyzdDgR%2BcNf-X2C0w4oNjJg>