1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* libunwind - a platform-independent unwind library 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com Copyright (C) 2008 CodeSourcery 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.comThis file is part of libunwind. 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.comPermission is hereby granted, free of charge, to any person obtaining 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.coma copy of this software and associated documentation files (the 8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com"Software"), to deal in the Software without restriction, including 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comwithout limitation the rights to use, copy, modify, merge, publish, 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comdistribute, sublicense, and/or sell copies of the Software, and to 118b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgpermit persons to whom the Software is furnished to do so, subject to 128b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgthe following conditions: 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comThe above copyright notice and this permission notice shall be 15548a1f321011292359ef163f78c8a1d4871b3b7freed@google.comincluded in all copies or substantial portions of the Software. 164bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.comLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.comWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 25d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com#include "unwind_i.h" 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comPROTECTED int 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comunw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com{ 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com struct cursor *c = (struct cursor *) cursor; 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com dwarf_loc_t loc; 32d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com loc = DWARF_NULL_LOC; /* default to "not saved" */ 34fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (reg) 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 37d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R0: 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R1: 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R2: 40a728e35edcffd99216e3965a4b908ad0df7f69c2vandebo@chromium.org case UNW_ARM_R3: 41a728e35edcffd99216e3965a4b908ad0df7f69c2vandebo@chromium.org case UNW_ARM_R4: 42d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R5: 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R6: 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R7: 45d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R8: 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R9: 47d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R10: 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R11: 49d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R12: 50d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R13: 51d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com case UNW_ARM_R14: 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case UNW_ARM_R15: 53d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com loc = c->dwarf.loc[reg - UNW_ARM_R0]; 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 57d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com break; 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 59d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com memset (sloc, 0, sizeof (*sloc)); 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (DWARF_IS_NULL_LOC (loc)) 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 64fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com sloc->type = UNW_SLT_NONE; 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return 0; 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if !defined(UNW_LOCAL_ONLY) 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (DWARF_IS_REG_LOC (loc)) 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com sloc->type = UNW_SLT_REG; 72d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com sloc->u.regnum = DWARF_GET_LOC (loc); 734bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com } 74d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com else 75fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com#endif 764bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com { 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com sloc->type = UNW_SLT_MEMORY; 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com sloc->u.addr = DWARF_GET_LOC (loc); 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return 0; 81f3edf9fdc902465941cb763b9b4fdbfe7d004fd2reed@google.com} 82d7a6fb9779dac9ba74ace880afff98919174b8b1reed@google.com