- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Assembly on x86_64 and AArch64 architectures
Introduction
First of all, Computer Architecture mainly refers to a central computing unit(CPU) design, including its memory and input-output (IO) subsystems. It also includes some elements such as RAM and memory reserved and mapped for external devices. Currently, the most common architecture families are:
- x86 - Intel/AMD architecture, mainly used in most desktop machines
- ARM - the dominant mobile and embedded architecture created by Acorn
A CPU can only understand byte code generated assembly language by an assembler. Assembly language and the number of instructions may vary for each architecture and assembler. So I have created a repository on my GitHub which contains an example code written for x86_64 and AArch64 to demonstrate the architecture differences and assembly language. Feel free to check it out!
I placed the code for each architecture in a dedicated folder containing a Makefile to build and create executables for each program. Each folder also includes a challenging program that prints times table for numbers from 1 to 12 with nice formating. That challenge especially demonstrates the differences in Assembly instructions, structure and design between x86_64 and AArch64.
Comparison
The most notable differences in the mentioned architectures are:
- Different instruction sets, syntax and usage
- Different number of registers, their usages and names
- The x86_64 has 16 registers: rax, rbx, rcx, rdx, rbp, rsp, rsi, rdi and r8-r15
- The AArch64 has 31 registers named r0-r30 and one more named rzr/rsp
- Different numbers for syscalls
- AArch64 uses the fixed-length instructions in contrast to variable-length for x86_64
Conclusion
I have learned the basic operations and techniques used in modern assembly while working on the code for each architecture. But I have also encountered some problems I have managed to debug and solve using breakpoints and the "objdump" command. Overall, it was a great experience and a fascinating topic to explore, and it was fun to compare it with simple 6502 Assembly. Not to mention the process of exploring assembly generated by the C and C++ compilers. But it is hard to argue that high-level languages are much easier to write with.
Author: Iurii Kondrakov
Email: deezzir@gmail.com
GitHub: github.com
P.S this blog post is created for the SPO600 Lab 4
Comments
Post a Comment