Back to index

glibc  2.9
tls-macros.h
Go to the documentation of this file.
00001 /* TLS Access Macros for HP PARISC Linux */
00002 
00003 /* HPPA Local Exec TLS access.  */
00004 #define TLS_LE(x) \
00005   ({  int * __result;  \
00006       unsigned long __tmp; \
00007       asm ( \
00008        "  mfctl %%cr27, %1\n" \
00009        "  addil LR'" #x "-$tls_leoff$, %1\n" \
00010        "  ldo RR'" #x "-$tls_leoff$(%%r1), %0\n" \
00011         : "=r" (__result), "=r" (__tmp) \
00012        : \
00013        : "r1" );  \
00014       __result;  \
00015   })
00016 
00017 /* HPPA Initial Exec TLS access.  */
00018 #ifdef PIC
00019 #  define TLS_IE(x) \
00020   ({  int * __result;  \
00021       unsigned long __tmp, __tmp2; \
00022       asm ( \
00023        "  mfctl %%cr27, %1\n" \
00024        "  addil LT'" #x "-$tls_ieoff$, %%r19\n" \
00025        "  ldw RT'" #x "-$tls_ieoff$(%%r1), %2\n" \
00026        "  add %1, %2, %0\n" \
00027        : "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
00028        : \
00029        : "r1" ); \
00030       __result;  \
00031   })
00032 #else
00033 #  define TLS_IE(x) \
00034   ({  int * __result;  \
00035       unsigned long __tmp, __tmp2; \
00036       asm ( \
00037        "  mfctl %%cr27, %1\n" \
00038        "  addil LR'" #x "-$tls_ieoff$, %%r27\n" \
00039        "  ldw RR'" #x "-$tls_ieoff$(%%r1), %2\n" \
00040        "  add %1, %2, %0\n" \
00041        : "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
00042        : \
00043        : "r1" ); \
00044       __result;  \
00045   })
00046 #endif
00047 
00048 #ifdef PIC
00049 /* HPPA Local Dynamic TLS access.  */
00050 #  define TLS_LD(x) \
00051   ({  int * __result;  \
00052       asm (  \
00053        "  copy %%r19, %%r4\n" \
00054        "  addil LT'" #x "-$tls_ldidx$, %%r19\n" \
00055        "  bl __tls_get_addr, %%r2\n" \
00056        "  ldo RT'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
00057        "  addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
00058        "  ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
00059        "  copy %%r4, %%r19\n" \
00060        : "=r" (__result) \
00061        : \
00062        : "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
00063          "r25", "r26", "r28", "r29", "r31" ); \
00064       __result;  \
00065   })
00066 #else
00067 #  define TLS_LD(x) \
00068   ({  int * __result;  \
00069       asm (  \
00070        "  addil LR'" #x "-$tls_ldidx$, %%r27\n" \
00071        "  bl __tls_get_addr, %%r2\n" \
00072        "  ldo RR'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
00073        "  addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
00074        "  ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
00075        : "=r" (__result) \
00076        : \
00077        : "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
00078          "r25", "r26", "r28", "r29", "r31" ); \
00079       __result;  \
00080   })
00081 #endif
00082 
00083 /* HPPA General Dynamic TLS access.  */
00084 #ifdef PIC
00085 #  define TLS_GD(x) \
00086   ({  int * __result;  \
00087       asm (  \
00088        "  copy %%r19, %%r4\n" \
00089         "  addil LT'" #x "-$tls_gdidx$, %%r19\n" \
00090        "  bl __tls_get_addr, %%r2\n" \
00091        "  ldo RT'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
00092        "  copy %%r28, %0\n" \
00093        "  copy %%r4, %%r19\n" \
00094        : "=r" (__result) \
00095        : \
00096        : "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
00097          "r25", "r26", "r28", "r29", "r31" ); \
00098       __result;  \
00099   })
00100 #else
00101 #  define TLS_GD(x) \
00102   ({  int * __result;  \
00103       asm (  \
00104         "  addil LR'" #x "-$tls_gdidx$, %%r27\n" \
00105        "  bl __tls_get_addr, %%r2\n" \
00106        "  ldo RR'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
00107        "  copy %%r28, %0\n" \
00108        : "=r" (__result) \
00109        : \
00110        : "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
00111          "r25", "r26", "r28", "r29", "r31" ); \
00112       __result;  \
00113   })
00114 #endif
00115