tls-macros-microblaze.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright (C) 2009-2016 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #define TLS_LD(x) \
  15. ({ \
  16. char *__result; \
  17. int __offset; \
  18. extern void *__tls_get_addr (void *); \
  19. __asm__ ("mfs r20,rpc \n" \
  20. "addik r20,r20,_GLOBAL_OFFSET_TABLE_+8\n" \
  21. "addik %0,r20," #x "@TLSLDM" \
  22. : "=r" (__result)); \
  23. __result = (char *) __tls_get_addr (__result); \
  24. __asm__ ("addik %0,r0,"#x"@TLSDTPREL" \
  25. : "=r" (__offset)); \
  26. (int *) (__result + __offset); })
  27. #define TLS_GD(x) \
  28. ({ \
  29. int *__result; \
  30. extern void *__tls_get_addr (void *); \
  31. __asm__ ("mfs r20,rpc\n" \
  32. "addik r20,r20,_GLOBAL_OFFSET_TABLE_+8\n" \
  33. "addik %0,r20," #x "@TLSGD" \
  34. : "=r" (__result)); \
  35. (int *) __tls_get_addr (__result); })
  36. #define TLS_LE(x) TLS_LD(x)
  37. #define TLS_IE(x) TLS_GD(x)