1 3 1 2 3 4 5 e 10 11 12 13 14 In € 17 IM 19 20 21 12 23 14 25 17 int mat1 [M] [N]; int mat 2 [N] [M]; int sum_element(int i, int j) { } In compiling this code, armcc.exe produces the following code. sum element PROC ADD LDR ADD ADD ADD LDR ADD ADD LDR ADD BX ENDP ILO.401 nati return mati[i][j] + mat2 [j] [i]; mat2 DCW DCD DCD as r2, ro, ro, LSL #1 r3, |L0.401 % r2, r2, ro, LSL #3 r2, r3, r2, LSL #2 r3, r3,#0x108 r2, [r2, r1, LSL #2] r1,r1, r1, LSL #1 ri, r3, r1,LSL #3 ro, [r1, r0, LSL #2] ro.ro,r2 1r 0x0000 11.bss|| AREA II.arn_vfe_headerI, DATA, READONLY, NOALLOC, ALIGN-2 0x00000000 AREA 11.bss|, DATA, NOINIT, ALIGN=2 264 10.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1 In the following source code, M and N are constants declared with #define.
int mat1 [M] [N];
int mat 2 [N] [M];
1
2
3
4
6
1
2
8
9
10
11
12
13
15
10
17
19
21
23
24
28
31
32
33
Name:
34
35
int sum_element(int i, int j) {
30
|}
In compiling this code, armcc.exe produces the following code.
sum element PROC
ADD
LDR
ADD
ADD
ADD
LDR
ADD
ADD
LDR
ADD
BX
ENDP
return mat1[i][j] + mat2 [j] [i];
mati
|L0.401
mat2
DCW
DCD
DCD
r2,ro,r0, LSL #1
r3, |L0.401
r2,r2, r0, LSL #3
r2, r3, r2, LSL #2
||.bss||
AREA ||.arm_vfe_header |I, DATA, READONLY, NOALLOC, ALIGN=2
%
r3, r3, #0x108
r2, [r2, r1, LSL #2]
%
r1,r1, r1, LSL #1
r1, r3,r1, LSL #3
ro, [r1, r0, LSL #2]
ro,ro,r2
lr
0x0000
AREA .bss|, DATA, NOINIT, ALIGN=2
0x00000000
264
264
Student No.:
EXPORT sum element [CODE]
EXPORT mat1 [DATA, SIZE-264]
EXPORT mat2 [DATA, SIZE-264]
;... some stuff omitted...
END
3
Reverse engineer the assembly code to determine the values of M and N. Com-
ment the assembly to show your understanding of the code. (Hint: line 2 loads
r3 with the address of mat1, and line 6 loads r3 with the address of mat2.)
Transcribed Image Text:1 In the following source code, M and N are constants declared with #define. int mat1 [M] [N]; int mat 2 [N] [M]; 1 2 3 4 6 1 2 8 9 10 11 12 13 15 10 17 19 21 23 24 28 31 32 33 Name: 34 35 int sum_element(int i, int j) { 30 |} In compiling this code, armcc.exe produces the following code. sum element PROC ADD LDR ADD ADD ADD LDR ADD ADD LDR ADD BX ENDP return mat1[i][j] + mat2 [j] [i]; mati |L0.401 mat2 DCW DCD DCD r2,ro,r0, LSL #1 r3, |L0.401 r2,r2, r0, LSL #3 r2, r3, r2, LSL #2 ||.bss|| AREA ||.arm_vfe_header |I, DATA, READONLY, NOALLOC, ALIGN=2 % r3, r3, #0x108 r2, [r2, r1, LSL #2] % r1,r1, r1, LSL #1 r1, r3,r1, LSL #3 ro, [r1, r0, LSL #2] ro,ro,r2 lr 0x0000 AREA .bss|, DATA, NOINIT, ALIGN=2 0x00000000 264 264 Student No.: EXPORT sum element [CODE] EXPORT mat1 [DATA, SIZE-264] EXPORT mat2 [DATA, SIZE-264] ;... some stuff omitted... END 3 Reverse engineer the assembly code to determine the values of M and N. Com- ment the assembly to show your understanding of the code. (Hint: line 2 loads r3 with the address of mat1, and line 6 loads r3 with the address of mat2.)
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY