0
0
ARM Architectureknowledge~5 mins

Preserving callee-saved registers in ARM Architecture - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are callee-saved registers in ARM architecture?
Callee-saved registers are registers that a called function must preserve. If the function changes their values, it must restore them before returning to the caller.
Click to reveal answer
beginner
Why must callee-saved registers be preserved?
They must be preserved to ensure the calling function's data in those registers is not lost or corrupted after the called function finishes execution.
Click to reveal answer
intermediate
How does a function preserve callee-saved registers in ARM?
The function saves the callee-saved registers on the stack at the start and restores them from the stack before returning.
Click to reveal answer
intermediate
Which ARM registers are typically callee-saved?
Registers R4 to R11 are usually callee-saved in ARM calling conventions. The stack pointer (SP) is generally preserved by convention but is not considered a callee-saved register in the same sense.
Click to reveal answer
beginner
What happens if a callee does not preserve callee-saved registers properly?
The caller may experience incorrect behavior or crashes because its expected register values are overwritten unexpectedly.
Click to reveal answer
Which registers must a called function preserve in ARM architecture?
AR4 to R11
BR0 to R3
CProgram Counter (PC)
DLink Register (LR)
Where are callee-saved registers typically stored during preservation?
AIn special CPU cache
BOn the stack
CIn global memory
DIn caller's registers
What is the main purpose of preserving callee-saved registers?
ATo keep caller's data intact
BTo speed up function calls
CTo free up registers for the caller
DTo avoid using the stack
If a callee modifies a callee-saved register, what must it do before returning?
ALeave it modified
BNotify the caller
CRestore the original value
DSave it to a global variable
Which of these is NOT a callee-saved register in ARM?
AR5
BR10
CR7
DR2
Explain why preserving callee-saved registers is important in ARM function calls.
Think about what happens if the called function changes registers the caller expects to keep.
You got /3 concepts.
    Describe the typical steps a function takes to preserve callee-saved registers in ARM.
    Consider what happens in the function prologue and epilogue.
    You got /3 concepts.