summaryrefslogtreecommitdiff
path: root/sysdeps/mips/nptl/tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mips/nptl/tls.h')
-rw-r--r--sysdeps/mips/nptl/tls.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h
index ef1145779d..10ca878292 100644
--- a/sysdeps/mips/nptl/tls.h
+++ b/sysdeps/mips/nptl/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/MIPS version.
- Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,8 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
+/* Get system call information. */
+# include <sysdep.h>
/* Type for the dtv. */
typedef union dtv
@@ -42,29 +44,37 @@ typedef union dtv
# define READ_THREAD_POINTER() (__builtin_thread_pointer ())
#else
/* Note: rd must be $v1 to be ABI-conformant. */
-# define READ_THREAD_POINTER() \
- ({ void *__result; \
- asm volatile (".set\tpush\n\t.set\tmips32r2\n\t" \
- "rdhwr\t%0, $29\n\t.set\tpop" : "=v" (__result)); \
- __result; })
+# if __mips_isa_rev >= 2
+# define READ_THREAD_POINTER() \
+ ({ void *__result; \
+ asm volatile ("rdhwr\t%0, $29" : "=v" (__result)); \
+ __result; })
+# else
+# define READ_THREAD_POINTER() \
+ ({ void *__result; \
+ asm volatile (".set\tpush\n\t.set\tmips32r2\n\t" \
+ "rdhwr\t%0, $29\n\t.set\tpop" : "=v" (__result)); \
+ __result; })
+# endif
#endif
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
-# define READ_THREAD_POINTER(rd) \
- .set push; \
- .set mips32r2; \
- rdhwr rd, $29; \
- .set pop
+# if __mips_isa_rev >= 2
+# define READ_THREAD_POINTER(rd) rdhwr rd, $29
+# else
+# define READ_THREAD_POINTER(rd) \
+ .set push; \
+ .set mips32r2; \
+ rdhwr rd, $29; \
+ .set pop
+# endif
#endif /* __ASSEMBLER__ */
#ifndef __ASSEMBLER__
-/* Get system call information. */
-# include <sysdep.h>
-
/* The TP points to the start of the thread blocks. */
# define TLS_DTV_AT_TP 1
# define TLS_TCB_AT_TP 0