Gstep.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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 "ucontext_i.h"
  25. #include <signal.h>
  26. /* This definition originates in /usr/include/asm-ppc64/ptrace.h, but is
  27. defined there only when __KERNEL__ is defined. We reproduce it here for
  28. our use at the user level in order to locate the ucontext record, which
  29. appears to be at this offset relative to the stack pointer when in the
  30. context of the signal handler return trampoline code -
  31. __kernel_sigtramp_rt64. */
  32. #define __SIGNAL_FRAMESIZE 128
  33. /* This definition comes from the document "64-bit PowerPC ELF Application
  34. Binary Interface Supplement 1.9", section 3.2.2.
  35. http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK */
  36. typedef struct
  37. {
  38. long unsigned back_chain;
  39. long unsigned cr_save;
  40. long unsigned lr_save;
  41. /* many more fields here, but they are unused by this code */
  42. } stack_frame_t;
  43. PROTECTED int
  44. unw_step (unw_cursor_t * cursor)
  45. {
  46. struct cursor *c = (struct cursor *) cursor;
  47. stack_frame_t dummy;
  48. unw_word_t back_chain_offset, lr_save_offset, v_regs_ptr;
  49. struct dwarf_loc back_chain_loc, lr_save_loc, sp_loc, ip_loc, v_regs_loc;
  50. int ret;
  51. Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->dwarf.ip);
  52. if (c->dwarf.ip == 0)
  53. {
  54. /* Unless the cursor or stack is corrupt or uninitialized,
  55. we've most likely hit the top of the stack */
  56. return 0;
  57. }
  58. /* Try DWARF-based unwinding... */
  59. ret = dwarf_step (&c->dwarf);
  60. if (ret < 0 && ret != -UNW_ENOINFO)
  61. {
  62. Debug (2, "returning %d\n", ret);
  63. return ret;
  64. }
  65. if (unlikely (ret < 0))
  66. {
  67. if (likely (!unw_is_signal_frame (cursor)))
  68. {
  69. /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode
  70. produces the mandatory level of traceback record in the code, but
  71. I get the impression that this is transitory, that eventually gcc
  72. will not produce any traceback records at all. So, for now, we
  73. won't bother to try to find and use these records.
  74. We can, however, attempt to unwind the frame by using the callback
  75. chain. This is very crude, however, and won't be able to unwind
  76. any registers besides the IP, SP, and LR . */
  77. back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy);
  78. lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy);
  79. back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0);
  80. if ((ret =
  81. dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0)
  82. {
  83. Debug
  84. ("Unable to retrieve CFA from back chain in stack frame - %d\n",
  85. ret);
  86. return ret;
  87. }
  88. if (c->dwarf.cfa == 0)
  89. /* Unless the cursor or stack is corrupt or uninitialized we've most
  90. likely hit the top of the stack */
  91. return 0;
  92. lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0);
  93. if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0)
  94. {
  95. Debug
  96. ("Unable to retrieve IP from lr save in stack frame - %d\n",
  97. ret);
  98. return ret;
  99. }
  100. ret = 1;
  101. }
  102. else
  103. {
  104. /* Find the sigcontext record by taking the CFA and adjusting by
  105. the dummy signal frame size.
  106. Note that there isn't any way to determined if SA_SIGINFO was
  107. set in the sa_flags parameter to sigaction when the signal
  108. handler was established. If it was not set, the ucontext
  109. record is not required to be on the stack, in which case the
  110. following code will likely cause a seg fault or other crash
  111. condition. */
  112. unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE;
  113. Debug (1, "signal frame, skip over trampoline\n");
  114. c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
  115. c->sigcontext_addr = ucontext;
  116. sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
  117. ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
  118. ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
  119. if (ret < 0)
  120. {
  121. Debug (2, "returning %d\n", ret);
  122. return ret;
  123. }
  124. ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip);
  125. if (ret < 0)
  126. {
  127. Debug (2, "returning %d\n", ret);
  128. return ret;
  129. }
  130. /* Instead of just restoring the non-volatile registers, do all
  131. of the registers for now. This will incur a performance hit,
  132. but it's rare enough not to cause too much of a problem, and
  133. might be useful in some cases. */
  134. c->dwarf.loc[UNW_PPC64_R0] =
  135. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0);
  136. c->dwarf.loc[UNW_PPC64_R1] =
  137. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
  138. c->dwarf.loc[UNW_PPC64_R2] =
  139. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0);
  140. c->dwarf.loc[UNW_PPC64_R3] =
  141. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0);
  142. c->dwarf.loc[UNW_PPC64_R4] =
  143. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0);
  144. c->dwarf.loc[UNW_PPC64_R5] =
  145. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0);
  146. c->dwarf.loc[UNW_PPC64_R6] =
  147. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0);
  148. c->dwarf.loc[UNW_PPC64_R7] =
  149. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0);
  150. c->dwarf.loc[UNW_PPC64_R8] =
  151. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
  152. c->dwarf.loc[UNW_PPC64_R9] =
  153. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
  154. c->dwarf.loc[UNW_PPC64_R10] =
  155. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
  156. c->dwarf.loc[UNW_PPC64_R11] =
  157. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
  158. c->dwarf.loc[UNW_PPC64_R12] =
  159. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
  160. c->dwarf.loc[UNW_PPC64_R13] =
  161. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
  162. c->dwarf.loc[UNW_PPC64_R14] =
  163. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
  164. c->dwarf.loc[UNW_PPC64_R15] =
  165. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
  166. c->dwarf.loc[UNW_PPC64_R16] =
  167. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0);
  168. c->dwarf.loc[UNW_PPC64_R17] =
  169. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0);
  170. c->dwarf.loc[UNW_PPC64_R18] =
  171. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0);
  172. c->dwarf.loc[UNW_PPC64_R19] =
  173. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0);
  174. c->dwarf.loc[UNW_PPC64_R20] =
  175. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0);
  176. c->dwarf.loc[UNW_PPC64_R21] =
  177. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0);
  178. c->dwarf.loc[UNW_PPC64_R22] =
  179. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0);
  180. c->dwarf.loc[UNW_PPC64_R23] =
  181. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0);
  182. c->dwarf.loc[UNW_PPC64_R24] =
  183. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0);
  184. c->dwarf.loc[UNW_PPC64_R25] =
  185. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0);
  186. c->dwarf.loc[UNW_PPC64_R26] =
  187. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0);
  188. c->dwarf.loc[UNW_PPC64_R27] =
  189. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0);
  190. c->dwarf.loc[UNW_PPC64_R28] =
  191. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0);
  192. c->dwarf.loc[UNW_PPC64_R29] =
  193. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0);
  194. c->dwarf.loc[UNW_PPC64_R30] =
  195. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0);
  196. c->dwarf.loc[UNW_PPC64_R31] =
  197. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0);
  198. c->dwarf.loc[UNW_PPC64_LR] =
  199. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
  200. c->dwarf.loc[UNW_PPC64_CTR] =
  201. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0);
  202. /* This CR0 assignment is probably wrong. There are 8 dwarf columns
  203. assigned to the CR registers, but only one CR register in the
  204. mcontext structure */
  205. c->dwarf.loc[UNW_PPC64_CR0] =
  206. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0);
  207. c->dwarf.loc[UNW_PPC64_XER] =
  208. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0);
  209. c->dwarf.loc[UNW_PPC64_NIP] =
  210. DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
  211. /* TODO: Is there a way of obtaining the value of the
  212. pseudo frame pointer (which is sp + some fixed offset, I
  213. assume), based on the contents of the ucontext record
  214. structure? For now, set this loc to null. */
  215. c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC;
  216. c->dwarf.loc[UNW_PPC64_F0] =
  217. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0);
  218. c->dwarf.loc[UNW_PPC64_F1] =
  219. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0);
  220. c->dwarf.loc[UNW_PPC64_F2] =
  221. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0);
  222. c->dwarf.loc[UNW_PPC64_F3] =
  223. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0);
  224. c->dwarf.loc[UNW_PPC64_F4] =
  225. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0);
  226. c->dwarf.loc[UNW_PPC64_F5] =
  227. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0);
  228. c->dwarf.loc[UNW_PPC64_F6] =
  229. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0);
  230. c->dwarf.loc[UNW_PPC64_F7] =
  231. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0);
  232. c->dwarf.loc[UNW_PPC64_F8] =
  233. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0);
  234. c->dwarf.loc[UNW_PPC64_F9] =
  235. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0);
  236. c->dwarf.loc[UNW_PPC64_F10] =
  237. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0);
  238. c->dwarf.loc[UNW_PPC64_F11] =
  239. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0);
  240. c->dwarf.loc[UNW_PPC64_F12] =
  241. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0);
  242. c->dwarf.loc[UNW_PPC64_F13] =
  243. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0);
  244. c->dwarf.loc[UNW_PPC64_F14] =
  245. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0);
  246. c->dwarf.loc[UNW_PPC64_F15] =
  247. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0);
  248. c->dwarf.loc[UNW_PPC64_F16] =
  249. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0);
  250. c->dwarf.loc[UNW_PPC64_F17] =
  251. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0);
  252. c->dwarf.loc[UNW_PPC64_F18] =
  253. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0);
  254. c->dwarf.loc[UNW_PPC64_F19] =
  255. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0);
  256. c->dwarf.loc[UNW_PPC64_F20] =
  257. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0);
  258. c->dwarf.loc[UNW_PPC64_F21] =
  259. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0);
  260. c->dwarf.loc[UNW_PPC64_F22] =
  261. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0);
  262. c->dwarf.loc[UNW_PPC64_F23] =
  263. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0);
  264. c->dwarf.loc[UNW_PPC64_F24] =
  265. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0);
  266. c->dwarf.loc[UNW_PPC64_F25] =
  267. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0);
  268. c->dwarf.loc[UNW_PPC64_F26] =
  269. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0);
  270. c->dwarf.loc[UNW_PPC64_F27] =
  271. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0);
  272. c->dwarf.loc[UNW_PPC64_F28] =
  273. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0);
  274. c->dwarf.loc[UNW_PPC64_F29] =
  275. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0);
  276. c->dwarf.loc[UNW_PPC64_F30] =
  277. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0);
  278. c->dwarf.loc[UNW_PPC64_F31] =
  279. DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0);
  280. /* Note that there is no .eh_section register column for the
  281. FPSCR register. I don't know why this is. */
  282. v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0);
  283. ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr);
  284. if (ret < 0)
  285. {
  286. Debug (2, "returning %d\n", ret);
  287. return ret;
  288. }
  289. if (v_regs_ptr != 0)
  290. {
  291. /* The v_regs_ptr is not null. Set all of the AltiVec locs */
  292. c->dwarf.loc[UNW_PPC64_V0] =
  293. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0);
  294. c->dwarf.loc[UNW_PPC64_V1] =
  295. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0);
  296. c->dwarf.loc[UNW_PPC64_V2] =
  297. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0);
  298. c->dwarf.loc[UNW_PPC64_V3] =
  299. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0);
  300. c->dwarf.loc[UNW_PPC64_V4] =
  301. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0);
  302. c->dwarf.loc[UNW_PPC64_V5] =
  303. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0);
  304. c->dwarf.loc[UNW_PPC64_V6] =
  305. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0);
  306. c->dwarf.loc[UNW_PPC64_V7] =
  307. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0);
  308. c->dwarf.loc[UNW_PPC64_V8] =
  309. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0);
  310. c->dwarf.loc[UNW_PPC64_V9] =
  311. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0);
  312. c->dwarf.loc[UNW_PPC64_V10] =
  313. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0);
  314. c->dwarf.loc[UNW_PPC64_V11] =
  315. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0);
  316. c->dwarf.loc[UNW_PPC64_V12] =
  317. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0);
  318. c->dwarf.loc[UNW_PPC64_V13] =
  319. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0);
  320. c->dwarf.loc[UNW_PPC64_V14] =
  321. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0);
  322. c->dwarf.loc[UNW_PPC64_V15] =
  323. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0);
  324. c->dwarf.loc[UNW_PPC64_V16] =
  325. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0);
  326. c->dwarf.loc[UNW_PPC64_V17] =
  327. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0);
  328. c->dwarf.loc[UNW_PPC64_V18] =
  329. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0);
  330. c->dwarf.loc[UNW_PPC64_V19] =
  331. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0);
  332. c->dwarf.loc[UNW_PPC64_V20] =
  333. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0);
  334. c->dwarf.loc[UNW_PPC64_V21] =
  335. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0);
  336. c->dwarf.loc[UNW_PPC64_V22] =
  337. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0);
  338. c->dwarf.loc[UNW_PPC64_V23] =
  339. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0);
  340. c->dwarf.loc[UNW_PPC64_V24] =
  341. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0);
  342. c->dwarf.loc[UNW_PPC64_V25] =
  343. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0);
  344. c->dwarf.loc[UNW_PPC64_V26] =
  345. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0);
  346. c->dwarf.loc[UNW_PPC64_V27] =
  347. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0);
  348. c->dwarf.loc[UNW_PPC64_V28] =
  349. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0);
  350. c->dwarf.loc[UNW_PPC64_V29] =
  351. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0);
  352. c->dwarf.loc[UNW_PPC64_V30] =
  353. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0);
  354. c->dwarf.loc[UNW_PPC64_V31] =
  355. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0);
  356. c->dwarf.loc[UNW_PPC64_VRSAVE] =
  357. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0);
  358. c->dwarf.loc[UNW_PPC64_VSCR] =
  359. DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0);
  360. }
  361. else
  362. {
  363. c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC;
  364. c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC;
  365. c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC;
  366. c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC;
  367. c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC;
  368. c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC;
  369. c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC;
  370. c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC;
  371. c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC;
  372. c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC;
  373. c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC;
  374. c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC;
  375. c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC;
  376. c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC;
  377. c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC;
  378. c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC;
  379. c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC;
  380. c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC;
  381. c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC;
  382. c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC;
  383. c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC;
  384. c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC;
  385. c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC;
  386. c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC;
  387. c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC;
  388. c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC;
  389. c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC;
  390. c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC;
  391. c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC;
  392. c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC;
  393. c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC;
  394. c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC;
  395. c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC;
  396. c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC;
  397. }
  398. ret = 1;
  399. }
  400. }
  401. return ret;
  402. }