diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-09-15 11:02:36 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-09-15 11:02:36 +0000 |
commit | 783107dbed9ac48f3db147f4ed6cf7a9aa75418e (patch) | |
tree | a0e081576d4a86660127740fb6cfde88ebd0aa32 /libc | |
parent | f032afc5fd03f45ecc346b1dbb00b9b3dc0e0e2a (diff) | |
download | uClibc-alpine-783107dbed9ac48f3db147f4ed6cf7a9aa75418e.tar.bz2 uClibc-alpine-783107dbed9ac48f3db147f4ed6cf7a9aa75418e.tar.xz |
use gcc input constraints to avoid often duplicated reloads when making syscalls
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/bfin/__longjmp.S | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/syscalls.h | 118 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/brk.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/clone.c | 20 |
4 files changed, 52 insertions, 96 deletions
diff --git a/libc/sysdeps/linux/bfin/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index bb40c852c..418d591e2 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -98,9 +98,9 @@ ___longjmp: P0 = [SP++]; CC = R0 == 0; - IF !CC JUMP finished; + IF !CC JUMP .Lfinished; R0 = 1; -finished: +.Lfinished: RTS; .size ___longjmp,.-___longjmp diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index d1d904c1c..0833a1fc1 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -39,12 +39,10 @@ do { \ type name(void) { \ long __res; \ __asm__ __volatile__ ( \ - "p0 = %1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name) \ - : "memory","CC","R0","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -52,14 +50,11 @@ type name(void) { \ type name(type1 arg1) { \ long __res; \ __asm__ __volatile__ ( \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)) \ - : "memory","CC","R0","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -67,16 +62,13 @@ type name(type1 arg1) { \ type name(type1 arg1,type2 arg2) { \ long __res; \ __asm__ __volatile__ ( \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)) \ - : "memory","CC","R0","R1","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -84,18 +76,13 @@ type name(type1 arg1,type2 arg2) { \ type name(type1 arg1,type2 arg2,type3 arg3) { \ long __res; \ __asm__ __volatile__ ( \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)) \ - : "memory","CC","R0","R1","R2","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -103,20 +90,14 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ long __res; \ __asm__ __volatile__ ( \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)) \ - : "memory","CC","R0","R1","R2","R3","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -124,22 +105,15 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ long __res; \ __asm__ __volatile__ ( \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)) \ - : "memory","CC","R0","R1","R2","R3","R4","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)), \ + "q4" ((long)(arg5)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -147,24 +121,16 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ long __res; \ __asm__ __volatile__ ( \ - "r5=%7;\n\t" \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)), \ - "rm" ((long)(arg6)) \ - : "memory","CC","R0","R1","R2","R3","R4","R5","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)), \ + "q4" ((long)(arg5)), \ + "q5" ((long)(arg6)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 620c0b683..64480453e 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -19,11 +19,9 @@ int brk (void *addr) __asm__ __volatile__( "P0 = %2;\n\t" - "R0 = %1;\n\t" "excpt 0;\n\t" - "%0 = R0;\n\t" - : "=r"(newbrk) - : "r"(addr), "i" (__NR_brk): "P0" ); + : "=q0" (newbrk) + : "q0" (addr), "i" (__NR_brk): "P0" ); __curbrk = newbrk; diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c index 0ba1d5a4a..899738e2d 100644 --- a/libc/sysdeps/linux/bfin/clone.c +++ b/libc/sysdeps/linux/bfin/clone.c @@ -19,11 +19,7 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) #ifdef __BFIN_FDPIC__ __asm__ __volatile__ ( - "r1 = %2;" - "r0 = %3;" - "P0 = %1;" "excpt 0;" /*Call sys_clone*/ - "%0 = r0;" "cc = r0 == 0;" "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */ "r0 = %4;" @@ -35,16 +31,12 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) "p0 = %6;" "excpt 0;" /* Call sys_exit */ ".Lxxx: nop;" - : "=d" (rval) - : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) - : "CC", "R0", "R1", "P0"); + : "=q0" (rval) + : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) + : "CC"); #else __asm__ __volatile__ ( - "r1 = %2;" - "r0 = %3;" - "P0 = %1;" "excpt 0;" /*Call sys_clone*/ - "%0 = r0;" "cc = r0 == 0;" "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */ "r0 = %4;" @@ -54,9 +46,9 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) "p0 = %6;" "excpt 0;" /* Call sys_exit */ ".Lxxx: nop;" - : "=d" (rval) - : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) - : "CC", "R0", "R1", "P0"); + : "=q0" (rval) + : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) + : "CC"); #endif } else { |