BLUE = 0xb100b100 YELLOW = 0x7e111100 RED = 0x7ed7eddd main: # Set up the original register values li $s0, BLUE li $s1, YELLOW li $s2, RED jal bar jr $ra ######################################################### bar: # this function wants to use $s0, $s1, $s2 # what do we need to do here? bar__prologue: push $s0 push $s1 push $s2 # push $s2 is equivalent to: # addi $sp, $sp, -4 # sw $s2, ($sp) bar__body: # here is bar using those registers! li $s0, 0xcafef00d li $s1, 0xcafebeef li $s2, 0xbeeff00d bar__epilogue: pop $s2 #lw $s2, ($sp) #addi $sp, 4 # $sp += 4 pop $s1 pop $s0 jr $ra