2

I am new to assembly and I saw the following line of code

ret

What does it do? I looked in my RiscV Green Card but didn't find it. Is it like j, does it store or load any data?

Oleg
  • 31
  • 1
  • 2

1 Answers1

7

It is a pseudo instruction. It is eqvivalent to jalr x0, x1, 0. x1 holds the return address. Effectively jumping to the return address.

For more info on JALR see page 16 here.

Eraklon
  • 4,206
  • 2
  • 13
  • 29