0
我想调用一个函数,但由于某些原因,现在允许使用指令 jal
。有没有办法做到这一点?MIPS汇编语言 - 在不使用'jal'的情况下调用函数
一个想法我是为了某种方式得到程序计数器的值$ra
,然后只用j function
,所以像这样
# somehow $ra = address of next instruction
addi $ra, $ra, 8 # word length is 32 bytes so $ra gets the address of
# the next instruction after 'j function'
j function
# continue here after function ends
function:
# do stuff
jr $ra
感谢
或者用目标地址加载一个寄存器并使用'jalr'。对教学使用不合理限制的人至少应该是彻底的。 – EOF