Knowee
Questions
Features
Study Tools

ssume that a suitable stack frame has already been created, and you are preparing to call another subroutine. Which WRAMP assembly instruction would place the first parameter onto the stack?Question 4Select one:a.push $1b.sw $sp, 0($1)c.push $spd.sw $1, 0($sp)

Question

ssume that a suitable stack frame has already been created, and you are preparing to call another subroutine. Which WRAMP assembly instruction would place the first parameter onto the stack?Question 4Select one:a.push 1b.sw1b.sw sp, 0(1)c.push1)c.push spd.sw 1,0(1, 0(sp)

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct answer is d. sw 1,0(1, 0(sp). This WRAMP assembly instruction will store the value in register 1atthememorylocationpointedtobythestackpointer(1 at the memory location pointed to by the stack pointer (sp). This is how you would typically place a parameter onto the stack before a subroutine call.

Similar Questions

If you are in a subroutine and have just created a stack frame with space for three words, how would you load that subroutine's first parameter into register $1?Question 8Select one:a.sw $1, 3($sp)b.pop $1c.lw $1, 3($sp)d.lw $1, 0($sp)

If a WRAMP subroutine takes three parameters, what will the stack pointer be pointing at when that subroutine is first entered (i.e. before any instructions have been executed)?Question 11Select one:a.The first parameter.b.The last (third) parameter.c.The return address.d.The first instruction.

Is it possible for a subroutine to comply with the WRAMP ABI conventions without decrementing/incrementing the stack pointer $sp at all?Question 3Select one:a.No.b.Yes, provided that it only modifies registers that are not being used elsewhere in the program.c.Yes, but it would have to return immediately without executing any instructions other than "jr $ra".d.Yes, provided that it does not modify any registers except $1, and does not call further subroutines.

For an assembler implementation of the routine that is written according to the WRAMPApplication Binary Interface (ABI):int max(int a, int b)that returns the maximum value stored in parameters a and b and uses the general purposeregisters $3 and $4 to determine that answer, but makes no further subroutine calls itself,fill out the diagram below showing the state of the stack-frame just before calling max()where parameter a is value 1, parameter b is value 2, register $3 has value 3 and register $4has value 4. Note, not all of these values are necessarily on the stack when max() is called.(2 marks)+0+1+2+3+412

What do WRAMP subroutines use the system stack for?Question 14Select one:a.Saving/restoring register values, passing parameters to other subroutines, and storing all local variables.b.Passing parameters to other subroutines, saving/restoring registers, and returning values to the caller.c.Saving/restoring register values, passing parameters to other subroutines, and storing any local variables that don't fit into registers.d.A general area of memory for storing data.

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.