Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Architecture Problems f1.The stack is used to store certain values that are needed by procedures/functions when they are called by the main procedure/function or

Computer Architecture Problems

f1.The stack is used to store certain values that are needed by procedures/functions when they are called by the main procedure/function or by other procedures/functions. List all of these values placed on the stack.

2.MIPS assembly procedures/functions always have a syntax where the name of the procedure/function is represented in the code in a particular way. In a few words, explain how the name of the procedure/function is represented and where the name occurs in the assembly language instructions that perform the procedure's logic.

image text in transcribed

image text in transcribed

(6) In the diagram of the stack given below, the stack is shown to be using two registers. One register is the stack pointer and the other register is the frame pointer. The frame pointer contains the address of where all of the saved register values of a procedure are kept. The frame pointer also marks the beginning of the stack frame. Answer the following a) from class notes, briefly state what the stack frame is and what its purpose is on the stack: b) from the diagram, state whether the stack frame contents have memory address values that are higher than the contents of the stack pointer or lower than the contents of the stack pointer c) if multiple procedures/functions are used in a program, multiple stack frames will exist on a stack Suppose there are 3 procedures/functions used in a program. Suppose also procedure 1 calls procedure 2, and procedure 2 calls procedure 3. Based on the diagram, state which one of these procedures will have the stack frame highest value memory address on the stack: procedure 1, procedure 2, or procedure 3. Additionally state which one of these procedures will have the stack frame lowest value memory address on the stack: procedure 1, procedure 2, or procedure 3 Procedure with highest value on stack Procedure with lowest value on stack: A.6 Procedure Call Convention Higher memory addresses Argument 6 Argument 5 Saved registers Stack grows Local variables Lower memory addresses FIGURE A.6.2 Layout of a stack frame. The frame pointer (fp) points to the first word in the currently executing procedures stack frame. The stack pointer ( sp) points to the last word of the frame. The first four arguments are passed in registers, so the fifth argument is the first one stored on the stack. (6) In the diagram of the stack given below, the stack is shown to be using two registers. One register is the stack pointer and the other register is the frame pointer. The frame pointer contains the address of where all of the saved register values of a procedure are kept. The frame pointer also marks the beginning of the stack frame. Answer the following a) from class notes, briefly state what the stack frame is and what its purpose is on the stack: b) from the diagram, state whether the stack frame contents have memory address values that are higher than the contents of the stack pointer or lower than the contents of the stack pointer c) if multiple procedures/functions are used in a program, multiple stack frames will exist on a stack Suppose there are 3 procedures/functions used in a program. Suppose also procedure 1 calls procedure 2, and procedure 2 calls procedure 3. Based on the diagram, state which one of these procedures will have the stack frame highest value memory address on the stack: procedure 1, procedure 2, or procedure 3. Additionally state which one of these procedures will have the stack frame lowest value memory address on the stack: procedure 1, procedure 2, or procedure 3 Procedure with highest value on stack Procedure with lowest value on stack: A.6 Procedure Call Convention Higher memory addresses Argument 6 Argument 5 Saved registers Stack grows Local variables Lower memory addresses FIGURE A.6.2 Layout of a stack frame. The frame pointer (fp) points to the first word in the currently executing procedures stack frame. The stack pointer ( sp) points to the last word of the frame. The first four arguments are passed in registers, so the fifth argument is the first one stored on the stack

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions