Question: How to write a C callable assembler function that counts the number of characters in a string? the description: Write a C callable assembler function

How to write a C callable assembler function that counts the number of characters in a string? the description: How to write a C callable assembler function that counts the number

Write a C callable assembler function that counts the number of characters in a string. The function should work for any string and character. The address of the string and character to be counted are passed as arguments according to the C function prototype: int count (char *string, char c); Since there are arguments, your assembly function should use a stack frame. It should return the count to the calling C program in %eax. Use 32-bit quantities for all data, chars have only 8 significant bits but they are stored in memory (and on the stack) as 32 bits in "little endian" format. After moving a 32 bit char value from memory to a register, the char value is available in the 8 lsb's, e.g. %al. You are given a C calling program that calls count to count the number of a user entered character in a user entered string and prints the result. The C code "driver" is in countc.c. Put your assembly code in counts. Then build it using the same makefile by invoking "make A=count". In count.script, provide a script showing a run with a Tutor breakpoint set where the count is incremented, showing the count (in a register) each time the breakpoint is hit, just before the increment is made. In the script, show how you determined where to set the breakpoint, i.e., how you determined where the increment instruction is located in memory

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!