Why There is a difference between assembly languages like Windows, Linux?

后端 未结 9 889
感动是毒
感动是毒 2021-01-30 17:53

I am relatively new to all this low level stuff,assembly language.. and want to learn more detail. Why there is a difference between Linux, Windows Assembly languages?

9条回答
  •  无人及你
    2021-01-30 18:33

    The OS determines two things: (1) the calling convention, which defines how parameters go on the stack and therefore impacts the assembly code, and (2) the run-time libraries that implement common functions like memory allocation, input/output, higher-level math, etc.

    So while x+y compiles to the same assembly code under Windows or Linux on an x86 processor, y = sin(x) will be different due to a different calling convention and different math library.

    Beyond that, the assembly language itself is dependent on the processor. x86, x86_64, ARM, PowerPC, each have their own assembly language.

提交回复
热议问题