Master the fundamental concepts of arm assembly (aarch64) through this focused micro-challenge.
The AArch64 Procedure Call Standard places arguments in x0-x7, returns scalars in x0, and keeps x19-x28 callee-saved. x29 is the frame pointer; x30 is the link register holding the return address. Swift, JNI, and kernel syscall wrappers all obey this map.
asmLoading…
Typical prologue:
asmLoading…
sp must be 16-byte aligned before bl. bl writes the return address into lr.
For this exercise, you will implement add and a caller that bls it. This task asks you to preserve callee-saved registers if you use them, because arm64e pointer authentication on Apple platforms assumes frames were built correctly.
Keep the relevant man page, ABI doc, or Rust reference chapter open while you work. When your output disagrees with the reference implementation on the same machine, the mismatch is usually an alignment rule, an off-by-one terminator, or a register slot you misread in GDB. Skim the official documentation for the tool or ABI named in the exercise; the prose changes, but register roles, syscall numbers, and ownership rules stay stable across releases. Treat each failure as a contract test: the CPU, kernel, and borrow checker enforce rules whether or not the tutorial mentioned them explicitly.
Implement ARM functions following proper calling conventions.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github