summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/arm/bits
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-08-17 14:48:11 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-08-17 14:48:11 +0000
commit54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa (patch)
tree1fe7209313f2728c550d3eb75929b4af051fb349 /libc/sysdeps/linux/arm/bits
parentb46868ff8b3d2fb592e3fca4a516695533eae9e5 (diff)
downloaduClibc-alpine-54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa.tar.bz2
uClibc-alpine-54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa.tar.xz
Merge/sync with trunk.
Diffstat (limited to 'libc/sysdeps/linux/arm/bits')
-rw-r--r--libc/sysdeps/linux/arm/bits/atomicity.h33
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h16
2 files changed, 49 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arm/bits/atomicity.h b/libc/sysdeps/linux/arm/bits/atomicity.h
index def974f8a..97d278610 100644
--- a/libc/sysdeps/linux/arm/bits/atomicity.h
+++ b/libc/sysdeps/linux/arm/bits/atomicity.h
@@ -31,12 +31,23 @@ exchange_and_add (volatile uint32_t *mem, int val)
int tmp2;
int result;
__asm__ ("\n"
+#if defined(__thumb__)
+ "\t.align 0\n"
+ "\tbx pc\n"
+ "\tnop\n"
+ "\t.arm\n"
+#endif
"0:\tldr\t%0,[%3]\n\t"
"add\t%1,%0,%4\n\t"
"swp\t%2,%1,[%3]\n\t"
"cmp\t%0,%2\n\t"
"swpne\t%1,%2,[%3]\n\t"
"bne\t0b"
+#if defined(__thumb__)
+ "\torr %1, pc, #1\n"
+ "\tbx %1\n"
+ "\t.force_thumb"
+#endif
: "=&r" (result), "=&r" (tmp1), "=&r" (tmp2)
: "r" (mem), "r"(val)
: "cc", "memory");
@@ -51,12 +62,23 @@ atomic_add (volatile uint32_t *mem, int val)
int tmp2;
int tmp3;
__asm__ ("\n"
+#if defined(__thumb__)
+ "\t.align 0\n"
+ "\tbx pc\n"
+ "\tnop\n"
+ "\t.arm\n"
+#endif
"0:\tldr\t%0,[%3]\n\t"
"add\t%1,%0,%4\n\t"
"swp\t%2,%1,[%3]\n\t"
"cmp\t%0,%2\n\t"
"swpne\t%1,%2,[%3]\n\t"
"bne\t0b"
+#if defined(__thumb__)
+ "\torr %1, pc, #1\n"
+ "\tbx %1\n"
+ "\t.force_thumb"
+#endif
: "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
: "r" (mem), "r"(val)
: "cc", "memory");
@@ -68,6 +90,12 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
{
int result, tmp;
__asm__ ("\n"
+#if defined(__thumb__)
+ "\t.align 0\n"
+ "\tbx pc\n"
+ "\tnop\n"
+ "\t.arm\n"
+#endif
"0:\tldr\t%1,[%2]\n\t"
"mov\t%0,#0\n\t"
"cmp\t%1,%4\n\t"
@@ -78,6 +106,11 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
"bne\t0b\n\t"
"mov\t%0,#1\n"
"1:"
+#if defined(__thumb__)
+ "\torr %1, pc, #1\n"
+ "\tbx %1\n"
+ "\t.force_thumb"
+#endif
: "=&r" (result), "=&r" (tmp)
: "r" (p), "r" (newval), "r" (oldval)
: "cc", "memory");
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index 245266730..21e5b8146 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -97,6 +97,7 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL
+#if !defined(__thumb__)
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \
{ \
@@ -109,6 +110,21 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
_sys_result = _a1; \
} \
(int) _sys_result; })
+#else
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ unsigned int _sys_result; \
+ { \
+ register int _a1 asm ("a1"); \
+ LOAD_ARGS_##nr (args) \
+ register int _r7 asm ("r7") = (int) (SYS_ify(name)); \
+ asm volatile ("swi 0 @ syscall " #name \
+ : "=r" (_a1) \
+ : "r" (_r7) ASM_ARGS_##nr \
+ : "memory"); \
+ _sys_result = _a1; \
+ } \
+ (int) _sys_result; })
+#endif
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \