diff options
author | James Hogan <james.hogan@imgtec.com> | 2015-11-11 11:17:37 +0000 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2015-11-13 18:28:34 +0100 |
commit | 5aa5761498f15a62d3523591384a8b6cd6f3dadc (patch) | |
tree | 39cbd8c2bfc5e13323cd3de58eb70ee470e863c7 /test/tls/tls-macros.h | |
parent | e89e3af8f64bded3920f046fb8db2b95a188ff55 (diff) |
tests/tls: Implement TLS macros for metag
Implement the TLS macros in tls-macros.h for metag.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'test/tls/tls-macros.h')
-rw-r--r-- | test/tls/tls-macros.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h index 315f0e2b9..d2437431c 100644 --- a/test/tls/tls-macros.h +++ b/test/tls/tls-macros.h @@ -948,6 +948,45 @@ register void *__gp __asm__("$29"); : "=r" (__l), "=r" (__t) ); \ __l; }); \ +#elif defined __metag__ + +# define TLS_GD(x) \ + ({ void *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("MOV %0, A1LbP\n\t" \ + "ADD %0, %0, #(" #x "@TLSGD)" \ + : "=d" (__result)); \ + (int *)__tls_get_addr (__result); }) + +# define TLS_LD(x) \ + ({ void *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("MOV %0, A1LbP\n\t" \ + "ADD %0, %0, #(" #x "@TLSLDM)" \ + : "=d" (__result)); \ + __result = __tls_get_addr (__result); \ + __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLDO)\n\t" \ + "ADD %0,%0,#LO(" #x "@TLSLDO)" \ + : "+d" (__result)); \ + __result; }) + +# define TLS_IE(x) \ + ({ void *__result; \ + unsigned long __rel; \ + extern void *__metag_load_tp (void); \ + __asm__ ("GETD %0,[A1LbP+#(" #x "@TLSIE)]" \ + : "=d" (__rel)); \ + __result = __metag_load_tp(); \ + __result + __rel; }) + +# define TLS_LE(x) \ + ({ void *__result; \ + extern void *__metag_load_tp (void); \ + __result = __metag_load_tp(); \ + __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLE)\n\t" \ + "ADD %0,%0,#LO(" #x "@TLSLE)" \ + : "+d" (__result)); \ + __result; }) #elif !defined TLS_LE || !defined TLS_IE \ || !defined TLS_LD || !defined TLS_GD |