C语言 | X86汇编代写 | AU 2018 LAB 6

本次CSE代写C语言和X86汇编要求学生在老师提供的c语言start code上寻找3个bug,fix这些所有bug,然后用X86汇编完成C代码文件的编译。

Objectives:

  • combining C language with assembler language programs
  • debugging existing C language code
  • first x86-64 experience
  • correctly using memory addressing in assembler
  • correctly using different size registers

 

REMINDERS and GRADING CRITERIA:

  • This is an individual lab. No partners are permitted
  • Every lab requires a Readme file (for this lab, it should be called lab6Readme – use this name, without an extension or any other modification). This file must include the following:
    • Disclaimer:

# BY SUBMITTING THIS FILE AS PART OF MY LAB ASSIGNMENT, I CERTIFY THAT

# ALL OF THE CONTENT OF THIS FILE WAS CREATED BY ME WITH NO

# ASSISTANCE FROM ANY PERSON OTHER THAN THE INSTRUCTOR OF THIS COURSE

# OR ONE OF OUR UNDERGRADUATE GRADERS.

  • 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 thelab
  • Describe how you used gdb to find a bug in C language program you were given while debugging it. Include how you set breakpoints, variables you printed out, what values they had, what you found that enabled you to fix the
  • Describe how you used gdb to find a bug in one of your x86-64
  • 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 (even by a minute

– or heaven forbid, less than a minute 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 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:

 

LAB DESCRIPTION

1.  Required file names: lab6main.c, lab6assem.s, Makefile. You do not have to create a .h file.

  1. You will be given a C programming language lab6main.c file that has 3 bugs in it. IT DOES NOT WORK CORRECTLY. You can fix the bugs by changing executable statements. You may not fix any of the bugs by changing a declaration
  2. The main() program accepts an indeterminate number of parameters from the command line. The minimum number of values is 1. These values should all be interpreted as signed
  3. main() determines how many integers are on the command line and then creates an appropriate sized dynamic array to hold
  4. main() passes the address to the array and a count to each of four assembler
  5. There are four functions that must be written in x86-64 assembler:
    • The Min() program must determine the minimum value in the array and then print out the line “The minimum value is .” The minimum value must be returned to main().
    • The Max() program must determine the maximum value in the array and then print out the line “The maximum value is .” The maximum value must be returned to main().
    • The Sum() program sums the values in the array and then print out the line “The sum of values is .” The sum must be returned to main().
    • The Sort() program sorts the array values in to ascending order changing their positon in the array so that the sorted order is retained. The Sort() program must print out each individual integer value on a separate line in sorted order. I suggest a simple bubble sort.
  1. Use a Makefile to create your lab6
    • To compile your .c file use gcc -g –ansi –pedantic -c c
    • To compile your .s file use gcc –g –lc –m64 –c s
    • Ignoring blank lines, your Makefile will have 9 lines. You should be able to use the Makefile you created for lab4 as a template

REQUIREMENTS

  1. You must use correct stack frame procedures
  2. You must use all (needful) x86-64 directives
  3. You must use the correct suffix for all data types.
  4. You must use correct memory addressing modes
  5. You must use correct caller/callee saved register
  6. You must comment your code!
  7. You may *not* use a temporary array or the stack to aid you in sorting the array into ascending order
  8. Your Makefile and the lab6assem.s files submitted to Carmen as a part of this program must

include the following at the top:

# BY SUBMITTING THIS FILE AS PART OF MY LAB ASSIGNMENT, I CERTIFY THAT

# ALL OF THE CONTENT OF THIS FILE WAS CREATED BY ME WITH NO

# ASSISTANCE FROM ANY PERSON OTHER THAN THE INSTRUCTOR OF THIS COURSE

# OR ONE OF OUR UNDERGRADUATE GRADERS.

HELPFUL SUGGESTIONS

  1. Don’t forget to use tui reg general when in gdb to see register
  2. You can use next in gdb when you want do not want to go in to the code of the function being called.
  3. You can use step in gdb when you want do want to go in to the code of the function being called.
  4. The gdb instruction x/2w $rdi would show you two (4-byte) words starting at the address in register rdi. Rather than $rdi, you can use a specific memory
  5. The general form of this instruction is: x/[NUM][SIZE][FORMAT] where NUM = number of objects to display

SIZE = size of each object (b=byte, h=half-word, w=word, g=giant (quad-word)) FORMAT = how to display each object (d=decimal, x=hex, o=octal, etc.)

If you don’t specify SIZE or FORMAT, either a default value, or the last value you specified in a previous ‘print’ or ‘x’ command is used.

  1. You can reference http://csapp.cs.cmu.edu/public/docs/gdbnotes-x86-64.pdf for several other very helpful gdb instructions for x86-64

LAB SUBMISSION

Always be sure your linux prompt reflects the correct directory or folder where all of your files to be submitted reside. If you are not in the directory with your files, the following will not work correctly.

You must submit all your lab assignments electronically to Carmen in .zip file format. The format of zip command is as follows:

[[email protected] lab6] $    zip <zip_filename> <files-to-submit>

where <zip_filename> is the name of the file you want zip to add all of your files to and <files-to- submit> is a list of the file(s) that make up the lab. Remember that you have to be at the correct location (the designated directory) for the command to be able to find your files- to-submit.

For lab6, the zip command would look like this:

[[email protected]fl1 lab6] $    zip lab6 lab6main.c lab6assem.s Makefile lab6Readme

Once you execute the command, you should find a file in your lab6 directory called lab6.zip; this is the file that must be put in Carmen.

 

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. She or he will always build/compile your code using gcc -ansi –pedantic -g, and run the executable generated by that command.
  • It is YOUR responsibility to make sure your code can compile and run on CSE department server 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!

程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论