Added negative offset case for JALR

master
vhaudiquet 12 months ago
parent 1c1b6a7ac0
commit a62148255e
  1. 19
      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

Loading…
Cancel
Save