unwind_i.h revision 6498cdf4d9877f4c78f8b4429e2abf70d17a550d
16498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm/* libunwind - a platform-independent unwind library 26498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm Copyright (C) 2003 Hewlett-Packard Co 36498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm Contributed by ... 46498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 56498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmThis file is part of libunwind. 66498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 76498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmPermission is hereby granted, free of charge, to any person obtaining 86498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidma copy of this software and associated documentation files (the 96498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm"Software"), to deal in the Software without restriction, including 106498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmwithout limitation the rights to use, copy, modify, merge, publish, 116498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to 126498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmpermit persons to whom the Software is furnished to do so, subject to 136498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmthe following conditions: 146498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 156498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmThe above copyright notice and this permission notice shall be 166498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmincluded in all copies or substantial portions of the Software. 176498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 186498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 196498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 206498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 216498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 226498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 236498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 246498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 256498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 266498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#ifndef unwind_i_h 276498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define unwind_i_h 286498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 296498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#include <memory.h> 306498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#include <stdint.h> 316498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 326498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#include <libunwind-hppa.h> 336498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 346498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#include "internal.h" 356498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#include "tdep.h" 366498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 376498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define HPPA_GET_LOC(l) ((l).val) 386498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 396498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#ifdef UNW_LOCAL_ONLY 406498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_LOC(r, t) ((struct hppa_loc) { .val = (r) }) 416498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_REG_LOC(c,r) (HPPA_LOC((unw_word_t) \ 426498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm tdep_uc_addr((c)->as_arg, (r)), 0)) 436498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_FPREG_FLOC(c,r) (HPPA_LOC((unw_word_t) \ 446498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm tdep_uc_addr((c)->as_arg, (r)), 0)) 456498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 466498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 476498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_getfp (struct cursor *c, struct hppa_loc loc, unw_fpreg_t *val) 486498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 496498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (!HPPA_GET_LOC (loc)) 506498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return -1; 516498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm *val = *(unw_fpreg_t *) HPPA_GET_LOC (loc); 526498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return 0; 536498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 546498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 556498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 566498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_putfp (struct cursor *c, struct hppa_loc loc, unw_fpreg_t *val) 576498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 586498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (!HPPA_GET_LOC (loc)) 596498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return -1; 606498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm *(unw_fpreg_t *) HPPA_GET_LOC (loc) = *val; 616498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return 0; 626498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 636498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 646498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 656498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_get (struct cursor *c, struct hppa_loc loc, unw_word_t *val) 666498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 676498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (!HPPA_GET_LOC (loc)) 686498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return -1; 696498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm *val = *(unw_word_t *) HPPA_GET_LOC (loc); 706498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return 0; 716498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 726498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 736498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 746498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_put (struct cursor *c, struct hppa_loc loc, unw_word_t val) 756498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 766498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (!HPPA_GET_LOC (loc)) 776498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return -1; 786498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm *(unw_word_t *) HPPA_GET_LOC (loc) = val; 796498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return 0; 806498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 816498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 826498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#else /* !UNW_LOCAL_ONLY */ 836498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_LOC_TYPE_FP (1 << 0) 846498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_LOC_TYPE_REG (1 << 1) 856498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_LOC(r, t) ((struct hppa_loc) { .val = (r), .type = (t) }) 866498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_IS_REG_LOC(l) (((l).type & HPPA_LOC_TYPE_REG) != 0) 876498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_IS_FP_LOC(l) (((l).type & HPPA_LOC_TYPE_FP) != 0) 886498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_REG_LOC(c,r) HPPA_LOC((r), HPPA_LOC_TYPE_REG) 896498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm# define HPPA_FPREG_LOC(c,r) HPPA_LOC((r), (HPPA_LOC_TYPE_REG \ 906498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm | HPPA_LOC_TYPE_FP)) 916498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 926498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 936498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_getfp (struct cursor *c, struct hppa_loc loc, unw_fpreg_t *val) 946498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 956498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm abort (); 966498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 976498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 986498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 996498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_putfp (struct cursor *c, struct hppa_loc loc, unw_fpreg_t val) 1006498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 1016498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm abort (); 1026498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 1036498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1046498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 1056498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_get (struct cursor *c, struct hppa_loc loc, unw_word_t *val) 1066498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 1076498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (HPPA_IS_FP_LOC (loc)) 1086498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm abort (); 1096498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1106498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (HPPA_IS_REG_LOC (loc)) 1116498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return (*c->as->acc.access_reg)(c->as, HPPA_GET_LOC (loc), val, 0, 1126498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm c->as_arg); 1136498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm else 1146498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return (*c->as->acc.access_mem)(c->as, HPPA_GET_LOC (loc), val, 0, 1156498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm c->as_arg); 1166498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 1176498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1186498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmstatic inline int 1196498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmhppa_put (struct cursor *c, struct hppa_loc loc, unw_word_t val) 1206498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm{ 1216498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (HPPA_IS_FP_LOC (loc)) 1226498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm abort (); 1236498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1246498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm if (HPPA_IS_REG_LOC (loc)) 1256498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return (*c->as->acc.access_reg)(c->as, HPPA_GET_LOC (loc), &val, 1, 1266498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm c->as_arg); 1276498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm else 1286498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm return (*c->as->acc.access_mem)(c->as, HPPA_GET_LOC (loc), &val, 1, 1296498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm c->as_arg); 1306498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm} 1316498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1326498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#endif /* !UNW_LOCAL_ONLY */ 1336498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1346498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_needs_initialization UNW_ARCH_OBJ(needs_initialization) 1356498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_init UNW_ARCH_OBJ(init) 1366498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_access_reg UNW_OBJ(access_reg) 1376498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_access_fpreg UNW_OBJ(access_fpreg) 1386498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_local_resume UNW_OBJ(local_resume) 1396498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#define hppa_local_addr_space_init UNW_OBJ(local_addr_space_init) 1406498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1416498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern int hppa_needs_initialization; 1426498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1436498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern void hppa_init (void); 1446498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern int hppa_access_reg (struct cursor *c, unw_regnum_t reg, 1456498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm unw_word_t *valp, int write); 1466498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern int hppa_access_fpreg (struct cursor *c, unw_regnum_t reg, 1476498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm unw_fpreg_t *valp, int write); 1486498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern void hppa_local_addr_space_init (void); 1496498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidmextern int hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, 1506498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm void *arg); 1516498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm 1526498cdf4d9877f4c78f8b4429e2abf70d17a550dhp.com!davidm#endif /* unwind_i_h */ 153