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 7This file is part of libunwind. 8 9Permission is hereby granted, free of charge, to any person obtaining 10a copy of this software and associated documentation files (the 11"Software"), to deal in the Software without restriction, including 12without limitation the rights to use, copy, modify, merge, publish, 13distribute, sublicense, and/or sell copies of the Software, and to 14permit persons to whom the Software is furnished to do so, subject to 15the following conditions: 16 17The above copyright notice and this permission notice shall be 18included in all copies or substantial portions of the Software. 19 20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 27 28#include "unwind_i.h" 29 30static inline int 31common_init_ppc64 (struct cursor *c, unsigned use_prev_instr) 32{ 33 int ret; 34 int i; 35 36 for (i = UNW_PPC64_R0; i <= UNW_PPC64_R31; i++) { 37 c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i); 38 } 39 for (i = UNW_PPC64_F0; i <= UNW_PPC64_F31; i++) { 40 c->dwarf.loc[i] = DWARF_FPREG_LOC (&c->dwarf, i); 41 } 42 for (i = UNW_PPC64_V0; i <= UNW_PPC64_V31; i++) { 43 c->dwarf.loc[i] = DWARF_VREG_LOC (&c->dwarf, i); 44 } 45 46 for (i = UNW_PPC64_CR0; i <= UNW_PPC64_CR7; i++) { 47 c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i); 48 } 49 c->dwarf.loc[UNW_PPC64_ARG_POINTER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ARG_POINTER); 50 c->dwarf.loc[UNW_PPC64_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CTR); 51 c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VSCR); 52 53 c->dwarf.loc[UNW_PPC64_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_XER); 54 c->dwarf.loc[UNW_PPC64_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_LR); 55 c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VRSAVE); 56 c->dwarf.loc[UNW_PPC64_SPEFSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPEFSCR); 57 c->dwarf.loc[UNW_PPC64_SPE_ACC] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPE_ACC); 58 59 c->dwarf.loc[UNW_PPC64_NIP] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_NIP); 60 61 ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_PPC64_NIP], &c->dwarf.ip); 62 if (ret < 0) 63 return ret; 64 65 ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1), 66 &c->dwarf.cfa); 67 if (ret < 0) 68 return ret; 69 70 c->sigcontext_format = PPC_SCF_NONE; 71 c->sigcontext_addr = 0; 72 73 c->dwarf.args_size = 0; 74 c->dwarf.ret_addr_column = 0; 75 c->dwarf.stash_frames = 0; 76 c->dwarf.use_prev_instr = use_prev_instr; 77 c->dwarf.pi_valid = 0; 78 c->dwarf.pi_is_dynamic = 0; 79 c->dwarf.hint = 0; 80 c->dwarf.prev_rs = 0; 81 /* ANDROID support update. */ 82 c->dwarf.frame = 0; 83 /* End of ANDROID update. */ 84 85 return 0; 86} 87