6

Where can I find all the differences in data types between the i386 & AMD64 Application Binary Interface(ABI)s ?

I know that the long type is 32-bit in i386 ABI & 64-bit in AMD64. Is this correct?

osgx
  • 90,338
  • 53
  • 357
  • 513

2 Answers2

10

I suggest you download Dr Agner Fog's optimization manuals. He has a manual specifically about ABIs and their differences.

For differences in the instruction set between 32-bit mode and 64-bit mode, both Intel and AMD's instruction manuals should cover this in the introductory volume or the volumes after the instruction volumes(2a and 2b for Intel's instruction set reference, or 2 and 3 for AMD.)

See also other links in the tag wiki.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Necrolis
  • 25,836
  • 3
  • 63
  • 101
  • @Jean-FrançoisFabre well this answer was done before SO moved to the no link answers; however, more importantly, there are a lot of differences, some of them are very subtle, and much better explained in a well revised, properly structured document like Anger Fog's work. – Necrolis Aug 30 '18 at 09:11
6

If you need all of the ABI details: subroutine calling conventions, which registers get what passed in them, which registers must be restored on return, exception handling -- which is completely different, there is a document you can download from Microsoft for the Windows ABI.

On the other hand, if you're just interested in data types, it only takes a couple of minutes to write a program that does:

fprintf (stdout, "size of int is %d\n", sizeof(int));
fprintf (stdout, "size of long int is %d\n", sizeof(long int));
// etc.

EDIT 4/7/11 to respond:

This link http://msdn.microsoft.com/en-us/library/7kcdt6fy.aspx works currently. No promises that MSFT won't move it tomorrow! Or Google "application binary interface site:microsoft.com"

All x86-64 OSes other than Windows use the x86-64 System V psABI. See Where is the X86-64 ABI documented?

The ABIs are defined by the operating systems and the compilers, not the hardware architects. For example, it's up to the compiler writers to decided whether a C/C++ int is 32 bits and a long int is 64 (x86-64 System V) -- or if both are 32-bit (x64 Windows), or even an int is 64 and a long int is 64, too (as some Fortran compilers do) -- or even int is 64 and long int is 128 or any other combination you can imagine. Intel and AMD can make recommendations, but the compiler writers and OS vendors are in control.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Die in Sente
  • 9,546
  • 3
  • 35
  • 41
  • 1
    All the details would be preferable, where can I get this file? Also, any ideas why it is published by Microsoft & not by Intel or AMD? –  Apr 05 '11 at 16:45