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

后端 未结 9 886
感动是毒
感动是毒 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:49

    Well, you don't run straight assembly. The code has to be in some sort of executable format: windows uses PE, most Unices use ELF now (although there have been others, like a.out).

    The base assembly instructions are the same, and the functions you create with them are the same.

    The problem comes with access to other resources. The processor is really good at calculation, but can't access the hard disk, or print a character to the screen, or connect to a Bluetooth phone. These elements are always in some way operating system dependent. They are implemented in terms of syscalls, where the processor signals the operating system to perform a certain task. Task number 17 on linux isn't necessarily task 17 on windows; they may not even have equivalents.

    Since most libraries have some syscalls at their lowest levels, this is why code can't just be recompiled in every case.

提交回复
热议问题