Bird
0
0

Analyze this ARM assembly code:

medium📝 Analysis Q4 of 15
ARM Architecture - Subroutines and Stack
Analyze this ARM assembly code:
BL subroutine
MOV R0, #1
BL subroutine
What is the effect of calling subroutine twice?
AThe second call overwrites the first call's return address
BThe subroutine executes two times, reusing the same code
CThe program will crash due to nested calls
DOnly the first call executes; the second is ignored
Step-by-Step Solution
Solution:
  1. Step 1: Understand BL instruction

    BL calls a subroutine and saves return address in LR.
  2. Step 2: Multiple calls

    Each BL call executes the subroutine independently.
  3. Final Answer:

    The subroutine executes two times, reusing the same code -> Option B
  4. Quick Check:

    Subroutines can be called multiple times safely [OK]
Quick Trick: BL calls subroutine each time independently [OK]
Common Mistakes:
  • Assuming return address is overwritten without saving
  • Believing nested calls cause crashes automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes