Please help with this MIPS assembly language question! Consider a code fragment
ID: 3791742 • Letter: P
Question
Please help with this MIPS assembly language question!
Consider a code fragment of the non-leaf function named_foo below: _foo: addi $sp, $sp -8 sw $ra, 0($sp) sw $s0, 4($sp) add $s0, $zero, $a0 add $s1, $zero, $a1: lw $ra, 0 ($sp) lw $s0, 4 ($sp) addi $sp, $sp, 8 jr $ra. Is there anything wrong with the above code? Nothing wrong with the above code fragment. The first line should be addi $sp, $sp, 8 and the second to last line should be addi $sp, $sp -8. $ra was restored from the wrong address. _foo is a callee. It uses $s1. Thus, it must back $s1 first.Explanation / Answer
ans) b
the first line should be addi $sp, $sp,8 and the ssecond to last line should be addi $sp, $sp,-8