The return value munging isn't necessary anymore. See for example
lib/libc/arch/arm/sys/OVfork.S:
revision 1.4
date: 2015/03/31 04:32:01; author: guenther; state: Exp; lines: +1 -10;
commitid: 4lHzpIZZxMqyyel4;
Simplify fork/vfork logic: the kernel has handled returning zero in the child
for a long time, so there's no need to test the second return register here
in the asm stub.
ok and testing of many archs by krw@ miod@
ok?
Index: lib/libc/arch/aarch64/sys/Ovfork.S
===================================================================
RCS file: /cvs/src/lib/libc/arch/aarch64/sys/Ovfork.S,v
retrieving revision 1.1
diff -u -p -r1.1 Ovfork.S
--- lib/libc/arch/aarch64/sys/Ovfork.S 11 Jan 2017 18:09:24 -0000 1.1
+++ lib/libc/arch/aarch64/sys/Ovfork.S 18 Mar 2017 15:53:57 -0000
@@ -34,13 +34,6 @@
#include "SYS.h"
-/*
- * pid = vfork();
- *
- * On return from the SWI:
- * r1 == 0 in parent process, r1 == 1 in child process.
- * r0 == pid of child in parent, r0 == pid of parent in child.
- */
.text
.align 0
@@ -48,8 +41,6 @@ SYSENTRY_HIDDEN(vfork)
mov x2, x30
SYSTRAP(vfork)
bcs CERROR
- sub x1, x1, #1 /* r1 == 0xffffffff if parent, 0 if child */
- and x0, x0, x1 /* r0 == 0 if child, else unchanged */
mov x30, x2
ret
SYSCALL_END_HIDDEN(vfork)