Problem Set 1 is due Tuesday 1/30 at 05:59:59 PM in the master branch. Only one
person per group should have a partners.txt
with all the netids of your partners on separate lines.
For this PS, form a group of at least four students. There is no cap on the maximum number of collaborators in the same group.
An example partners.txt
would look like this if elihf2
was submitting the group's solution.
elihf2
linghao3
yuey10
zhongbo2
yuezel2
dcaglar2
Note that if your netid is part of more than one partners.txt
, you will recieve a 0 for the problem set.
You can attempt this problem set on the Class VM (devel) or on any EWS Linux computer.
Please write the command(s) you should use to achieve the following tasks in GDB.
- Show the value of variable "test" in hex format.
- Show the top four bytes on your stack word-by-word, e.g. it should look something like this "0x0102 0x0304", NOT "0x01020304".
- Check all register values.
- Set a breakpoint at "ece.c" line 391.
- Connect to the test_(no)debug vm in the lab setup.
Please write your solution in p1_soln.txt with answers to each question on a separate line. For example, your p1_soln.txt should be of the form
answer 1
answer 2
...
answer 5
Write x86 assembly code for the body of the binarysearch
function found in binarysearch.c
. Make sure to set up and tear down the stack frame as well as save and restore any callee/caller-saved registers yourself (if you use them). Assume caller-saved registers are saved prior to the binarysearch_asm
function being called for the first time. Include comments (but don't overdo it!) in your assembly code to show the correspondence between the C code and your x86 code.
Also note that:
- The
binarysearch_asm
function inbinarysearch_asm.S
is partially filled out for you, your job is to complete the function. - Please make sure your code and comments are easy to read. We reserve the right to take points off if your answer is too hard to follow.
- You must synthesize your answer without the help of a computer. For example, you may not write the C code and then use the compiler to disassemble it. If you are caught doing this, you will receive a 0.
- You must translate your code, a functionally equivalent algorithm with a different structure will recieve a 0.
- You must write your solution in
p2/binarysearch_asm.S
and submit it through gitlab.
To build the code (no debug flag):
$ make clean && make
To run the code:
$ ./binarysearch ./input_small.txt
To build the code (debug flag):
$ make clean && make debug
To run the code (debug):
$ gdb --args ./binarysearch ./input_small.txt
Write a C function equivalent to the x86 assembly function, mystery_asm
found in mystery_asm.S
.
- Please make sure your code and comments are easy to read. We reserve the right to take points off if your answer is too hard to follow.
- You must translate your code, a functionally equivalent algorithm with a different structure will recieve a 0.
- You must write your solution in
p3/mystery.c
and submit it through gitlab.
To build the code (no debug flag):
$ make clean && make
To run the code:
$ ./mystery ./input_1.txt
To build the code (debug flag):
$ make clean && make debug
To run the code (debug):
$ gdb --args ./mystery ./input_1.txt