* [musl] [PATCH v2] riscv64: Add vfork
@ 2023-02-09 16:34 Pedro Falcato
0 siblings, 0 replies; only message in thread
From: Pedro Falcato @ 2023-02-09 16:34 UTC (permalink / raw)
To: musl; +Cc: Pedro Falcato
Implement vfork() using clone(CLONE_VM | CLONE_VFORK | ...).
---
src/process/riscv64/vfork.s | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 src/process/riscv64/vfork.s
diff --git a/src/process/riscv64/vfork.s b/src/process/riscv64/vfork.s
new file mode 100644
index 00000000..c93dca23
--- /dev/null
+++ b/src/process/riscv64/vfork.s
@@ -0,0 +1,12 @@
+.global vfork
+.type vfork,@function
+vfork:
+ /* riscv does not have SYS_vfork, so we must use clone instead */
+ /* note: riscv's clone = clone(flags, sp, ptidptr, tls, ctidptr) */
+ li a7, 220
+ li a0, 0x100 | 0x4000 | 17 /* flags = CLONE_VM | CLONE_VFORK | SIGCHLD */
+ mv a1, sp
+ /* the other arguments are ignoreable */
+ ecall
+ .hidden __syscall_ret
+ j __syscall_ret
--
2.39.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-09 16:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 16:34 [musl] [PATCH v2] riscv64: Add vfork Pedro Falcato
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).