Question: Consider the following ARM assembly code segment. a . Accurately comment each line of code b . Describe what parameters r 0 and r 1

Consider the following ARM assembly code segment.
a. Accurately comment each line of code
b. Describe what parameters r0 and r1(passed into the function) are used for. c. What are each of the local variables r4-r8 used for?
d. What is the purpose of this function?
e. Explain in detail the specific purpose of stmfd and ldmfd in this function.
.globl _MyFunc
.text
_MyFunc:
stmfd sp!,{r4, r5, r6, r7, r8, lr}
cmp r1, #1
ble end_outer
sub r5, r1, #1
mov r4, r0
mov r6, #0
loop_start:
ldr r7,[r4],4
ldr r8,[r4]
cmp r7, r8
ble no_go
mov r6, #1
sub r4, r4,4
swp r8, r8,[r4]
str r8,[r4,4]!
no_go:
subs r5, r5, #1
bne loop_start
end_inner:
cmp r6, #0
beq end_outer
mov r6, #0
mov r4, r0
sub r5, r1, #1
b loop_start
end_outer:
ldmfd sp!,{r4, r5, r6, r7, r8, pc}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!