Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
986 views
in Technique[技术] by (71.8m points)

arm - How does works the same assembly program on different OS's and architectures?

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?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...