Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ONLY answer in ARM assembly language Please : ARM assembly code 0x00008000 test MOV R0,#5 0x00008004 0x00008008 0x0000800C loop oop 0x00008010 f PUSH IRI.RO.LR,R4save registers
ONLY answer in ARM assembly language
: ARM assembly code 0x00008000 test MOV R0,#5 0x00008004 0x00008008 0x0000800C loop oop 0x00008010 f PUSH IRI.RO.LR,R4save registers on stack 0x00008014 0x00008018 0x00008010 0x00008020 0x00008024 0x00008028 0x00008020 0x00008030 0x00008034 0x00008038 g PUSH IR4.LRI 0x00008030 0x00008040 0x00008044 0x00008048 0x00008040 0x00008050 else SUB RO, RO.#1 0x00008054 0x00008058 0x0000805C done POP IR4.LR 0x00008060 MOV R1,#3 BL f : call f (5. 3) : and loop forever MOV R4. RO MOV RO. RI BL 9 MOV R2. RO POP IR1 RO ADD RO. R2. R ADD RO. RO.R4 : place b as argument for g : call g(b) : place return value in R2 : restore a and b after call ; R0=g(b) + a : restore R4. LR : return : save registers on stack MOV PC, LR MOV R4 , #3 CHP RO, #0 BNE else MOV R0,#0 B done : branch when not equal ; if equal, return value=0 : and clean up BL 9 ADD RO. RO, R4 call gix-1 : restore RO.R4.LR from stack : return MOV PC. LR You will probably find it useful to make drawings of the stack similar to the one in Figure 6.14 to help you answer the following questions. (a) If the code runs starting at test, what value is in RO when the program gets to loop? Does his program correctly compute 2a +3b (b) Suppose Ben changes the instructions at addresses 0x00008010 and 0x00008030 to PUSH IR1.RO.R4) and POP IR41, respectively. Will the program (1) enter an infinite loop but not crash; (2) crash (cause the stack to grow beyond the dynamic data segment or the PC to jump to a location outside the program); (3) produce an incorrect value in RO when the program returns to loop (if so, what value?), or 4) run correctly despite the deleted lines Please
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