aeabi_read_tp.S 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 2005 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
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. In addition to the permissions in the GNU Lesser General Public
  8. License, the Free Software Foundation gives you unlimited
  9. permission to link the compiled version of this file with other
  10. programs, and to distribute those programs without any restriction
  11. coming from the use of this file. (The GNU Lesser General Public
  12. License restrictions do apply in other respects; for example, they
  13. cover modification of the file, and distribution when not linked
  14. into another program.)
  15. Note that people who make modified versions of this file are not
  16. obligated to grant this special exception for their modified
  17. versions; it is their choice whether to do so. The GNU Lesser
  18. General Public License gives permission to release a modified
  19. version without this exception; this exception also makes it
  20. possible to release a modified version which carries forward this
  21. exception.
  22. The GNU C Library is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  25. Lesser General Public License for more details.
  26. You should have received a copy of the GNU Lesser General Public
  27. License along with the GNU C Library; if not, see
  28. <http://www.gnu.org/licenses/>. */
  29. #include <features.h>
  30. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  31. #include <sysdep.h>
  32. /* GCC will emit calls to this routine under -mtp=soft. Linux has an
  33. equivalent helper function (which clobbers fewer registers than
  34. a normal function call) in a high page of memory; tail call to the
  35. helper.
  36. This function is exported from libc for use by user code. libpthread, librt,
  37. and the dynamic linker get their own private copies, for
  38. performance (and in the case of ld.so, out of necessity); those are
  39. all hidden. */
  40. #ifndef NOT_IN_libc
  41. .global __aeabi_read_tp
  42. #else
  43. .hidden __aeabi_read_tp
  44. #endif
  45. #if !defined(__ARM_ARCH_ISA_ARM)
  46. .thumb_func
  47. .thumb
  48. .syntax unified
  49. ENTRY (__aeabi_read_tp)
  50. push {r7}
  51. mov r7, #0x0f0000
  52. orr r7, r7, #6
  53. svc #0
  54. pop {r7}
  55. bx lr
  56. #else
  57. .arm
  58. ENTRY (__aeabi_read_tp)
  59. mov r0, #0xffff0fff
  60. sub pc, r0, #31
  61. #endif
  62. END (__aeabi_read_tp)
  63. #endif /* __UCLIBC_HAS_THREADS_NATIVE__ */