Title: CSE 351 23au / LS12 Procedures II

Q: What instruction pushes the return address onto the stack and marks the beginning of the stack frame?
A: `call`

Q: If a procedure calls another procedure, it may need to push arguments 7+ (in reverse) onto the stack, which creates the ___ section
A: argument build

Q: True or False: Local variables that aren’t being stored solely in registers are allocated on the stack
A: True

Q: Why are register-saving conventions important?
A: They tell us how to reuse and deal with registers to avoid accidental destruction of another procedure’s data

Q: What are the two ways to preserve a register value?
A: 1. Pushing a copy of the register value onto the stack
2. Copying the value into a register of the opposite type (caller vs. callee saved)

Q: What is the responsibility of the caller-saved registers?
A: The caller must determine if it needs to save any values in its registers in order to have access to them after returning from the “call”

Q: True or false: The callee can assume it has free reign to change the values in the caller-saved registers because the caller will have already saved the necessary data
A: True

Q: Saving is one of the ___ things done by the callee and restoring is one of the ___ things done (just before `ret`)
A: first, last
Saving is one of the first things done by the callee and restoring is one of the last things done (just before `ret`)

Q: What is the responsibility of the callee-saved registers?
A: The callee must save the old values of the registers it intends to modify and restore them before its return

Q: True or false: The caller cannot assume that the values in the callee-saved registers will remain the same when passed back to it because if the callee did use it, it would not have saved and restored the caller’s values
A: False, the callee must first save the values in the registers used by the caller and restore the saved values when control is passed back to the caller