Author Topic: linux x86 vs windows x86 executable  (Read 546 times)

jack

  • Regular Member
  • *
  • Posts: 20
linux x86 vs windows x86 executable
« 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?

felipe

  • Member
  • ****
  • Posts: 971
  • Eagles are just great!
Re: linux x86 vs windows x86 executable
« Reply #1 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
Felipe.

AW

  • Member
  • *****
  • Posts: 1564
  • Let's Make ASM Great Again!
Re: linux x86 vs windows x86 executable
« Reply #2 on: January 29, 2018, 04:43:39 PM »
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.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5899
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: linux x86 vs windows x86 executable
« Reply #3 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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

jack

  • Regular Member
  • *
  • Posts: 20
Re: linux x86 vs windows x86 executable
« Reply #4 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