Bird
0
0

Which ARM instruction is used to allocate space on the stack for local variables during stack frame setup?

easy📝 Factual Q3 of 15
ARM Architecture - Subroutines and Stack
Which ARM instruction is used to allocate space on the stack for local variables during stack frame setup?
ASUB SP, SP, #16
BADD SP, SP, #4
CMOV SP, LR
DPUSH {R0}
Step-by-Step Solution
Solution:
  1. Step 1: Understand stack pointer adjustment

    To allocate space, the stack pointer (SP) is moved down by subtracting bytes.
  2. Step 2: Identify correct instruction

    SUB SP, SP, #16 decreases SP by 16 bytes, reserving space for locals.
  3. Final Answer:

    SUB SP, SP, #16 -> Option A
  4. Quick Check:

    Allocate stack space = SUB SP, SP, #number [OK]
Quick Trick: Subtract from SP to allocate stack space [OK]
Common Mistakes:
  • Adding to SP instead of subtracting
  • Using MOV to set SP incorrectly
  • Confusing PUSH with space allocation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes