The MASM Forum

General => The Campus => Topic started by: jack on January 29, 2018, 01:09:53 AM

Title: linux x86 vs windows x86 executable
Post by: jack on January 29, 2018, 01:09:53 AM
does linux x86 handle cpu registers the same as windows x86, I mean is the ABI the same or different?
Title: Re: linux x86 vs windows x86 executable
Post by: felipe on January 29, 2018, 03:37:34 AM
I think is different, because the stdcall convention in fact is not a standard one (as far as i know), it was created by microsoft . But probably is similar, maybe like a cdecl convention.
You should look in google too.  :P
Title: Re: linux x86 vs windows x86 executable
Post by: aw27 on January 29, 2018, 04:43:39 PM
Quote from: jack on January 29, 2018, 01:09:53 AM
does linux x86 handle cpu registers the same as windows x86, I mean is the ABI the same or different?
Typically, x86 Linux uses the GCC/cdecl calling convention, which is the same as cdecl under Windows except that the former requires the stack to be aligned to a 16-byte boundary before the call and the second to a 4-byte boundary.
Cdecl is also the default for current Windows C compilers. For API calls, normally Windows does not use cdecl but stdcall.
But ABI is more than the calling convention.
Title: Re: linux x86 vs windows x86 executable
Post by: hutch-- on January 29, 2018, 05:19:53 PM
Agner Fog has done work in this area and published it, in 32 bit the ABI was different from memory than with Unix based systems.

Look here.

http://agner.org/optimize/calling_conventions.pdf
Title: Re: linux x86 vs windows x86 executable
Post by: jack on January 30, 2018, 12:28:02 AM
aw27 that's the kind of information I was after, thank you
thank you hutch for the reference