sp
contains the stack pointer,fp
(s0
) contains the frame pointer,ra
contains the return address,a0
to a7
are used to pass the first 8 arguments to a subroutine.a0
to a1
are used to subroutine return values.ra
onto the stack,fp
onto the stack, thensp
into fp
.addi sp, sp, -8 sw s0, 0(sp) sw ra, 4(sp) addi s0, sp, 0
addi sp, s0, 0 lw ra, 4(sp) lw s0, 0(sp) addi sp, sp, 8 ret