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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!