RFC: if_ndis on amd64
will at exomi.com
Wed Jan 12 23:16:07 PST 2005
On Wed, 2005-01-12 at 15:33 -0800, David O'Brien wrote:
> What are "calling conventions that everyone else uses"?? Such things
> really don't exist as x86 CPU's don't force a particular way. It is up
> to the compiler writer to do what he wants.
Note that I didn't even try to claim "standard" calling conventions;
however AFAIK all of the released operating systems that run on amd64
(*BSD, Linux, Solaris) use the same C ABI (SysV (ELF) ABI).
Often at least the basic C calling conventions are compatible across
> Both the AMD64 ELF and AMD64 PE (mswin) ABI's specify that the first X
> parameters are passed in registers (beyond that on the stack). So both
> ELF (ie, FreeBSD) and MSwin passes parameters differently on 32-bit
> "i386" vs. 64-bit AMD64.
The different i386 conventions are at least partly to historical
reasons. Since 64-bit mode is inevitably incompatible with 32-bit mode,
I was hoping 64-bit mode would be somewhat more consistent.
Anyhow, having to create wrappers isn't that bad, and should be possible
to be coerced to work correctly. The varargs kludge I used should be
possible to eliminate by transforming the arguments into a va_list
instead of trying to preserve it as a varargs call. Something like:
More information about the freebsd-amd64