summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/bfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-07-22 12:51:54 -0400
committerMike Frysinger <vapier@gentoo.org>2009-07-22 12:51:54 -0400
commit78114ccc56c09877fa16435386987542d1f1c09f (patch)
tree2ece7e9f483ba9c221600cc31a2595c289e2fc98 /libc/sysdeps/linux/bfin
parent60c86a0379a87d470417eb6b382920e07e6e2a65 (diff)
Blackfin: unify FDPIC/FLAT versions of clone
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libc/sysdeps/linux/bfin')
-rw-r--r--libc/sysdeps/linux/bfin/clone.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c
index 899738e2d..067fdc767 100644
--- a/libc/sysdeps/linux/bfin/clone.c
+++ b/libc/sysdeps/linux/bfin/clone.c
@@ -13,47 +13,33 @@
int
clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
{
- register long rval = -1;
+ long rval = -1;
if (fn && child_stack) {
-#ifdef __BFIN_FDPIC__
- __asm__ __volatile__ (
- "excpt 0;" /*Call sys_clone*/
+ __asm__ __volatile__ (
+ "excpt 0;" /* Call sys_clone */
"cc = r0 == 0;"
- "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */
+ "if !cc jump 1f;" /* if (rval != 0) skip to parent */
"r0 = %4;"
"p0 = %5;"
"fp = 0;"
+#ifdef __BFIN_FDPIC__
"p1 = [p0];"
"p3 = [p0 + 4];"
"call (p1);" /* Call cloned function */
- "p0 = %6;"
- "excpt 0;" /* Call sys_exit */
- ".Lxxx: nop;"
- : "=q0" (rval)
- : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
- : "CC");
#else
- __asm__ __volatile__ (
- "excpt 0;" /*Call sys_clone*/
- "cc = r0 == 0;"
- "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */
- "r0 = %4;"
- "p0 = %5;"
- "fp = 0;"
"call (p0);" /* Call cloned function */
+#endif
"p0 = %6;"
"excpt 0;" /* Call sys_exit */
- ".Lxxx: nop;"
+ "1: nop;"
: "=q0" (rval)
: "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
: "CC");
-#endif
- } else {
+ } else
__set_errno(EINVAL);
- }
return rval;
}