Need use stmdb and ldmia instructions for the descending stack mov
Quiz 3 |
|
---|
UIN:
b. If you want to fix the problem, how do you use STM and LDM type instruction (loading and storing multiple registers instructions; need to modify them for stack operation) to fix the problem (place them in the correct locations in above three potion of codes as well as provide a complete and correct instruction syntax).
Only need to consider cases for the descending stack. Assume: SP is the top of address in astack.
44 BL SQ -------------------- PC = 40, LR = 28
28 BX LR --------------------- PC = LR = 28(?), here is the conflict happens since LR ≠
SQ:
40 MUL R0, R0
44 BX LR