Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230103152102.21858-1-pedro.falcato@gmail.com>
Date: Tue,  3 Jan 2023 15:21:02 +0000
From: Pedro Falcato <pedro.falcato@...il.com>
To: musl@...ts.openwall.com
Cc: Pedro Falcato <pedro.falcato@...il.com>
Subject: [PATCH] riscv64: Add vfork

Implement vfork() using clone(CLONE_VM | CLONE_VFORK | ...).
---
 src/process/riscv64/vfork.s | 11 +++++++++++
 1 file changed, 11 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..2f90329d
--- /dev/null
+++ b/src/process/riscv64/vfork.s
@@ -0,0 +1,11 @@
+.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
+	j __syscall_ret
-- 
2.39.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.