unfortunately the common vfork implementation, which just use
the syscall function to interact with the kernel, does not work
on the cris architecture. The system call vfork is special, on most
architectures just calling syscall is not enough.
The patch below adds the vfork implementation from klibc.
License should be compatible.

Signed-off-by: Waldemar Brodkorb <w...@openadk.org>
---
 libc/sysdeps/linux/cris/Makefile.arch |    2 +-
 libc/sysdeps/linux/cris/vfork.S       |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)
 create mode 100644 libc/sysdeps/linux/cris/vfork.S

diff --git a/libc/sysdeps/linux/cris/Makefile.arch 
b/libc/sysdeps/linux/cris/Makefile.arch
index 43e1912..8a682b0 100644
--- a/libc/sysdeps/linux/cris/Makefile.arch
+++ b/libc/sysdeps/linux/cris/Makefile.arch
@@ -7,7 +7,7 @@
 
 CSRC := __init_brk.c brk.c sbrk.c
 
-SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S
+SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S vfork.S
 ifeq ($(UNIFIED_SYSCALL),y)
 SSRC += __uClibc_syscall.S
 endif
diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S
new file mode 100644
index 0000000..22b3d5d
--- /dev/null
+++ b/libc/sysdeps/linux/cris/vfork.S
@@ -0,0 +1,33 @@
+/*
+ * vfork.S
+ *
+ * On cris, r9 contains the syscall number (set by generated stub);
+ * r10..r13 contain arguments 0-3 per the standard calling convention.
+ * The return address is in $srp; so we just need to avoid the stack
+ * usage of the normal syscall stubs.
+ */
+
+#include <asm/unistd.h>
+#include <sys/syscall.h>
+
+       .section ".text","ax"
+       .balign 4
+       .globl  __vfork
+       .type   __vfork,@function
+__vfork:
+       move.d  __NR_vfork, $r9
+       break   13
+
+       cmps.w  -4096,$r10
+       blo     1f
+       neg.d   $r10,$r11
+       move.d  $r11,[errno]
+       moveq   -1,$r10
+1:
+       ret
+       nop
+
+       .size   __vfork,.-__vfork
+
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)
-- 
1.7.4.1

_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to