Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#3544 RV64: Implemented dynamorio-clone #6063

Merged
merged 7 commits into from
May 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions core/arch/riscv64/riscv64.asm
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,32 @@ GLOBAL_LABEL(_dynamorio_runtime_resolve:)
*/
DECLARE_FUNC(dynamorio_clone)
GLOBAL_LABEL(dynamorio_clone:)
/* FIXME i#3544: Not implemented */
addi ARG2, ARG2, -16 /* Description: newsp = newsp - 16. */
sd ARG6, 0 (ARG2) /* The func is now on TOS of newsp. */
li SYSNUM_REG, SYS_clone /* All args are already in syscall registers.*/
ecall
bnez ARG1, dynamorio_clone_parent
ld ARG1, 0 (sp)
addi sp, sp, 16
jalr ARG1
jal GLOBAL_REF(unexpected_return)
dynamorio_clone_parent:
ret
END_FUNC(dynamorio_clone)

DECLARE_FUNC(dynamorio_sigreturn)
GLOBAL_LABEL(dynamorio_sigreturn:)
li SYSNUM_REG, SYS_rt_sigreturn
li SYSNUM_REG, SYS_rt_sigreturn
ecall
jal GLOBAL_REF(unexpected_return)
jal GLOBAL_REF(unexpected_return)
END_FUNC(dynamorio_sigreturn)

DECLARE_FUNC(dynamorio_sys_exit)
GLOBAL_LABEL(dynamorio_sys_exit:)
li a0, 0 /* exit code */
li SYSNUM_REG, SYS_exit /* SYS_exit number */
li a0, 0 /* exit code */
li SYSNUM_REG, SYS_exit
ecall
jal GLOBAL_REF(unexpected_return)
jal GLOBAL_REF(unexpected_return)
END_FUNC(dynamorio_sys_exit)

# ifndef NOT_DYNAMORIO_CORE_PROPER
Expand All @@ -290,7 +299,7 @@ GLOBAL_LABEL(dynamorio_sys_exit:)
# endif
DECLARE_FUNC(main_signal_handler)
GLOBAL_LABEL(main_signal_handler:)
mv ARG4, sp /* pass as extra arg */
mv ARG4, sp /* pass as extra arg */
j GLOBAL_REF(main_signal_handler_C) /* chain call */
END_FUNC(main_signal_handler)

Expand Down