Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly what is ret?

Tags:

assembly

riscv

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?

like image 799
Oleg Avatar asked Oct 20 '25 11:10

Oleg


1 Answers

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.

like image 178
Eraklon Avatar answered Oct 22 '25 04:10

Eraklon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!