17a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* libunwind - a platform-independent unwind library 27a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm Copyright (C) 2001-2005 Hewlett-Packard Co 37a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 47a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 57a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmThis file is part of libunwind. 67a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 77a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmPermission is hereby granted, free of charge, to any person obtaining 87a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidma copy of this software and associated documentation files (the 97a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm"Software"), to deal in the Software without restriction, including 107a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmwithout limitation the rights to use, copy, modify, merge, publish, 117a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to 127a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmpermit persons to whom the Software is furnished to do so, subject to 137a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmthe following conditions: 147a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 157a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmThe above copyright notice and this permission notice shall be 167a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmincluded in all copies or substantial portions of the Software. 177a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 187a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 197a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 217a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 227a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 237a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 247a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 257a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 267a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#ifndef IA64_LIBUNWIND_I_H 277a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define IA64_LIBUNWIND_I_H 287a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 297a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* Target-dependent definitions that are internal to libunwind but need 307a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm to be shared with target-independent code. */ 317a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 327a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#include "elf64.h" 337d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris/* ANDROID support update. */ 347d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris#include "map_info.h" 357d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris/* End of ANDROID update. */ 367a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#include "mempool.h" 377a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 385f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuuratypedef struct 395f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuura { 405f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuura /* no ia64-specific fast trace */ 415f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuura } 425f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuuraunw_tdep_frame_t; 435f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuura 447a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmenum ia64_pregnum 457a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 467a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* primary unat: */ 477a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_PRI_UNAT_GR, 487a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_PRI_UNAT_MEM, 497a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 507a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* memory stack (order matters: see build_script() */ 517a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_PSP, /* previous memory stack pointer */ 527a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* register stack */ 537a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_BSP, /* register stack pointer */ 547a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_BSPSTORE, 557a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_PFS, /* previous function state */ 567a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_RNAT, 577a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* instruction pointer: */ 587a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_IP, 597a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 607a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* preserved registers: */ 617a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_R4, IA64_REG_R5, IA64_REG_R6, IA64_REG_R7, 627a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_NAT4, IA64_REG_NAT5, IA64_REG_NAT6, IA64_REG_NAT7, 637a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_UNAT, IA64_REG_PR, IA64_REG_LC, IA64_REG_FPSR, 647a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_B1, IA64_REG_B2, IA64_REG_B3, IA64_REG_B4, IA64_REG_B5, 657a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_F2, IA64_REG_F3, IA64_REG_F4, IA64_REG_F5, 667a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_F16, IA64_REG_F17, IA64_REG_F18, IA64_REG_F19, 677a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_F20, IA64_REG_F21, IA64_REG_F22, IA64_REG_F23, 687a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_F24, IA64_REG_F25, IA64_REG_F26, IA64_REG_F27, 697a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_REG_F28, IA64_REG_F29, IA64_REG_F30, IA64_REG_F31, 707a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm IA64_NUM_PREGS 717a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm }; 727a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 737a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#ifdef UNW_LOCAL_ONLY 747a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 757a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmtypedef unw_word_t ia64_loc_t; 767a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 777a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#else /* !UNW_LOCAL_ONLY */ 787a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 797a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmtypedef struct ia64_loc 807a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 817a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t w0, w1; 827a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm } 837a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmia64_loc_t; 847a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 857a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#endif /* !UNW_LOCAL_ONLY */ 867a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 877a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#include "script.h" 887a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 897a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_UNKNOWN 0 907a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_LINUX 1 917a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_HPUX 2 927a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_FREEBSD 3 937a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_OPENVMS 4 947a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */ 957a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_WINDOWS 6 967a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 977a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmstruct unw_addr_space 987a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 997a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct unw_accessors acc; 1007a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm int big_endian; 1017a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */ 1027a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_caching_policy_t caching_policy; 1037a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#ifdef HAVE_ATOMIC_OPS_H 1047a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm AO_t cache_generation; 1057a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#else 1067a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint32_t cache_generation; 1077a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#endif 1087a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t dyn_generation; 1097a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ 1107a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#ifndef UNW_REMOTE_ONLY 1117a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unsigned long long shared_object_removals; 1127a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#endif 1137a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1147a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct ia64_script_cache global_cache; 1157d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris 1167d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris /* ANDROID support update. */ 1177d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris struct map_info *map_list; 1187d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris /* End of ANDROID update. */ 1197a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm }; 1207a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1217a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* Note: The ABI numbers in the ABI-markers (.unwabi directive) are 1227a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm not the same as the above ABI numbers. */ 1237a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's') 1247a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i') 1257a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1) 1267a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's') 1277a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i') 1287a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1297a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmstruct cursor 1307a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 1317a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm void *as_arg; /* argument to address-space callbacks */ 1327a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_addr_space_t as; /* reference to per-address-space info */ 1337a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1347a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* IP, CFM, and predicate cache (these are always equal to the 1357a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm values stored in ip_loc, cfm_loc, and pr_loc, 1367a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm respectively). */ 1377a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t ip; /* instruction pointer value */ 1387a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t cfm; /* current frame mask */ 1397a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t pr; /* current predicate values */ 1407a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1417a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* current frame info: */ 1427a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t bsp; /* backing store pointer value */ 1437a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t sp; /* stack pointer value */ 1447a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t psp; /* previous sp value */ 1457a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm ia64_loc_t cfm_loc; /* cfm save location (or NULL) */ 1467a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */ 1477a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm ia64_loc_t loc[IA64_NUM_PREGS]; 1487a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1497a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t eh_args[4]; /* exception handler arguments */ 1507a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t sigcontext_addr; /* address of sigcontext or 0 */ 1517a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */ 1527a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1537a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm short hint; 1547a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm short prev_script; 1557a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1567a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */ 1577a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint16_t abi_marker; /* abi_marker for current frame (if any) */ 1587a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint16_t last_abi_marker; /* last abi_marker encountered so far */ 1597a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint8_t eh_valid_mask; 1607a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1617a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unsigned int pi_valid :1; /* is proc_info valid? */ 1627a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */ 1637a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_proc_info_t pi; /* info about current procedure */ 1647a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1657a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* In case of stack-discontiguities, such as those introduced by 1667a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm signal-delivery on an alternate signal-stack (see 1677a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm sigaltstack(2)), we use the following data-structure to keep 1687a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm track of the register-backing-store areas across on which the 1697a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm current frame may be backed up. Since there are at most 96 1707a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm stacked registers and since we only have to track the current 1717a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm frame and only areas that are not empty, this puts an upper 1727a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm limit on the # of backing-store areas we have to track. 1737a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1747a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm Note that the rbs-area indexed by rbs_curr identifies the 1757a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm rbs-area that was in effect at the time AR.BSP had the value 1767a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm c->bsp. However, this rbs area may not actually contain the 1777a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm value in the register that c->bsp corresponds to because that 1787a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm register may not have gotten spilled until much later, when a 1797a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm possibly different rbs-area might have been in effect 1807a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm already. */ 1817a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */ 1827a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */ 1837a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct rbs_area 1847a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 1857a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t end; 1867a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t size; 1877a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm ia64_loc_t rnat_loc; 1887a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm } 1897a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */ 1907a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm}; 1917a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1927a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmstruct ia64_global_unwind_state 1937a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 1947a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm pthread_mutex_t lock; /* global data lock */ 1957a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1965d0f376b08126b51a001d7cdfba1ec4e0d644f54Tommi Rantala volatile char init_done; 1977a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 1987a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* Table of registers that prologues can save (and order in which 1997a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm they're saved). */ 2007a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm const unsigned char save_order[8]; 2017a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2027a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm /* 2037a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm * uc_addr() may return pointers to these variables. We need to 2047a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm * make sure they don't get written via ia64_put() or 2057a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm * ia64_putfp(). To make it possible to test for these variables 2067a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm * quickly, we collect them in a single sub-structure. 2077a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm */ 2087a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct 2097a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm { 2107a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t r0; /* r0 is byte-order neutral */ 2117a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_fpreg_t f0; /* f0 is byte-order neutral */ 2127a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */ 2137a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm } 2147a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm read_only; 2157a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_fpreg_t nat_val_le, nat_val_be; 2167a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_fpreg_t int_val_le, int_val_be; 2177a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2187a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct mempool reg_state_pool; 2197a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm struct mempool labeled_state_pool; 2207a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2217a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm# if UNW_DEBUG 2227a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm const char *preg_name[IA64_NUM_PREGS]; 2237a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm# endif 2247a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm }; 2257a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 226e2962af9d31266761700b431da894421c0d757ecArun Sharma#define tdep_getcontext_trace unw_getcontext 2275d0f376b08126b51a001d7cdfba1ec4e0d644f54Tommi Rantala#define tdep_init_done unw.init_done 2287a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_init UNW_OBJ(init) 2297a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* Platforms that support UNW_INFO_FORMAT_TABLE need to define 2307a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm tdep_search_unwind_table. */ 2317a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_search_unwind_table unw_search_ia64_unwind_table 232d93d96ad833390519ea68a2df22dd55dd26a3214Martin Milata#define tdep_find_unwind_table ia64_find_unwind_table 2337a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_find_proc_info UNW_OBJ(find_proc_info) 2347a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_uc_addr UNW_OBJ(uc_addr) 2357a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) 2367a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_access_reg UNW_OBJ(access_reg) 2377a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_access_fpreg UNW_OBJ(access_fpreg) 238dac2d001afb1fa7040ca7d8ae57032f684d7023eLassi Tuura#define tdep_fetch_frame(c,ip,n) do {} while(0) 239dac2d001afb1fa7040ca7d8ae57032f684d7023eLassi Tuura#define tdep_cache_frame(c,rs) do {} while(0) 240dac2d001afb1fa7040ca7d8ae57032f684d7023eLassi Tuura#define tdep_reuse_frame(c,rs) do {} while(0) 2419e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura#define tdep_stash_frame(c,rs) do {} while(0) 2425f38f35d5d6c78aafa6da20845d9ceff74af00f8Lassi Tuura#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) 2437a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_get_as(c) ((c)->as) 2447a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_get_as_arg(c) ((c)->as_arg) 2457a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_get_ip(c) ((c)->ip) 2467a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define tdep_big_endian(as) ((c)->as->big_endian != 0) 2477a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2487a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#ifndef UNW_LOCAL_ONLY 2497a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm# define tdep_put_unwind_info UNW_OBJ(put_unwind_info) 2507a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#endif 2517a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2527a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* This can't be an UNW_ARCH_OBJ() because we need separate 2537a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw.initialized flags for the local-only and generic versions of 2547a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm the library. Also, if we wanted to have a single, shared global 2557a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm data structure, we couldn't declare "unw" as HIDDEN/PROTECTED. */ 2567a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define unw UNW_OBJ(data) 2577a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2587a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern void tdep_init (void); 259fca254a9b4a96de9a5f3519f736dd01585b9a648Tommi Rantalaextern int tdep_find_unwind_table (struct elf_dyn_info *edi, 260fca254a9b4a96de9a5f3519f736dd01585b9a648Tommi Rantala unw_addr_space_t as, char *path, 261fca254a9b4a96de9a5f3519f736dd01585b9a648Tommi Rantala unw_word_t segbase, unw_word_t mapoff, 262fca254a9b4a96de9a5f3519f736dd01585b9a648Tommi Rantala unw_word_t ip); 2637a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, 2647a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_proc_info_t *pi, int need_unwind_info, 2657a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm void *arg); 2667a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern void tdep_put_unwind_info (unw_addr_space_t as, 2677a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_proc_info_t *pi, void *arg); 2687a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum, 2697a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm uint8_t *nat_bitnr); 27016b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* ANDROID support update. */ 271f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, 272f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris pid_t pid, unw_word_t ip, 273f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris unsigned long *segbase, unsigned long *mapoff, 274f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris char **path); 27516b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* End of ANDROID update. */ 2767a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, 2777a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_word_t *valp, int write); 2787a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, 2797a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm unw_fpreg_t *valp, int write); 2807a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2817a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidmextern struct ia64_global_unwind_state unw; 2827a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2837a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm/* In user-level, we have no reasonable way of determining the base of 2847a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm an arbitrary backing-store. We default to half the 2857a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm address-space. */ 2867a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#define rbs_get_base(c,bspstore,rbs_basep) \ 2877a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm (*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0) 2887a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm 2897a8b0ba6176eb3f6636c30cc238e5204b268840chp.com!davidm#endif /* IA64_LIBUNWIND_I_H */ 290