Question: Consider the following code used to implement the instruction: foo $s0, $s1, $s2 mask: .word 0xfffff83f start: lw $t0,mask($zero) lw $s0,shifter($zero) and $s0,$s0,$t0 andi $s2,$s2,0x1f
Consider the following code used to implement the instruction: foo $s0, $s1, $s2
mask: .word 0xfffff83f
start: lw $t0,mask($zero)
lw $s0,shifter($zero)
and $s0,$s0,$t0
andi $s2,$s2,0x1f
sll $s2,$s2,6
or $s0,$s0,$s2
sw $s0, shifter($zero)
shifter:sll $s0,$s1,0
Describe how it works. Why do you suppose that writing "self-modifying code" such as this is a bad idea (and often times not actually allowed)?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
