summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/bfin/clone.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-05-15 22:49:35 +0000
committerMike Frysinger <vapier@gentoo.org>2006-05-15 22:49:35 +0000
commit569755ce4e6db9ce7b3de5d2256a1cb68b9b43f3 (patch)
tree99b8701d8046c4c60d5a6307968582c67978e9dc /libc/sysdeps/linux/bfin/clone.c
parent7ebb2e4369d611641b67a2f15265742c73b1d8f3 (diff)
updates from Bernd Schmidt to sync with blackfin cvs
Diffstat (limited to 'libc/sysdeps/linux/bfin/clone.c')
-rw-r--r--libc/sysdeps/linux/bfin/clone.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c
index f326f00a0..fbf43ade9 100644
--- a/libc/sysdeps/linux/bfin/clone.c
+++ b/libc/sysdeps/linux/bfin/clone.c
@@ -15,6 +15,7 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
if (fn && child_stack) {
+#ifdef __BFIN_FDPIC__
__asm__ __volatile__ (
"r1 = %2;"
"r0 = %3;"
@@ -25,6 +26,28 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
"if !cc jump xxx;" /* if (rval != 0) skip to parent */
"r0 = %4;"
"p0 = %5;"
+ "fp = 0;"
+ "p1 = [p0];"
+ "p3 = [p0 + 4];"
+ "call (p1);" /* Call cloned function */
+ "p0 = %6;"
+ "excpt 0;" /* Call sys_exit */
+ "xxx: nop;"
+ : "=d" (rval)
+ : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
+ : "CC", "R0", "R1", "P0");
+#else
+ __asm__ __volatile__ (
+ "r1 = %2;"
+ "r0 = %3;"
+ "P0 = %1;"
+ "excpt 0;" /*Call sys_clone*/
+ "%0 = r0;"
+ "cc = r0 == 0;"
+ "if !cc jump xxx;" /* if (rval != 0) skip to parent */
+ "r0 = %4;"
+ "p0 = %5;"
+ "fp = 0;"
"call (p0);" /* Call cloned function */
"p0 = %6;"
"excpt 0;" /* Call sys_exit */
@@ -32,6 +55,7 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
: "=d" (rval)
: "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
: "CC", "R0", "R1", "P0");
+#endif
}
return rval;
}