Skip to content

Commit

Permalink
i#3544: RV64: Port test common.getretaddr to RV64 (#7169)
Browse files Browse the repository at this point in the history
Port assembly in common/getretaddr.c to riscv64 and implements
tailcall_with_retaddr().

Issue: #3544
  • Loading branch information
ziyao233 authored Dec 31, 2024
1 parent 3a84980 commit 8bb7af5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions suite/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6426,6 +6426,7 @@ if (RISCV64)
code_api|client.unregister
code_api|common.broadfun
code_api|common.hello
code_api|common.getretaddr
code_api|libutil.drconfig_test
code_api|libutil.frontend_test
# TODO i#3544: code_api|linux.eintr failed under QEMU
Expand Down
9 changes: 6 additions & 3 deletions suite/tests/common/getretaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ GLOBAL_LABEL(FUNCNAME:)
ldr x30, [sp], #16
ret
# elif defined(RISCV64)
/* TODO i#3544: Port tests to RISC-V 64 */
ret
mv t0, ra
call next_instr
next_instr:
mv a0, ra
jr t0
# else
# error NYI
# endif
Expand All @@ -134,7 +137,7 @@ GLOBAL_LABEL(FUNCNAME:)
ldr x0, [x29, #8]
ret
# elif defined(RISCV64)
/* TODO i#3544: Port tests to RISC-V 64 */
ld a0, -8(fp)
ret
# else
# error NYI
Expand Down
5 changes: 3 additions & 2 deletions suite/tests/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,9 @@ GLOBAL_LABEL(FUNCNAME:)
mov x0, x30 /* Replace first argument with return address. */
br x9 /* Tailcall to function pointer. */
#elif defined(RISCV64)
/* TODO i#3544: Port tests to RISC-V64 */
ret
mv t0, a0 /* Move function pointer to scratch register. */
mv a0, ra /* Replace first argument with return address. */
jr t0 /* Tailcall to function pointer. */
#else
# error NYI
#endif
Expand Down

0 comments on commit 8bb7af5

Please sign in to comment.