$ra
is overwritten.
The stack-based subroutine linkage convention can be used to solve the problem.
The following picture shows the four sections of the stack-base subroutine linkage.
The basic tasks of each section are
|
$ra
if it was pushed in the prolog.
jr $ra
”