CSE 2421 LAB 6: C and Assembly Mixed Code

部署运行你感兴趣的模型镜像

加我微信或好久
本人有三年程序代写经验,写过近 800 个项目,所有代码均为 100%原创。以前给中介代写,现在本人自己接单,不是中介。代写语言包括 C++、C、Python、Java、JavaScript、Go、C#、Ruby、Haskell、Ocaml、Scala、Scheme、F#、Racket、Prolog、Clojure、Matlab、MIPS汇编、x86汇编、arm汇编、RISC-V汇编,LC3汇编,Hack汇编等各种语言编程项目。iOS、安卓app、编译器、编译原理、操作系统。英文要求无障碍。经验丰富,保证原创,亲自编写,不是中介。网上很多都是中介,本人曾长期跟他们打交道。
注意:不接毕业设计、毕业论文等。请直接私信我发具体需求及截止时间。主要接英文需求。中介勿扰。扫码加我微信或好友,发送详细需求。

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 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, with either a .pdf or .doc or .docx extension so Carmen will accept it.). This file must include the following:

  • Disclaimer:
    THIS IS THE README FILE FOR LAB 6. BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I HAVE PERFORMED ALL OF THE WORK TO DETERMINE THE ANSWERS FOUND WITHIN THIS FILE MYSELF WITH NO ASSISTANCE FROM ANY PERSON OTHER THAN THE INSTRUCTOR OF THIS COURSE OR ONE OF OUR UNDERGRADUATE GRADERS. . I UNDERSTAND THAT TO DO OTHERWISE IS A VIOLATION OF OHIO STATE UNIVERSITY’S ACADEMIC INTEGRITY POLICY.
  • 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 (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 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: lab6main.c, lab6.s, Makefile. You do not have to create a .h file.
  2. Create your lab6main.c file by copying your file, then make the following changes:
    a.insert a prototype before main() that looks like this:
    long sum( long a [], int count);  
    
    b.use the given main.c code to call the sum function.
    c.Create (or update the existing lab6.s) so that sum function return the sum of the array. The sum function must be written in Assembly.
  3. The output of your program should print the sum of the array
  4. You must create a Makefile where all will have 2 targets: lab6 and lab6.zip.
    In lab6.zip you include lab6main.c, lab6.s, and the Makefile.
  5. You can compile the code as follows:
    gcc lab6.s lab6main.c -no-pie -o lab6
    
    or
    gcc lab6.s lab6main.c -o lab6
    

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 conventions
  6. You must include the certification header in your lab6.s file (it should already be in your lab6main.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 in to the code of the function being called.
  4. The gdb instruction x/12xb $rdi would show you twelve 1-byte values starting at the address in register rdi. Rather than $rdi, you can use a specific memory address.
  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.
  6. 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.
  7. You may inspire from the code in the slides about the sum function. Notice that in the slides, the sum function only calculate the sum. In this lab the sum function print strings and also calculates the sum.

LAB SUBMISSION

You must submit all your lab assignments electronically to Carmen in .zip file format.

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!

HOW YOUR LAB WILL BE GRADED

Your lab will be tested in two distinct ways. Your code must work in both ways to receive points.

  1. Your lab6main.c/lab6.s code combination will be tested using the make command. So go back and review the spreadsheet for that lab.
  2. Your lab6.s file will be used as a library function and called by a standard version of the lab6main.c program. As long as you follow the System V ABI standards and have your parameters in the correct order, all should be good.

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值