” 辅导CSE 2421程序语言、 写作c/c++SU 2021 CSE 2421 LAB 6: Lab 2 RevisitedAssigned: Tuesday, July 13thEarly Due Date: Sunday, July 18th by noonDue: Monday, July 19th, 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 registersREMINDERS 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 deadlineextensions for this lab. Plan accordingly.Every lab requires a Readme file (for this lab, it should be called lab6Readme use only thisname.). This file must be a simple text file created on stdlinux that includes the following:Disclaimer:BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I STRICTLY ADHERED TO THETENURES OF THE OHIO STATE UNIVERSITYS ACADEMIC INTEGRITY POLICY.THIS IS THE README FILE FOR LAB 6.Your nameTotal amount of time (effort) it took for you to complete the labShort description of any concerns, interesting problems or discoveries encountered, orcomments in general about the contents of the labDescribe how you Used gdb to find work with your C language program if there wereany. 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 programs. Include detailswith respect to what breakpoints you set what registers you looked at and how youdetermined what the bug was.Did you have to jump between your C language/x86-64 language programs to fix anybugs?You should aim to always hand an assignment in on time or early. If you are late, you will receive75% of your earned points for the designated grade if the assignment is submitted by 11:30 pm thefollowing day, based on the due date given above. If you are more than 24 hours late, you willreceive 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 segfaults or exhibit any other major OS errors/faults WILL RECEIVE AN AUTOMATIC GRADE OFZERO. No exceptions will be made for this rule – to achieve even a single point on a lab, your codemust minimally build (compile to an executable) on stdlinux and execute on stdlinux without hanging orcrashing, using the following Command: make. A seg fault is considered crashing.LAB DESCRIPTION1. You will be rewriting lab2 from earlier in the semester. Required file names: bit_encode.c (this filewill be supplied on Piazza no later than 7/14/21 @4PM), create_key.s, rotate_right.s, rotate_left.s,C2_SMag.s, Makefile. The file create_key.s will contain only a function called create_key(); the filerotate_right.s will contain only a function called rotate_right(); and the file rotate_left.s will containonly a function called rotate_left().2. There is on difference between this lab and lab2: the output will be printing two hex digitsrepresenting values in Sign Magnitude rather than in 2s complement. Remember binaryrepresentations for positive values are the same no matter the representation. Only negative valueschange the binary representation.3. The function unsigned int create_key() is an x86-64 function that must:a. prompt for (using the printf() function) andb. read in each of the 4 digits of the key (using the getchar() function) andc. return the 8-bit key to the calling function.d. You must create the 8-bit key from those 4 digits using ONLY the bitwise ORinstruction or ONLY the bitwise OR instruction and a shift instruction. Forexample, if the user specifies 0110, then your internal key must be 0110 0110.Using any other operations to create the key will result in a 50-point reduction inyour score for this lab.4. The function unsigned_char rotate_right(unsigned char x) and the functionunsigned char rotate_left(unsigned char x) are also x86-64 functions that must bepassed a single hexadecimal value and return to the calling function that valuerotated 1 position right or left, respectively.5. C2_SMag.s should contain a function unsigned char C2_SMag(unsigned char c)that converts a twos complement binary value to Signed Magnitude.6. I will supply a bit_encode.c file from with main() from which the other functions will be called.7. The output of your program should be exactly as described in lab 2 for bit_encode1.8. You must create a Makefile where all will have 2 targets: bit_encode and lab6.zip.REQUIREMENTS1. 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 x86-64 constructswill invalidate your lab submission.2. You must use correct stack frame procedures and conventions.3. No values in the x86-64 functions of your program may store values on the stack other than withpush/pop.4. You may declare variables in the main() function of your program that are stored on the stack.5. You must use all (needful) x86-64 directives.6. You must use the correct suffix for all data types (instructions and register sizes).7. You must use 4-byte registers for the return value from getchar(), all create_key() computationsand the value create_key returns to main()8. You must use 1-byte registers for all rotate_left(), rotate_right(), and C2_SMag() computationsand parameter passing.9. You must use correct caller/callee saved register conventions.10. You must call printf() once to prompt for the 4-bit key and getchar() for each bit of the key (i.e.,4 times) within your assembler Program. You can do this with 4 separate calls to getchar() oryou can get some practice at creating a loop. These C-library function calls MUST be madewithin your create_key() x86-64 function.11. You must include the certification header in your .s files12. You must comment your code!请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。