ARM Architecture & Your First Program
ARM's profiles and instruction sets, what assembly language is for, and a program that talks to the Linux kernel directly.
ARM processors are in almost every phone, most microcontrollers, Apple's Macs, a growing share of servers and nearly every embedded device. Assembly language is the human-readable form of the instructions they actually execute. Few programs are written entirely in assembly today, but reading it is essential for debugging, performance work, startup code, interrupt handlers and understanding what the compiler did with your C.
Hello world without a C library
mov x0, #1 puts the value 1 (standard output) into register x0.
adr x1, msg loads the address of the message, computed relative to the current instruction.
x8 holds the system call number (64 = write, 93 = exit on Linux AArch64); svc #0 enters the kernel..ascii places bytes in the program;.equ len,. - msg computes the length at assembly time.
Immediate (constant) values are written with # in ARM assembly syntax (many assemblers accept it without, but # is the standard and avoids confusion with addresses).
What does 'load/store architecture' mean?
Only load and store instructions access memory; all arithmetic and logic operate on registers. Values must be loaded into registers, processed, and stored back.
What is the difference between x5 and w5?
x5 is the full 64-bit register; w5 is its lower 32 bits. Writing w5 clears the upper 32 bits of x5.