Microsoft Word – AU 2021 CSE 2421 Lab6
AU 2021 CSE 2421 LAB 6: The Ghost of Lab 2
Assigned: Thursday, October 28th
Early Due Date: Tuesday, November 9th by noon
Due: Wednesday 10th, by 11:30 p.m.
IMPORTANT: READ THESE INSTRUCTIONS AND FOLLOW THEM CAREFULLY.
Objectives:
– combining C language with assembler language programs
– debugging and extending existing C language code
– first x86-64 coding experience
– correctly using different size registers
REMINDERS and GRADING CRITERIA:
This is an individual lab. No partners are permitted.
This is your first attempt as programming in x86-64. Start now! There will be no deadline
extensions for this lab. Plan accordingly.
Every lab requires a Readme file (for this lab, it should be called lab6Readme – use this name,
with either a .pdf or .doc or .docx extension so Carmen will accept it.). This file must include
the following:
∙ Disclaimer:
BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I STRICTLY ADHERED TO THE
TENURES OF THE OHIO STATE UNIVERSITY’S ACADEMIC INTEGRITY POLICY.
THIS IS THE README FILE FOR LAB 6.
∙ Your name
∙ Total amount of time (effort) it took for you to complete the lab
∙ Short description of any concerns, interesting problems or discoveries encountered, or
comments in general about the contents of the lab
∙ Describe how you used gdb to find work with your C language program if there were
any. Include how you set breakpoints, variables you printed out, what values they had,
what you found.
∙ Describe how you used gdb to find a bug in your x86-64 program.
∙ Did you have to jump between your C language/x86-64 language programs to fix any
bugs?
You should aim to always hand an assignment in on time or early. If you are late, you will receive
75% of your earned points for the designated grade as long as the assignment is submitted by 11:30
pm the following day, based on the due date given above. If you are more than 24 hours late, you
will receive a zero for the assignment and your assignment will not be graded at all.
Any lab submitted that does not compile/make – without errors or warnings – and run without seg
faults or exhibit any other major OS errors/faults WILL RECEIVE AN AUTOMATIC GRADE OF
ZERO. No exceptions will be made for this rule – to achieve even a single point on a lab, your code
must minimally build (compile to an executable) on stdlinux and execute on stdlinux without crashing,
using the following command: make
LAB DESCRIPTION
1. Required file names: convert.c, get_int.s, get_float.s, get_fractional.s, print_bits.s,
print_bits_f.s, Makefile.
2. Remove all functions from the convert.c file that you used for lab 2 except for your main() function.
3. You can remove the #ifdef PROMPT/#endif statements if you wish. If you do not remove them, then
your Makefile must correctly compile your code so that prompts appear.
4. You must re-write all of the other functions you used in lab 2 as x86-64 functions.
5. The output of your program should be exactly as described in lab 2 for convert2.
6. You must create a Makefile where all will have 2 targets: lab6 and lab6.zip.
REQUIREMENTS
1. You may only use x86-64 constructs that we have discussed in class, you can find in the slides,
or you can find in the sample x86-64 programs posted on Piazza. Any other constructs will
invalidate your lab submission.
2. You must use correct stack frame procedures
3. You must use all (needful) x86-64 directives
4. You must use the correct suffix for all data types (instructions and register sizes).
5. You must use correct caller/callee saved register conventions
6. You must include the certification header in your x86-64 program files (it should already be in
your convert.c file).
7. You must comment your code!
HELPFUL SUGGESTIONS
1. Don’t forget to use tui reg general when in gdb to see register values.
2. You can use next in gdb when you want do not want to go in to the code of the function being
called (printf, for example).
3. You can use step in gdb when you want do want to go into the code of the function being called.
4. You can reference http://csapp.cs.cmu.edu/public/docs/gdbnotes-x86-64.pdf for several other
very helpful gdb instructions for x86-64 use.
LAB SUBMISSION
You must submit all your lab assignments electronically to Carmen in .zip file format. You must create
your zip file from within your Makefile.
I highly recommend testing your .zip submission you’ve created with the procedures supplied in the Lab
1 Description Document under the title of TEST TO CONFIRM THAT YOUR .zip FILE HAS
EVERYTHING IT NEEDS.
NOTE:
• Your programs MUST be submitted in source code form. Make sure that you zip all the
required files for the current lab (and .h files when necessary), and any other files specified in
the assignment description. Do NOT submit the object files (.o) and/or the executable. The
grader will not use executables that you submit anyway.
• It is YOUR responsibility to make sure your code can compile and run on CSE
department server stdlinux.cse.ohio-state.edu, without generating any errors or
warnings or segmentation faults, etc. Any program that generates errors or warnings
when compile or does not run without system errors will receive 0 points. No
exceptions!