1
votes

This is a simple NASM 64bit linux assembly program:

_exit:
    mov rax, 60
    mov rdi, 0
    syscall

My computer is AMD ( x86_64 64bit ) and i know this assembly program will working in INTEL 64bit processor too.

but I have these following problems !

  • Will this program work on ( linux ) computer with MIPS 64bit and ARM 64bit architecture?
  • Do only system calls change when an assembly code with the different operating systems?
1
This isn't arm nor mips so no, it won't work on a computer with those respective CPU architectures, regardless of the OS. The assembly you've provided is OS-agnostic, such that it should be able to assemble and run on pretty much any OS that has a x86-64 compiler. However, the assembly process leaves artifacts that can be OS-dependent, such as invoking the appropriate loader, file formats, and whatnot. In short, the code is portable across OS's but the assembled binary is not. - h0r53
The AMD x86 is an intel x86 are for the most part compatible, and you are using the same operating system so the instructions and the syscall match. But no other system or architecture will work as they are both incompatible. - old_timer

1 Answers

6
votes

Will this program work on ( linux ) computer with MIPS 64bit and ARM 64bit architecture?

No. MIPS and ARM have entirely different instruction sets. It would be comparable to trying to run JVM Bytecode with the .NET VM. It is just not compatible.

Do only system calls change when an assembly code with the different operating systems?

No. The calling conventions differ, for example. For example windows uses RCX, RDX, R8, and R9 for passing int arguments, SystemV (E.g. Linux) uses RDI, RSI, RDX, RCX, R8, R9 for this. Source