push and pop description in online manual

30 views
Skip to first unread message

Sohum Sohoni

unread,
Mar 27, 2014, 12:10:39 AM3/27/14
to progressive-le...@googlegroups.com
The manual currently lists that push translates to sw $rt, 0($sp); addiu $sp, $sp, -4, but in reality, what it does is addiu $sp, $sp, -4 sw $rt, 4($sp) as listed in the quick ref accompanying PLPTool. Same thing with pop, listed as addiu $sp, $sp, 4; lw $rt, 0($sp) in the manual, but implemented as lw $rt, 4($sp) addiu $sp, $sp, 4. This one's also correctly listed in the quick ref that you can pull up while using PLPTool.
Sohum

Wira Mulia

unread,
Apr 29, 2014, 3:13:45 PM4/29/14
to progressive-le...@googlegroups.com
The quickref is correct. The reason for the order of instructions is to make these pseudo instructions interrupt-safe. We need to reserve the space on stack first in the case of pushing just in case an interrupt is triggered in between so that the space doesn't get clobbered if the ISR uses the stack. For popping, we get the data off the stack first, because otherwise an ISR will assume that the space is safe to use if we increment the stack pointer before getting the data off and the interrupt happens in between the two operations.

Sohum Sohoni

unread,
Apr 29, 2014, 5:57:59 PM4/29/14
to progressive-le...@googlegroups.com
So should we update the manual then?


--
You received this message because you are subscribed to the Google Groups "progressive-learning-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to progressive-learning...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wira Mulia

unread,
Apr 29, 2014, 6:06:59 PM4/29/14
to progressive-le...@googlegroups.com
I fixed it. I also changed the notes for pop operation (we are not popping $rt from the stack, we are popping data from the top of the stack into $rt).
To unsubscribe from this group and stop receiving emails from it, send an email to progressive-learning-platform+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages