Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this problem, consider following C code 0 uint64_t y 1 int main (int argc , char *argv[]) f uint64_t z = 5; my-funct(44); z+y
For this problem, consider following C code 0 uint64_t y 1 int main (int argc , char *argv[]) f uint64_t z = 5; my-funct(44); z+y ; = = 6 8 uint64t my_funct uint64_t x) { 10 12 return (x + my_funct (x>>2)) if(x=0) { return 0 13 1) What value is left in z at the end of main()? 2) Compile the function my_funct ) into LEGv8 assembly (do not compile main)). Be sure to use the calling conventions discussed in lecture and used in lab. Note, converting the function into a simple, non recursive loop will yield 0 points 3) Draw a small diagram of the application's memory map. On the diagram mark (approximately) where the following data and instructions would be located. Be sure to also label these regions of memory by their conventional names. Assume the compiler allocates memory for C variables y and z instead of optimizing to temporary registers or constants a) The application's instructions b) The variable "uint 64_t y". c) The variable "uint 64_t z". d) The return address back to the main () routine after my_funct () has been called 4) Assuming your function is called by main with an argument of x-9 (ie. my_funct (9)). Hovw many words are stored on the stack at its deepest point? Note, you do not have to account for ARMv8's stack pointer alignment requirement for this question 5) Draw a diagram showing the full contents of the stack at this point. Assume that the BL instruction is used to call my funct) from main) is at address 0x30100 and that my funct) starts at address Ox40000 in memory. You may also assume that the $SP register is set to 0xOFFF3000 when the BL instruction is called the first time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started