Master the fundamental concepts of arm assembly (aarch64) through this focused micro-challenge.
fib(n) needs both fib(n-1) and fib(n-2) unless you memoize. In assembly each bl clobbers x0 and overwrites lr, so you must spill live values to callee-saved registers or the stack. iOS and Android crash reports show these frames as repeated fib symbols when students forget to save lr.
asmLoading…
n <= 1 returns n in x0blFor this exercise, you will implement recursive fib without loops. This task asks you to save lr before every recursive bl, because leaf-vs-non-leaf distinction is the first thing arm64 unwinders check when a stack trace looks truncated.
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.
Implement recursive fibonacci function in ARM assembly.
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