summaryrefslogtreecommitdiff
path: root/test/tls
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-09-23 18:31:31 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2014-09-23 18:32:06 +0200
commit4a076a061e57c55d94c79d0fd3b201c3a84a30cb (patch)
tree37b37382daf2783515d5bb3e98a843c7b88620aa /test/tls
parent4c3023bc803012656cf45749960282351efc8020 (diff)
add tls test macros for xtensa
http://lists.linux-xtensa.org/pipermail/linux-xtensa/Week-of-Mon-20130819/001153.html
Diffstat (limited to 'test/tls')
-rw-r--r--test/tls/tls-macros.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h
index 2787809f5..56347b45d 100644
--- a/test/tls/tls-macros.h
+++ b/test/tls/tls-macros.h
@@ -885,6 +885,43 @@ register void *__gp __asm__("$29");
: "=&r" (__result) : "r" (tp)); \
__result; })
+#elif defined __xtensa__
+
+#define TLS_GD(x) \
+ ({ int *__l; \
+ asm ("movi a8, " #x "@TLSFUNC\n\t" \
+ "movi a10, " #x "@TLSARG\n\t" \
+ "callx8.tls a8, " #x "@TLSCALL\n\t" \
+ "mov %0, a10\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \
+ __l; })
+
+#define TLS_LD(x) \
+ ({ int *__l; \
+ asm ("movi a8, " #x "@TLSFUNC\n\t" \
+ "movi a10, " #x "@TLSARG\n\t" \
+ "callx8.tls a8, " #x "@TLSCALL\n\t" \
+ "movi %0, " #x "@TPOFF\n\t" \
+ "add %0, %0, a10\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \
+ __l; })
+
+#define TLS_IE(x) TLS_LE(x)
+
+#define TLS_LE(x) \
+ ({ int *__l; \
+ int __t; \
+ asm ("rur %0, threadptr\n\t" \
+ "movi %1, " #x "@TPOFF\n\t" \
+ "add %0, %0, %1\n\t" \
+ : "=r" (__l), "=r" (__t) ); \
+ __l; }); \
+
+
#elif !defined TLS_LE || !defined TLS_IE \
|| !defined TLS_LD || !defined TLS_GD
# error "No support for this architecture so far."