about summary refs log tree commit diff
path: root/ports/sysdeps/hppa/tls-macros.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-07-01 13:06:41 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-07-01 13:06:41 +0000
commite64ac02c24b43659048622714afdc92fedf561fa (patch)
tree37162878b72d302de351788bec4c9360c9d55f1d /ports/sysdeps/hppa/tls-macros.h
parenta20c2b3c87aebc7d4b090c622d36480263b80042 (diff)
downloadglibc-e64ac02c24b43659048622714afdc92fedf561fa.tar.gz
glibc-e64ac02c24b43659048622714afdc92fedf561fa.tar.xz
glibc-e64ac02c24b43659048622714afdc92fedf561fa.zip
Move all files into ports/ subdirectory in preparation for merge with glibc glibc-2.16-ports-before-merge
Diffstat (limited to 'ports/sysdeps/hppa/tls-macros.h')
-rw-r--r--ports/sysdeps/hppa/tls-macros.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/ports/sysdeps/hppa/tls-macros.h b/ports/sysdeps/hppa/tls-macros.h
new file mode 100644
index 0000000000..f5a1cd8f3d
--- /dev/null
+++ b/ports/sysdeps/hppa/tls-macros.h
@@ -0,0 +1,115 @@
+/* TLS Access Macros for HP PARISC Linux */
+
+/* HPPA Local Exec TLS access.  */
+#define TLS_LE(x) \
+  ({  int * __result;  \
+      unsigned long __tmp; \
+      asm ( \
+	"  mfctl %%cr27, %1\n" \
+	"  addil LR'" #x "-$tls_leoff$, %1\n" \
+	"  ldo RR'" #x "-$tls_leoff$(%%r1), %0\n" \
+        : "=r" (__result), "=r" (__tmp) \
+	: \
+	: "r1" );  \
+      __result;  \
+  })
+
+/* HPPA Initial Exec TLS access.  */
+#ifdef PIC
+#  define TLS_IE(x) \
+  ({  int * __result;  \
+      unsigned long __tmp, __tmp2; \
+      asm ( \
+	"  mfctl %%cr27, %1\n" \
+	"  addil LT'" #x "-$tls_ieoff$, %%r19\n" \
+	"  ldw RT'" #x "-$tls_ieoff$(%%r1), %2\n" \
+	"  add %1, %2, %0\n" \
+	: "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
+	: \
+	: "r1" ); \
+      __result;  \
+  })
+#else
+#  define TLS_IE(x) \
+  ({  int * __result;  \
+      unsigned long __tmp, __tmp2; \
+      asm ( \
+	"  mfctl %%cr27, %1\n" \
+	"  addil LR'" #x "-$tls_ieoff$, %%r27\n" \
+	"  ldw RR'" #x "-$tls_ieoff$(%%r1), %2\n" \
+	"  add %1, %2, %0\n" \
+	: "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
+	: \
+	: "r1" ); \
+      __result;  \
+  })
+#endif
+
+#ifdef PIC
+/* HPPA Local Dynamic TLS access.  */
+#  define TLS_LD(x) \
+  ({  int * __result;  \
+      asm (  \
+	"  copy %%r19, %%r4\n" \
+	"  addil LT'" #x "-$tls_ldidx$, %%r19\n" \
+	"  bl __tls_get_addr, %%r2\n" \
+	"  ldo RT'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
+	"  addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
+	"  ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
+	"  copy %%r4, %%r19\n" \
+	: "=r" (__result) \
+	: \
+	: "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
+	  "r25", "r26", "r28", "r29", "r31" ); \
+      __result;  \
+  })
+#else
+#  define TLS_LD(x) \
+  ({  int * __result;  \
+      asm (  \
+	"  addil LR'" #x "-$tls_ldidx$, %%r27\n" \
+	"  bl __tls_get_addr, %%r2\n" \
+	"  ldo RR'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
+	"  addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
+	"  ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
+	: "=r" (__result) \
+	: \
+	: "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
+	  "r25", "r26", "r28", "r29", "r31" ); \
+      __result;  \
+  })
+#endif
+
+/* HPPA General Dynamic TLS access.  */
+#ifdef PIC
+#  define TLS_GD(x) \
+  ({  int * __result;  \
+      asm (  \
+	"  copy %%r19, %%r4\n" \
+        "  addil LT'" #x "-$tls_gdidx$, %%r19\n" \
+	"  bl __tls_get_addr, %%r2\n" \
+	"  ldo RT'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
+	"  copy %%r28, %0\n" \
+	"  copy %%r4, %%r19\n" \
+	: "=r" (__result) \
+	: \
+	: "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
+	  "r25", "r26", "r28", "r29", "r31" ); \
+      __result;  \
+  })
+#else
+#  define TLS_GD(x) \
+  ({  int * __result;  \
+      asm (  \
+        "  addil LR'" #x "-$tls_gdidx$, %%r27\n" \
+	"  bl __tls_get_addr, %%r2\n" \
+	"  ldo RR'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
+	"  copy %%r28, %0\n" \
+	: "=r" (__result) \
+	: \
+	: "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
+	  "r25", "r26", "r28", "r29", "r31" ); \
+      __result;  \
+  })
+#endif
+