How does sbrk in MIPS properly get called

43 views Asked by At

I'm trying to learn MIPS and implement a dynamic memory allocation depending on the size of the number of values I need to store, so I'm using sbrk in my allocation of space. The problem arises that after calling 'syscall', the v0 register maintains the value of 9 instead of changing to be the address of the allocated space.

For testing purposes s1 is initilized to 64 for now, but in the working version of the code it can be any square number less than 900

li $t1, 4
mul $t0, $s1, $t1

move $a0, $t0
li $v0, 9
syscall
move $s5, $v0

I have tried moving around values, initilizing in different orders, and changing when syscall is used, however no matter what I try the value of v0 remains to be 9

0

There are 0 answers