summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/nios2/vfork.S
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-16 11:09:34 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-16 11:09:34 +0000
commitc3d50a69839f8d80fc7244fde6e4a57e5e39dd36 (patch)
treec9e27baac7541384b806cce0845f28c1f59b5a2e /libc/sysdeps/linux/nios2/vfork.S
parent3cf731bf40f153a73373798085d1f45a80b972d6 (diff)
Pete Popov writes:
Hi Erik, I'm not sure why the NIOS support is not in uClibc -- perhaps the patch was rejected or never submitted? In any case, I'm playing with some NIOS stuff and created this patch against 0.9.26. The work was done by Microtronix. I'm not sure who else contributed to it. It would be great to have the NIOS support available in uClibc so developers don't have to go searching for these bits. Pete
Diffstat (limited to 'libc/sysdeps/linux/nios2/vfork.S')
-rw-r--r--libc/sysdeps/linux/nios2/vfork.S53
1 files changed, 53 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S
new file mode 100644
index 000000000..a19a90023
--- /dev/null
+++ b/libc/sysdeps/linux/nios2/vfork.S
@@ -0,0 +1,53 @@
+/*
+ * libc/sysdeps/linux/nios2/vfork.S -- `vfork' syscall for linux/nios2
+ *
+ * Copyright (C) 2004 Microtronix Datacom Ltd
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License. See the file COPYING.LIB in the main
+ * directory of this archive for more details.
+ *
+ * Written by Wentao Xu <wentao@microtronix.com>
+ */
+#include <asm/unistd.h>
+
+#ifndef __NR_vfork
+#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
+#endif
+
+ .text
+ .balign 4
+ .globl errno
+ .globl vfork
+ .globl __libc_vfork
+#if defined __HAVE_ELF__
+ .type vfork,@function
+ .type __libc_vfork,@function
+#endif
+vfork:
+__libc_vfork:
+ movui r2, TRAP_ID_SYSCALL
+ movui r3, __NR_vfork
+ trap
+ movi r8, -4096
+ bltu r8, r2, fix_errno
+ ret
+fix_errno:
+ sub r8, r0, r2
+
+ addi sp, sp, -8
+ stw ra, 4(sp)
+ stw r8, 0(sp)
+#ifndef __PIC__
+ call __errno_location
+#else
+
+#endif
+ ldw ra, 4(sp)
+ ldw r8, 0(sp)
+ stw r8, 0(r2)
+
+ addi r2, r0, -1
+ addi sp, sp, 8
+ ret
+