Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) What is the purpose of lines 56 - 61? Note :ip refers to r12. (b) Draw the stack after the execution of line 60.

(a) What is the purpose of lines 56 - 61? Note :ip refers to r12. (b) Draw the stack after the execution of line 60. (c) What is the contents of r0 after executing line 62? Give a meaningful answer with respect to the original C program. (d) Draw the stack after the execution of line 10.

ARM assembler program: 1 sum: 2 str fp , [ sp , #4]! 3 add fp , sp , #0 4 sub sp , sp , #20 5 str r0 , [ fp , #16] 6 str r1 , [ fp , #20] 7 mov r3 , #0 8 str r3 , [ fp , #12] 9 mov r3 , #0 10 str r3 , [ fp , #8] 11 b .L2 12 .L3: 13 ldr r3 , [ fp , #8] 14 mov r3 , r3 , asl #2 15 ldr r2 , [ fp , #16] 16 add r3 , r2 , r3 17 ldr r3 , [ r3 ] 18 ldr r2 , [ fp , #12] 19 add r3 , r2 , r3 20 str r3 , [ fp , #12] 21 ldr r3 , [ fp , #8] 22 add r3 , r3 , #1 23 str r3 , [ fp , #8] 24 .L2: 25 ldr r2 , [ fp , #8] 26 ldr r3 , [ fp , #20] 27 cmp r2 , r3 28 blt .L3 29 ldr r3 , [ fp , #12] 30 mov r0 , r3 31 sub sp , fp , #0 32 @ sp needed 33 ldr fp , [ sp ] , #4 34 bx lr 35 .LC1: 36 . ascii there are %d widgets\012\000 37 .LC0: 38 . word 12 39 . word 0 40 . word 48 41 . word 23 42 . word 4 4 3 . word 5 44 . word 1 45 . word 8 46 . word 1 47 . word 5 48 main : 49 stmfd sp ! , {fp , lr} 50 add fp , sp , #4 51 sub sp , sp , #40 52 ldr r3 , .L6 53 sub ip , fp , #44 54 mov lr , r3 55 ldmia lr ! , {r0 , r1 , r2 , r3} 56 stmia ip ! , {r0 , r1 , r2 , r3} 57 ldmia lr ! , {r0 , r1 , r2 , r3} 58 stmia ip ! , {r0 , r1 , r2 , r3} 59 ldmia lr , {r0 , r1} 60 stmia ip , {r0 , r1} 61 sub r3 , fp , #44 62 mov r0 , r3 63 mov r1 , #10 64 bl sum 65 mov r3 , r0 66 ldr r0 , .L6+4 67 mov r1 , r3 68 bl printf 69 mov r0 , r3 70 sub sp , fp , #4 71 @ sp needed 72 ldmfd sp ! , {fp , pc} 73 .L7: 74 . align 2 75 .L6: 76 . word .LC0 77 . word .LC1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

4. Did you rethink your decision?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago