Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the following ARM assembly language subroutine using the ARM procedure Call S

ID: 3680770 • Letter: I

Question

In the following ARM assembly language subroutine using the ARM procedure Call Standard, we take a value n found in Ro and raise it to the tenth power (n^10), placing the result back into R0. The subroutine accomplishes this by calling a subroutine pow, which takes the value in R0 and raises it to the power found in R1, placing the value of a^b into R0. Even though pow abides by the ARM Procedure Call Standard and works correctly, we find that this toTenth subroutine never returns. Explain why precisely this happens, and describe what you would do to repair it.

Explanation / Answer

As we have line "BL pow" , when this instrution executes the address of next instruction
"MOV PC, LR" is placed in link register. So after pow returns , the link register still holds the
address of instruction although when we execute next instruction. So resetting PC to point again
will result in repeating infinite times. So we wont get return.

Regarding repair.. we have store LR before pow sub routine. So after pow instruction we will
place this LR value to PC to avoid infinite times repeating.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote