summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/nios2/clone.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-05-28 18:12:58 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-04 00:03:07 +0100
commitb8fcdddcbb192fc367ff04bbd753b9deb69b09f3 (patch)
tree8febdb9d4e3d090e9273c29df9ff06116196c8e4 /libc/sysdeps/linux/nios2/clone.c
parent191739597c6d380692885cfdd8dd8aa4f31f029d (diff)
nios2: sync support with glibc
Only static linking is supported for now. More debugging and analyzing for ld.so, TLS and NPTL is required. But at least you can bootup a static root fileystem in Qemu.
Diffstat (limited to 'libc/sysdeps/linux/nios2/clone.c')
-rw-r--r--libc/sysdeps/linux/nios2/clone.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/libc/sysdeps/linux/nios2/clone.c b/libc/sysdeps/linux/nios2/clone.c
deleted file mode 100644
index eec9f42ff..000000000
--- a/libc/sysdeps/linux/nios2/clone.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * libc/sysdeps/linux/nios2/clone.c -- `clone' syscall for linux/nios2
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- *
- * Copyright (C) 2004,05 Microtronix Datacom Ltd
- * Copyright (C) 2002,03 NEC Electronics Corporation
- * Copyright (C) 2002,03 Miles Bader <miles@gnu.org>
- *
- * Written by Miles Bader <miles@gnu.org>
- * Nios2 port by Wentao Xu
- */
-
-#include <errno.h>
-#include <sched.h>
-#include <sys/syscall.h>
-
-int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
-{
- register unsigned long rval __asm__ ("r2") = -EINVAL;
-
- if (fn && child_stack) {
- register unsigned long syscall __asm__ ("r3");
- register unsigned long arg0 __asm__ ("r4");
- register unsigned long arg1 __asm__ ("r5");
-
- /* Clone this thread. */
- rval = TRAP_ID_SYSCALL;
- syscall = __NR_clone;
- arg0 = flags;
- arg1 = (unsigned long)child_stack;
- __asm__ __volatile__ ("trap "
- : "=r" (rval), "=r" (syscall)
- : "0" (rval),"1" (syscall), "r" (arg0), "r" (arg1)
- );
-
- if (rval == 0) {
- /* In child thread, call fn and exit. */
- arg0 = (*fn) (arg);
- syscall = __NR_exit;
- __asm__ __volatile__ ("trap "
- : "=r" (rval), "=r" (syscall)
- : "1" (syscall), "r" (arg0));
- }
- }
-
- __syscall_return (int, rval);
-}