Consider the following ARMV-8 Assembly program then answer the following questions (1 to 11): global main main MOV X19,#
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Consider the following ARMV-8 Assembly program then answer the following questions (1 to 11): global main main MOV X19,#
questions (1 to 11): global main main MOV X19,#10 MOV X20,20 MOV XO, 18 BL fact MOV X21,1 MOV XO , #3 BL fact MOV X22,X1 ADD X0,X19,X20 At xa,x21,xe ADD X23,X22,XO B endofprogram fact: SUB sp,sp,#32 SIK X19, Esp, #24] STR X2e, Esp, #16] STR X21, sp, #8] STR X22, sp, #e] MOV X19,#1 MŨ X20,00 loop: CMP X20,#1 B.LE loopend MUL X19,X19,X20 MOV XI,X19 SUB X20,x20, #1 Bloop loopend: LDR X19, Esp,421] LDR X2e, sp,#161 LDR X21, sp,#81 LDR X22, Esp, te] RET 1. Write the C equivalent of the above Assembly program. . 2. Comment the Assembly code line by line. 3. What is the purpose of the instruction B endofprogram? 4. What is the purpose of the instruction RET? 5. Which register holds the final value of the program? 6. Provide a screenshot of the stack pointer at the instruction MOV ke, #8 7. Provide a screenshot of the stack pointer at the instruction loop: CMP X20, #1 8. a. What are the values pushed to the stack inside the procedure? b. Explain your answer 9. a. Compute the final value return by the program. a b. Provide a screenshot of the final value. 10. Remove the stack preservation part and recompute the final value returned by the program: a. What is the new final value? a? b b. Is the new value correct? c. Explain your answer. 11. Write a paragraph explaining the role of the stack.
Consider the following ARMV-8 Assembly program then answer the following