Question: Exercise 6 . 1 8 Consider the RISC - V assembly code below. func 1 , func 2 , and func 3 are nonleaf functions.

Exercise 6.18 Consider the RISC-V assembly code below. func1, func2, and func 3 are nonleaf functions. func 4 is a leaf function. The code is not shown for each function, but the comments indicate which registers are used within each function. You may assume that the functions do not need to save any nonpreserved registers on their stacks.
0x00091000 func1: ... func1 uses t2-t3, s4-s10
...
0x00091020 jal func2
...
0x00091100 func2: ... func2 uses a0-a2, s0-s5
..
0x0009117 jal func3
...
0x00091400 func3:... func3 uses t3, s7-s9
...
0x00091704 jal func4
...
0x00093008 func4:... func4 uses s10-s12
...
0x00093118 jr ra
(a) How many words are the stack frames of each function?
(b) Sketch the stack after func4 is called. Clearly indicate which registers are stored where on the stack and mark each of the stack frames. Give values where possible. Assume that sp=0ABC124 just before func1 is called.
 Exercise 6.18 Consider the RISC-V assembly code below. func1, func2, and

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!