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, -16 sd s0, 0(sp) sd ra, 8(sp) addi s0, sp, 0
addi sp, s0, 0 ld ra, 8(sp) ld s0, 0(sp) addi sp, sp, 16 ret