Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write an ARM program that takes takes an input n and uses recursion to print n down to zero and back to n. Here is
Write an ARM program that takes takes an input n and uses recursion to print n down to zero and back to n. Here is sample output [root@debian-aarch 4:/ workdir\# gcc -o printfun printfun.s g ir[root@debian-aarch64: /workdir\#./printfun [Please enter a number: 4 iP i 3 i 2 is 1 ir 0 i 2 i 3 i 4 is root@debian-aarch64: /workdir\# Here is the ct+ code for the procedure. (This is simply meant to help you understand the assignment!!) Requirements and Specifications Your inputs n cannot be stored as a global variable at any point. This means you cannot store them at a data section address, even when accepting them from scanf; they must be returned from scanf on the stack. X19X27 are global variables. You may not use X19X27 in your recursive function. If you want, you may use X19X27 in your main function. You can use any registers you want to in your main function. A recursion procedure requires: - Allocate stack space - Save the return address and argument on the stack. - Recursively call procedure with BL - Unwind the stack by restoring the return address and arguments and deallocating stack memory Hints and Warnings You must put the argument and return address on the stack before any bl call, and restore the argument and the return address after the bl call. This includes every printf call and every recursive call
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started