瀏覽代碼

cris: add provide arch-specific vfork implementation

vfork must be called with nothing at all on the stack,
so implementing it via syscall() does not work.

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Thorsten Glaser 13 年之前
父節點
當前提交
9b5df2295b
共有 2 個文件被更改,包括 31 次插入1 次删除
  1. 1 1
      libc/sysdeps/linux/cris/Makefile.arch
  2. 30 0
      libc/sysdeps/linux/cris/vfork.S

+ 1 - 1
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

+ 30 - 0
libc/sysdeps/linux/cris/vfork.S

@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 2011
+ *	Thorsten Glaser <tg@freewrt.org>
+ *
+ * This file is available either under the terms and conditions of
+ * the MirOS Licence, or the same terms as klibc or uClibc.
+ */
+
+#include "sysdep.h"
+
+	.syntax no_register_prefix
+
+/*
+ * vfork is special, but PSEUDO() would probably work were it not broken;
+ * there must be nothing at all on the stack above the stack frame of the
+ * enclosing function
+ */
+
+ENTRY(__vfork)
+	movu.w	__NR_vfork,$r9
+	break	13
+	cmps.w	-4096,$r10
+	bhs	0f
+	 nop
+	Ret
+	 nop
+PSEUDO_END(__vfork)
+
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)