HW3 Analyzing assembly and machine code 25 pts

HW3 Analyzing assembly and machine code 25 pts Using the program matmul2.c from here or Downloadable source:
cp /afs/umbc.edu/users/s/q/squire/pub/download/matmul2.c . # the dot is part of the command

On a GL Linux machine, linux.gl.umbc.edu only, (IRIX is gone)
GL screwed up gdb, now use /usr/local/bin/gcc
and /usr/local/bin/gdb
else fmull becomes mulsd

Note: The answers may not be unique. It depends on which
compiler is used, which specific machine is used and
which options are used.


This assignment must be run on linux.gl.umbc.edu machine using:
/usr/local/bin/gcc -S -O3 matmul2.c
/usr/local/bin/gcc -g3 -O3 matmul2.c
^_____ letter upper case oh, NOT zero !

--------------------------------------------------------------------

for getting assembly language source code to a file matmul2.s

/usr/local/bin/gcc -S -O3 matmul2.c (creates matmul2.s)

Now, look in the file matmul2.s
Ignore all lines where the first character is a dot "."


When running with redirection, "", first test without redirection
to be sure you can type the correct input and it works. Then
type carefully or use a script to make the redirected run.
Extra "enter" keys may be needed at various places.

In hex.out use an address to relate to memory to find the same word.
Ignore information and error messages. Type very carefully!

/usr/local/bin/gcc -g3 -O3 matmul2.c # compile and link, creates file a.out

Test first without redirection to hex.out

/usr/local/bin/gdb a.out
list 1,26
# press enter
break main
run
disassemble
# press enter
# press enter
x/60x main
q
y

Now make the file hex.out you will turn in as homework:

/usr/local/bin/gdb a.out hex.out
list 1,26
break main
run
disassemble
x/60x main
q
y


Read the hex dump as big endian, like the MIPS architecture,
rather than little endian like the X86 architecture, answer
in 32 bit = 4 byte results, two hex digits per byte.

The file hex.out has the source listing with line numbers,
the hex address and hex instructions as loaded in memory and
the disassembly with hex address and decoded instruction.

Most of the instruction in the loop are "housekeeping", there are various
instructions for loading and storing data.



Powered by