Return address save/restore logic is broken
tansly opened this issue · 2 comments
tansly commented
Return address save/restore logic is broken
tansly commented
Return address gets overwritten
tansly commented
Redesign the mechanism:
Treat $ra
as a caller saved register. Caller saves it when making a call, restores it when the callee returns. Thus $ra
will hold the return address while a function is running.
This way we won't need to save it at every label (thus get rid of the dirty hack) and don't need to restore at return
statements.