summaryrefslogtreecommitdiff
path: root/recipes/uclibc/uclibc-0.9.27/thumb-swp.patch
blob: 89171f735d8f99f2685c2458e55d1b408a3fa182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
--- uClibc-0.9.27/libc/sysdeps/linux/arm/bits/atomicity.h.orig	2005-08-09 13:12:59.663734027 -0700
+++ uClibc-0.9.27/libc/sysdeps/linux/arm/bits/atomicity.h	2005-08-09 17:54:14.581605661 -0700
@@ -31,12 +31,23 @@
   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 @@
   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 @@
 {
   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 @@
 	   "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");
--- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/arm/pt-machine.h.orig	2005-08-09 14:16:50.204774778 -0700
+++ uClibc-0.9.27/libpthread/linuxthreads/sysdeps/arm/pt-machine.h	2005-08-09 17:55:54.027863420 -0700
@@ -39,9 +39,24 @@
 {
   register unsigned int ret;
 
+#if defined(__thumb__)
+  void *pc;
+  __asm__ __volatile__(
+	".align 0\n"
+	"\tbx pc\n"
+	"\tnop\n"
+	"\t.arm\n"
+	"\tswp %0, %2, [%3]\n"
+	"\torr %1, pc, #1\n"
+	"\tbx %1\n"
+	"\t.force_thumb"
+	: "=r"(ret), "=r"(pc)
+	: "0"(1), "r"(spinlock));
+#else
   __asm__ __volatile__("swp %0, %1, [%2]"
 		       : "=r"(ret)
 		       : "0"(1), "r"(spinlock));
+#endif
 
   return ret;
 }