Recursion and the register rules behind it: saving x30link register (x30 / lr): holds the return address set by bl. and x19callee-saved register (x19-x28): a routine must restore it before it returns. in every call, the frames a deep call leaves on the stack, and the frame chain that leads back to main.
0 of 8 correct
Multiple choice
fact calls itself with bl fact. Why must it save x30 before that call?
Multiple choice
fact keeps n in x19 so it survives the recursive call. What else must every call of fact do with x19?
Multiple choice
main calls fact(4), and fact calls itself until its base case at n = 1. How many frames of fact are on the stack at the deepest point?
Multiple choice
A recursive function has no base case. What happens when it runs?
Multiple choice
Which of these is certain to be the same after a bl to a function that follows the calling rules?
Multiple choice
A helper uses x19 as scratch and never restores it. Its caller kept a running total in x19. What does the caller find in x19 after the call?
Multiple choice
Each call of a recursive function opens with stp x29, x30, [sp, -16]! and then mov x29, sp. What does the 8-byte word at [x29] hold in the deepest call?
Multiple choice
fact(n) returns n * fact(n - 1). In what order do the multiplications run?