Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Find a mulpd instruction in hex.out [use this for c) and d) ] Write an assembly language line, write the machine address. 2. From

image text in transcribed

image text in transcribedimage text in transcribed

1. Find a mulpd instruction in hex.out [use this for c) and d) ] Write an assembly language line, write the machine address.

2. From the machine address, look up and write the mulpd instruction as hexadecimal. Treat as big endian, 32 bit MIPS architecture, rather than little endian, X86 architecture.

lype "apropos wo rd" to sea rcn Tor commands related ''wo rd'' Reading symbols from a.out...done. (gdb) list 1,26 1 /* matmul2.c 100*100 matrix element by element multiply * 2 #include 4 int main() 6 const int N 100; 7 double a [N] [N]; /* input matrix * 8 double b [N] [N]; / input matrix */ 9 double c[N] [N]; /* result matrix */ 10 int i,j; 12 printf("starting multiply "); 13 a [1] [1]-3.5; 14 b[1] [1] -1.2; /* not a valid benchmark, most elements zero */ 15 17 for(j=0 ; 18 front: 19 20 back:; 21 jd; j++){ C[i] [j] a[i] [j]*b [1] [j]; /* most time spent here! */ 23 printf("a result %g ", c [1] [1] ); /* prevent dead code elimination */ 24 return 0 25 J 26 (gdb) break main Breakpoint 1 at 0x400450: file matmu12.c, line 7. (gdb) run Starting program: /afs/umbc.edu/users/aasafi1/home/411/hw3/a.out Missing separate debuginfos, use: dnf debuginfo-install glibc-2.27-32.fc28. x86_64 48 49 Breakpoint 1, main ) at matmu12.c:7 50 7 double a IN] [N] /input matrix */ 51 (gdb) disassemble 52 Dump of assembler code for function main: 53 0x0000000000400450 : push %rbp 54 0x0000000000400451 : mov $0x13880,%eax 0x0000000000400456 : mov $0x4006b0,%edi 0x000000000040045b : mov %rsp,%rbp 0x000000000040045e : push %r15 0x0000000000400460 : push %r14 0x0000000000400462 : push %r13 0x0000000000400464 : push %r12 0x0000000000400466 : push %rbx 0x0000000000400467 : sub $0x18,srsp 0x000000000040046b : sub %rax,%rsp 0x000000000040046e : shr $0x3,srdx 0x000000000040047a : lea 0x7(%rsp),8r15 0x000000000040047t : sub %rax,%rsp 0x0000000000400482 : lea 0x8(,%rdx,8),8r13 0x000000000040048a : mov %rdx,-0x38 (%rbp) 0x000000000040048e : callq 0x400430 0x000000000040049c mov -0x38(srbp),8rdx 0x00000000004004a0 mov 0x229 (rip),srax 0x00000000004004aT : shr $0x3,er14 0x00000000004004ab : lea 0x0,sr15,8),%r12 0x00000000004004b3 : mov %rax , 0x328(,%rdx,8) 0x00000000004004c5 : mov 0x20c(rip),srax 0x00000000004004cc : mov %rax , 0x328(.*r15,8) 0x00000000004004d4 : lea 0x0 (sr13,srdi,1),srsi 0x00000000004004d9 : lea (r12,%rdi,1),srcx 0x00000000004004dd : xor %eax , %eax 0x00000000004004df : lea (erbx,Srd,1),8rdx 0x00000000004004e3 nopl 0x0 (srax,srax,1) 0x00000000004004e8 : movupd (ersi,erax, 1),8xmm0 0x00000000004004ed : movupd (ercx,erax, 1).*xmm1 0x00000000004004f2 : mulpd %xmm1.*xmm0 0x0000000000400416166>: movups %xmm0,(erdx,erax, 1) 0x00000000004004fa : cmp $0x320,srax 0x0000000000400504 : jne 0x4004e8
0x0000000000400506 : add $0x320,rdi 0x000000000040050d : cmp $0x13880,%rdi 0x0000000000400514 : jne 0x4004d4
0x0000000000400516 : movsd 0x328(,er14 , 8),%xmm0 0x0000000000400520 : mov $0x4006c2,sedi 0x0000000000400525 : mov $0x1,seax 0x000000000040052a : callq 0x400440 0x000000000040052f : lea -0x28 (%rbp),srsp 0x0000000000400533 : xor ax, seax 56 57 58 59 60 62 63 64 65 67 68 69 70 72 73 74 75 76 # 0x4006d0 80 81 82 83 84 85 86 87 # 0x4006d8 89 90 91 92 93 94 95 96 98 100 101 102 103 100 101 102 103 104 105 106 107 108 109 110 111 End of assembler dump. 112 (gdb) x/60x main 113 0x400450
: 0x3880b855 0xbobf0001 0x48004006 0x5741e589 114 0x400460
; 0x55415641 0x48535441 0x4818ec83 0x8d48c429 115 0x400470
0x48072454 0xc148c429 0x8d4c03ea 0x4807247c 116 0x400480
: 0x8d4cc429 0x0000d52c 0x89480000 0xc149c855 117 0x400490
; 0x8d4c03ef 0xe8072474 0xffffff94 0xc8558b48 118 0x4004a0
: 0x29058b480x49000002 0x4e03eec1 0x00fd248d 119 0x4004b0
: 0x4a000000 0x00f51c8d 0x31000000 0x048948ff 120 0x4004c0
: 0x000328d5 0x058b4800 0x0000020c 0xfd04894a 121 0x4004d0
: 0x00000328 0x3d748d49 0x0c8d4900 0x48c0313c 122 0x4004e0
: 0x0f3b148d0x0000441f 0x04100f66 0x100f6606 123 0x4004f0
: 0x0f66010c 0x110fc159 0x83480204 0x3d4810c0 124 0x400500
: 0x00000320 0x8148e275 0x000320c7 Oxff814800 125 0x400510
: 0x00013880 0x42f2be75 0xf504100f 0x00000328 126 0x400520
0x4006c2bf 0x0001b800 0x11e80000 0x48ffffff 127 0x400530
: 0x31d8658d0x5c415bc0 0x5e415d41 0xc35d5f41 128 (gdb) q 129 A debugging session is active. 130 131 132 133 Quit anvway? (y or n) v 0x0000000000400525 : mov 0x000000000040052a : callq 0x000000000040052t :xor 0x0000000000400535 : pop 0x0000000000400536 : pop 0x0000000000400538 : pop 0x000000000040053a : pop 0x000000000040053c : pop 0x000000000040053e : pop 0x000000000040053f : retq $0x1,seax 0x400440 -0x28(%rbp),%rsp %eax,%eax %rbs %r12 %r13 %r14 %r15 %rb Inferior 1 [process 12458] will be killed lype "apropos wo rd" to sea rcn Tor commands related ''wo rd'' Reading symbols from a.out...done. (gdb) list 1,26 1 /* matmul2.c 100*100 matrix element by element multiply * 2 #include 4 int main() 6 const int N 100; 7 double a [N] [N]; /* input matrix * 8 double b [N] [N]; / input matrix */ 9 double c[N] [N]; /* result matrix */ 10 int i,j; 12 printf("starting multiply "); 13 a [1] [1]-3.5; 14 b[1] [1] -1.2; /* not a valid benchmark, most elements zero */ 15 17 for(j=0 ; 18 front: 19 20 back:; 21 jd; j++){ C[i] [j] a[i] [j]*b [1] [j]; /* most time spent here! */ 23 printf("a result %g ", c [1] [1] ); /* prevent dead code elimination */ 24 return 0 25 J 26 (gdb) break main Breakpoint 1 at 0x400450: file matmu12.c, line 7. (gdb) run Starting program: /afs/umbc.edu/users/aasafi1/home/411/hw3/a.out Missing separate debuginfos, use: dnf debuginfo-install glibc-2.27-32.fc28. x86_64 48 49 Breakpoint 1, main ) at matmu12.c:7 50 7 double a IN] [N] /input matrix */ 51 (gdb) disassemble 52 Dump of assembler code for function main: 53 0x0000000000400450 : push %rbp 54 0x0000000000400451 : mov $0x13880,%eax 0x0000000000400456 : mov $0x4006b0,%edi 0x000000000040045b : mov %rsp,%rbp 0x000000000040045e : push %r15 0x0000000000400460 : push %r14 0x0000000000400462 : push %r13 0x0000000000400464 : push %r12 0x0000000000400466 : push %rbx 0x0000000000400467 : sub $0x18,srsp 0x000000000040046b : sub %rax,%rsp 0x000000000040046e : shr $0x3,srdx 0x000000000040047a : lea 0x7(%rsp),8r15 0x000000000040047t : sub %rax,%rsp 0x0000000000400482 : lea 0x8(,%rdx,8),8r13 0x000000000040048a : mov %rdx,-0x38 (%rbp) 0x000000000040048e : callq 0x400430 0x000000000040049c mov -0x38(srbp),8rdx 0x00000000004004a0 mov 0x229 (rip),srax 0x00000000004004aT : shr $0x3,er14 0x00000000004004ab : lea 0x0,sr15,8),%r12 0x00000000004004b3 : mov %rax , 0x328(,%rdx,8) 0x00000000004004c5 : mov 0x20c(rip),srax 0x00000000004004cc : mov %rax , 0x328(.*r15,8) 0x00000000004004d4 : lea 0x0 (sr13,srdi,1),srsi 0x00000000004004d9 : lea (r12,%rdi,1),srcx 0x00000000004004dd : xor %eax , %eax 0x00000000004004df : lea (erbx,Srd,1),8rdx 0x00000000004004e3 nopl 0x0 (srax,srax,1) 0x00000000004004e8 : movupd (ersi,erax, 1),8xmm0 0x00000000004004ed : movupd (ercx,erax, 1).*xmm1 0x00000000004004f2 : mulpd %xmm1.*xmm0 0x0000000000400416166>: movups %xmm0,(erdx,erax, 1) 0x00000000004004fa : cmp $0x320,srax 0x0000000000400504 : jne 0x4004e8
0x0000000000400506 : add $0x320,rdi 0x000000000040050d : cmp $0x13880,%rdi 0x0000000000400514 : jne 0x4004d4
0x0000000000400516 : movsd 0x328(,er14 , 8),%xmm0 0x0000000000400520 : mov $0x4006c2,sedi 0x0000000000400525 : mov $0x1,seax 0x000000000040052a : callq 0x400440 0x000000000040052f : lea -0x28 (%rbp),srsp 0x0000000000400533 : xor ax, seax 56 57 58 59 60 62 63 64 65 67 68 69 70 72 73 74 75 76 # 0x4006d0 80 81 82 83 84 85 86 87 # 0x4006d8 89 90 91 92 93 94 95 96 98 100 101 102 103 100 101 102 103 104 105 106 107 108 109 110 111 End of assembler dump. 112 (gdb) x/60x main 113 0x400450
: 0x3880b855 0xbobf0001 0x48004006 0x5741e589 114 0x400460
; 0x55415641 0x48535441 0x4818ec83 0x8d48c429 115 0x400470
0x48072454 0xc148c429 0x8d4c03ea 0x4807247c 116 0x400480
: 0x8d4cc429 0x0000d52c 0x89480000 0xc149c855 117 0x400490
; 0x8d4c03ef 0xe8072474 0xffffff94 0xc8558b48 118 0x4004a0
: 0x29058b480x49000002 0x4e03eec1 0x00fd248d 119 0x4004b0
: 0x4a000000 0x00f51c8d 0x31000000 0x048948ff 120 0x4004c0
: 0x000328d5 0x058b4800 0x0000020c 0xfd04894a 121 0x4004d0
: 0x00000328 0x3d748d49 0x0c8d4900 0x48c0313c 122 0x4004e0
: 0x0f3b148d0x0000441f 0x04100f66 0x100f6606 123 0x4004f0
: 0x0f66010c 0x110fc159 0x83480204 0x3d4810c0 124 0x400500
: 0x00000320 0x8148e275 0x000320c7 Oxff814800 125 0x400510
: 0x00013880 0x42f2be75 0xf504100f 0x00000328 126 0x400520
0x4006c2bf 0x0001b800 0x11e80000 0x48ffffff 127 0x400530
: 0x31d8658d0x5c415bc0 0x5e415d41 0xc35d5f41 128 (gdb) q 129 A debugging session is active. 130 131 132 133 Quit anvway? (y or n) v 0x0000000000400525 : mov 0x000000000040052a : callq 0x000000000040052t :xor 0x0000000000400535 : pop 0x0000000000400536 : pop 0x0000000000400538 : pop 0x000000000040053a : pop 0x000000000040053c : pop 0x000000000040053e : pop 0x000000000040053f : retq $0x1,seax 0x400440 -0x28(%rbp),%rsp %eax,%eax %rbs %r12 %r13 %r14 %r15 %rb Inferior 1 [process 12458] will be killed

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions