【发布时间】:2013-11-01 23:32:50
【问题描述】:
我在组装 MIPS 中搞乱堆栈推送和弹出。我只能通过更改指针的索引手动从堆栈$sp 中弹出数据,但是如何使用循环来做到这一点?
例子:
lw $t1, 0($sp) ## pops the first data at index 0
lw $t1, 4($sp) ## pops the second data at index 4
lw $t1, 8($sp) ## pops the third data at index 8
addui $sp, $sp, 12 ## Lets free our stack
现在我的问题是,如何循环执行此操作?如果我使用以下
addui $sp, $sp, 4 这意味着在我们的堆栈中释放 1 个空间。这并不意味着将堆栈指针递增到下一个索引。
我希望你们能明白我在这里想说的话。
我认为这里不允许使用 $t2 lw $t1, $t2($sp)
【问题讨论】:
-
我不明白这个问题。首先,那些
lws 不会“弹出”堆栈,它们从堆栈中加载