Question: help An ARC program calls the subroutine foo, passing it three arguments, a, b, and c. The subroutine has two local variables, m and n.

help



An ARC program calls the subroutine foo, passing it three arguments, a, b, and c. The subroutine has two local variables, m and n. Show the position of the stack pointer and the contents of the relevant stack elements for a stack based calling convention at the points in the program shown below. Note that subroutine foo does not return anything. (1) just before executing the call at label x; (2) when the stack frame for foo is completed; (3) just before executing theld at label z (.e., when the calling routine resumes). Use the stack notation shown in Figure 4-19. 1 Push the arguments a, b, and c call foo x: LOD:t Subroutine starts here Y: ml 1715. 3, 110 Figure 4-19 0- Bening ofta *** Sup - - way the Cling pa un til Lop 4 ta Afer the call, called routine PC a calling toli (15) sack Line of program) 0 Free uc Free 4 ri att kolla 4 D Copy funci return value biomack Line down 419 Sud bharler during sets of the suns la Figure 4-18. An ARC program calls the subroutine foo, passing it three arguments, a, b and c. The subroutine has two local variables, m and n. Show the position of the stack pointer and the contents of the relevant stack elements for a stack-based calling convention at the points in the program shown below. Note that subroutine foo does not return anything. Just before executing the call at label x b. When the stack frame for foo is completed c. Just before executing the ld at label z (.e. when the calling routine resumes) a. Use the stack notation shown in textbook Figure 4-27.(3 points) ! Push the arguments a, b and c X: call foo z : ld %ri, r2 foo: ! subroutine starts here y : jmpl fr15 + 4, $r0 Figure 4-19 0- Free area of stock Free area Free area frame Nap. LIS Stack Suck Suck Initial configuration wand z are already on the stack. (Line 00 of program) (b) Calling routine pushes arguments to stack, prior to iunccall (Line 03 of moram) (c) After the call, called routine saves PC or calling routine (8:15) onto stack (line 06 of program) 0- Suck frame for Frec area Free area Free area SP- Stack ap- Stack Stack 4 (d) 4 (e) 4 Stack space is reserved for Return value from Calling routine pops func_1 local variables : func_1 is placed on fune_l return value and Line 09 of stack, just prior to retum from stack (Line 03 of program) (line 12 of program) program) Fligare 4-19 (-1) Stadt behavior during execution of the program shown in Figure 4-18. An ARC program calls the subroutine foo, passing it three arguments, a, b, and c. The subroutine has two local variables, m and n. Show the position of the stack pointer and the contents of the relevant stack elements for a stack based calling convention at the points in the program shown below. Note that subroutine foo does not return anything. (1) just before executing the call at label x; (2) when the stack frame for foo is completed; (3) just before executing theld at label z (.e., when the calling routine resumes). Use the stack notation shown in Figure 4-19. 1 Push the arguments a, b, and c call foo x: LOD:t Subroutine starts here Y: ml 1715. 3, 110 Figure 4-19 0- Bening ofta *** Sup - - way the Cling pa un til Lop 4 ta Afer the call, called routine PC a calling toli (15) sack Line of program) 0 Free uc Free 4 ri att kolla 4 D Copy funci return value biomack Line down 419 Sud bharler during sets of the suns la Figure 4-18. An ARC program calls the subroutine foo, passing it three arguments, a, b and c. The subroutine has two local variables, m and n. Show the position of the stack pointer and the contents of the relevant stack elements for a stack-based calling convention at the points in the program shown below. Note that subroutine foo does not return anything. Just before executing the call at label x b. When the stack frame for foo is completed c. Just before executing the ld at label z (.e. when the calling routine resumes) a. Use the stack notation shown in textbook Figure 4-27.(3 points) ! Push the arguments a, b and c X: call foo z : ld %ri, r2 foo: ! subroutine starts here y : jmpl fr15 + 4, $r0 Figure 4-19 0- Free area of stock Free area Free area frame Nap. LIS Stack Suck Suck Initial configuration wand z are already on the stack. (Line 00 of program) (b) Calling routine pushes arguments to stack, prior to iunccall (Line 03 of moram) (c) After the call, called routine saves PC or calling routine (8:15) onto stack (line 06 of program) 0- Suck frame for Frec area Free area Free area SP- Stack ap- Stack Stack 4 (d) 4 (e) 4 Stack space is reserved for Return value from Calling routine pops func_1 local variables : func_1 is placed on fune_l return value and Line 09 of stack, just prior to retum from stack (Line 03 of program) (line 12 of program) program) Fligare 4-19 (-1) Stadt behavior during execution of the program shown in Figure 4-18
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
