Bird
0
0

A programmer passes seven parameters to a function in ARM but notices incorrect values for the last three parameters inside the function. What is the most likely cause?

medium📝 Analysis Q14 of 15
ARM Architecture - Subroutines and Stack
A programmer passes seven parameters to a function in ARM but notices incorrect values for the last three parameters inside the function. What is the most likely cause?
ARegisters r4 to r6 should be used for last three parameters
BAll parameters must be passed in registers; stack is never used
CParameters beyond four are ignored by ARM
DOnly first four parameters are passed in registers; last three must be on stack but were not
Step-by-Step Solution
Solution:
  1. Step 1: Recall ARM parameter passing rules

    Only the first four parameters are passed in registers r0 to r3.
  2. Step 2: Identify cause of incorrect values

    If last three parameters are not placed on the stack properly, their values will be incorrect inside the function.
  3. Final Answer:

    Only first four parameters are passed in registers; last three must be on stack but were not -> Option D
  4. Quick Check:

    Extra params must be on stack [OK]
Quick Trick: Extra params need stack space; missing stack causes errors [OK]
Common Mistakes:
  • Assuming all params fit in registers
  • Using wrong registers for extra params
  • Ignoring stack for extra parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes