Question: Overview Practice calling C functions from x86_64 assembly code AND x86_64 assembly functions from C code. Refer to the lecture slides and x86_64 documentation. Procedure

Overview

Practice calling C functions from x86_64 assembly code AND x86_64 assembly functions from C code. Refer to the lecture slides and x86_64 documentation.

Procedure

  1. Create an assembly program (asm_program.asm) which calls a C function (c_function.c).
    • Your C function should take one argument [a pointer to a character string] and print it (eg. printstring(const char* mystring)).
    • Your assembly program should call the C function to print out a haiku (classic or self-authored) of your choosing, and the author's name.
    • Your haiku should be declared and defined in asm_program.asm [NOT in c_function.c].
    • Compile and link your code to make an executable (asm_program).
  2. Create a C program (c_program.c) which calls an assembly function (asm_function.asm).
    • Your assembly function should take one argument [a pointer to a character string] and print it.
    • Your C program should call the assembly function to print out a haiku (classic or self-authored) of your choosing, and the author's name.
    • Your haiku should be declared and defined in c_program.c [NOT in asm_function.asm].
    • Compile and link your code to make an executable (c_program).
  3. Additional Information
    • Use insightful comments in the code to illustrate what is happening on each step.
    • Include a header in each source code file with the relevant information for assignments as defined in the syllabus.
    • Read the submission requirements in the syllabus and above/below instructions carefully before submitting your work for grading.

Requirements

  • As always, all requirements from the course and lab syllabus apply.
  • Submit all requested files (listed below) as a single ZIP archive.
  • Make sure your file names match exactly with the requested file names.
  • A zipped file containing:
    • asm_program.asm
    • asm_function.asm
    • c_program.c
    • c_function.c
    • asm_program
    • c_program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!