Gglobal.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2006-2007 IBM
  3. Contributed by
  4. Corey Ashford <cjashfor@us.ibm.com>
  5. Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
  6. This file is part of libunwind.
  7. Permission is hereby granted, free of charge, to any person obtaining
  8. a copy of this software and associated documentation files (the
  9. "Software"), to deal in the Software without restriction, including
  10. without limitation the rights to use, copy, modify, merge, publish,
  11. distribute, sublicense, and/or sell copies of the Software, and to
  12. permit persons to whom the Software is furnished to do so, subject to
  13. the following conditions:
  14. The above copyright notice and this permission notice shall be
  15. included in all copies or substantial portions of the Software.
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  23. #include "unwind_i.h"
  24. #include "dwarf_i.h"
  25. HIDDEN pthread_mutex_t ppc32_lock = PTHREAD_MUTEX_INITIALIZER;
  26. HIDDEN int tdep_needs_initialization = 1;
  27. /* The API register numbers are exactly the same as the .eh_frame
  28. registers, for now at least. */
  29. uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] =
  30. {
  31. [UNW_PPC32_R0]=UNW_PPC32_R0,
  32. [UNW_PPC32_R1]=UNW_PPC32_R1,
  33. [UNW_PPC32_R2]=UNW_PPC32_R2,
  34. [UNW_PPC32_R3]=UNW_PPC32_R3,
  35. [UNW_PPC32_R4]=UNW_PPC32_R4,
  36. [UNW_PPC32_R5]=UNW_PPC32_R5,
  37. [UNW_PPC32_R6]=UNW_PPC32_R6,
  38. [UNW_PPC32_R7]=UNW_PPC32_R7,
  39. [UNW_PPC32_R8]=UNW_PPC32_R8,
  40. [UNW_PPC32_R9]=UNW_PPC32_R9,
  41. [UNW_PPC32_R10]=UNW_PPC32_R10,
  42. [UNW_PPC32_R11]=UNW_PPC32_R11,
  43. [UNW_PPC32_R12]=UNW_PPC32_R12,
  44. [UNW_PPC32_R13]=UNW_PPC32_R13,
  45. [UNW_PPC32_R14]=UNW_PPC32_R14,
  46. [UNW_PPC32_R15]=UNW_PPC32_R15,
  47. [UNW_PPC32_R16]=UNW_PPC32_R16,
  48. [UNW_PPC32_R17]=UNW_PPC32_R17,
  49. [UNW_PPC32_R18]=UNW_PPC32_R18,
  50. [UNW_PPC32_R19]=UNW_PPC32_R19,
  51. [UNW_PPC32_R20]=UNW_PPC32_R20,
  52. [UNW_PPC32_R21]=UNW_PPC32_R21,
  53. [UNW_PPC32_R22]=UNW_PPC32_R22,
  54. [UNW_PPC32_R23]=UNW_PPC32_R23,
  55. [UNW_PPC32_R24]=UNW_PPC32_R24,
  56. [UNW_PPC32_R25]=UNW_PPC32_R25,
  57. [UNW_PPC32_R26]=UNW_PPC32_R26,
  58. [UNW_PPC32_R27]=UNW_PPC32_R27,
  59. [UNW_PPC32_R28]=UNW_PPC32_R28,
  60. [UNW_PPC32_R29]=UNW_PPC32_R29,
  61. [UNW_PPC32_R30]=UNW_PPC32_R30,
  62. [UNW_PPC32_R31]=UNW_PPC32_R31,
  63. [UNW_PPC32_CTR]=UNW_PPC32_CTR,
  64. [UNW_PPC32_XER]=UNW_PPC32_XER,
  65. [UNW_PPC32_CCR]=UNW_PPC32_CCR,
  66. [UNW_PPC32_LR]=UNW_PPC32_LR,
  67. [UNW_PPC32_FPSCR]=UNW_PPC32_FPSCR,
  68. [UNW_PPC32_F0]=UNW_PPC32_F0,
  69. [UNW_PPC32_F1]=UNW_PPC32_F1,
  70. [UNW_PPC32_F2]=UNW_PPC32_F2,
  71. [UNW_PPC32_F3]=UNW_PPC32_F3,
  72. [UNW_PPC32_F4]=UNW_PPC32_F4,
  73. [UNW_PPC32_F5]=UNW_PPC32_F5,
  74. [UNW_PPC32_F6]=UNW_PPC32_F6,
  75. [UNW_PPC32_F7]=UNW_PPC32_F7,
  76. [UNW_PPC32_F8]=UNW_PPC32_F8,
  77. [UNW_PPC32_F9]=UNW_PPC32_F9,
  78. [UNW_PPC32_F10]=UNW_PPC32_F10,
  79. [UNW_PPC32_F11]=UNW_PPC32_F11,
  80. [UNW_PPC32_F12]=UNW_PPC32_F12,
  81. [UNW_PPC32_F13]=UNW_PPC32_F13,
  82. [UNW_PPC32_F14]=UNW_PPC32_F14,
  83. [UNW_PPC32_F15]=UNW_PPC32_F15,
  84. [UNW_PPC32_F16]=UNW_PPC32_F16,
  85. [UNW_PPC32_F17]=UNW_PPC32_F17,
  86. [UNW_PPC32_F18]=UNW_PPC32_F18,
  87. [UNW_PPC32_F19]=UNW_PPC32_F19,
  88. [UNW_PPC32_F20]=UNW_PPC32_F20,
  89. [UNW_PPC32_F21]=UNW_PPC32_F21,
  90. [UNW_PPC32_F22]=UNW_PPC32_F22,
  91. [UNW_PPC32_F23]=UNW_PPC32_F23,
  92. [UNW_PPC32_F24]=UNW_PPC32_F24,
  93. [UNW_PPC32_F25]=UNW_PPC32_F25,
  94. [UNW_PPC32_F26]=UNW_PPC32_F26,
  95. [UNW_PPC32_F27]=UNW_PPC32_F27,
  96. [UNW_PPC32_F28]=UNW_PPC32_F28,
  97. [UNW_PPC32_F29]=UNW_PPC32_F29,
  98. [UNW_PPC32_F30]=UNW_PPC32_F30,
  99. [UNW_PPC32_F31]=UNW_PPC32_F31,
  100. };
  101. HIDDEN void
  102. tdep_init (void)
  103. {
  104. intrmask_t saved_mask;
  105. sigfillset (&unwi_full_mask);
  106. lock_acquire (&ppc32_lock, saved_mask);
  107. {
  108. if (!tdep_needs_initialization)
  109. /* another thread else beat us to it... */
  110. goto out;
  111. mi_init ();
  112. dwarf_init ();
  113. #ifndef UNW_REMOTE_ONLY
  114. ppc32_local_addr_space_init ();
  115. #endif
  116. tdep_needs_initialization = 0; /* signal that we're initialized... */
  117. }
  118. out:
  119. lock_release (&ppc32_lock, saved_mask);
  120. }