diff --git a/tests/jalr.s b/tests/jalr.s index 48f743c..8a7564f 100644 --- a/tests/jalr.s +++ b/tests/jalr.s @@ -12,17 +12,19 @@ _start: # Try to call two imbricated functions jal fn0 + # Jump to 'just_after' auipc ra, 0 - jalr 12(ra) + jalr 16(ra) + + # Jump far to test jalr with negative offset + jal fnfar ebreak -# just_after : address is 12 bytes after auipc +# just_after : address is 16 bytes after auipc just_after: # ra must still be the old address - addi a0, zero, 0 ret - addi a0, zero, 1 ebreak # fn0 : function that calls fn1 and returns @@ -46,3 +48,12 @@ fn0: fn1: ret ebreak + +fnneg: + addi a0, zero, 0 + ebreak + +fnfar: + auipc ra, 0 + jalr -8(ra) + ebreak