00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 00038 #ifndef __UNWIND_CONSUMER_H 00039 #define __UNWIND_CONSUMER_H 00040 00041 /* unwind consumer verbose environment variable */ 00042 #define __UNW_CONSUMER_VERBOSE_ENV_VAR "_UNW_VERBOSE" 00043 extern __uint32_t _unwind_verbose; 00044 #define __UNW_VERBOSE_ERRORS 1 00045 #define __UNW_VERBOSE_WARNINGS 2 00046 #define __UNW_VERBOSE_MSGS 3 00047 #define __UNW_VERBOSE_INTERNAL_MSGS 4 00048 00049 /* unwind table space */ 00050 extern __unw_table_entry_t *_unwind_table; 00051 extern __uint64_t _unwind_table_size; 00052 00053 /* unwind info space */ 00054 extern __unw_info_t *_unwind_info; 00055 extern __uint64_t _unwind_info_size; 00056 00057 /* register restore info type */ 00058 #define __UNW_UNINITIALIZED 0 00059 #define __UNW_NO_RESTORE 1 00060 #define __UNW_RESTORE_OFF_GR 2 00061 #define __UNW_RESTORE_OFF_BR 3 00062 #define __UNW_RESTORE_SP_RELATIVE 4 00063 #define __UNW_RESTORE_PSP_RELATIVE 5 00064 #define __UNW_TO_RESTORE_PSP_RELATIVE 6 00065 #define __UNW_RESTORE_FIXED_VALUE 7 00066 typedef struct __unw_reg_info_struct { 00067 __uint32_t _code : 3; 00068 __uint32_t _reg : 29; 00069 __uint64_t _offset; 00070 } __unw_reg_info_t; 00071 00072 /* state restore info type */ 00073 #define __UNW_MAX_GR_PRESERVED 5 00074 #define __UNW_GR_STD_START 0 00075 #define __UNW_GR_STD_END 3 00076 #define __UNW_GR4 0 00077 #define __UNW_GR5 1 00078 #define __UNW_GR6 2 00079 #define __UNW_GR7 3 00080 #define __UNW_SP 4 00081 #define __UNW_MAX_FR_PRESERVED 20 00082 #define __UNW_FR_STD_START 0 00083 #define __UNW_FR_STD_END 19 00084 #define __UNW_FR_LOW_START 0 00085 #define __UNW_FR_LOW_END 3 00086 #define __UNW_FR_HIGH_START 4 00087 #define __UNW_FR_HIGH_END 19 00088 #define __UNW_FR2 0 00089 #define __UNW_FR3 1 00090 #define __UNW_FR4 2 00091 #define __UNW_FR5 3 00092 #define __UNW_FR16 4 00093 #define __UNW_FR17 5 00094 #define __UNW_FR18 6 00095 #define __UNW_FR19 7 00096 #define __UNW_FR20 8 00097 #define __UNW_FR21 9 00098 #define __UNW_FR22 10 00099 #define __UNW_FR23 11 00100 #define __UNW_FR24 12 00101 #define __UNW_FR25 13 00102 #define __UNW_FR26 14 00103 #define __UNW_FR27 15 00104 #define __UNW_FR28 16 00105 #define __UNW_FR29 17 00106 #define __UNW_FR30 18 00107 #define __UNW_FR31 19 00108 #define __UNW_MAX_BR_PRESERVED 6 00109 #define __UNW_BR_STD_START 1 00110 #define __UNW_BR_STD_END 5 00111 #define __UNW_RP 0 00112 #define __UNW_BR1 1 00113 #define __UNW_BR2 2 00114 #define __UNW_BR3 3 00115 #define __UNW_BR4 4 00116 #define __UNW_BR5 5 00117 #define __UNW_MAX_AR_PRESERVED 7 00118 00119 #define __UNW_BSP 0 00120 #define __UNW_BSPSTORE 1 00121 #define __UNW_RNAT 2 00122 #define __UNW_UNAT 3 00123 #define __UNW_FPSR 4 00124 #define __UNW_PFS 5 00125 #define __UNW_LC 6 00126 00127 typedef struct __unw_state_info_struct { 00128 __unw_reg_info_t _gr[__UNW_MAX_GR_PRESERVED]; 00129 __unw_reg_info_t _fr[__UNW_MAX_FR_PRESERVED]; 00130 __unw_reg_info_t _br[__UNW_MAX_BR_PRESERVED]; 00131 __unw_reg_info_t _ar[__UNW_MAX_AR_PRESERVED]; 00132 __unw_reg_info_t _preds; 00133 __unw_reg_info_t _priunat; 00134 __uint64_t _frame_size; 00135 __uint64_t _spill_base; 00136 __uint64_t _spill_offset; 00137 __uint64_t _spill_order; 00138 __uint64_t _label; 00139 } __unw_state_info_t; 00140 00141 /* unwind state stack space */ 00142 #define __UNW_STATE_STACK_ENTRIES_SIZE 0x80 00143 extern __unw_state_info_t *_unwind_state_stack; 00144 extern __uint64_t _unwind_state_stack_total_size; 00145 extern __uint64_t _unwind_state_stack_size; 00146 00147 /* unwind register mappings from state info to real registers */ 00148 extern const __uint32_t _unw_gr_map[__UNW_MAX_GR_PRESERVED]; 00149 extern const __uint32_t _unw_fr_map[__UNW_MAX_FR_PRESERVED]; 00150 extern const __uint32_t _unw_br_map[__UNW_MAX_BR_PRESERVED]; 00151 extern const __uint32_t _unw_ar_map[__UNW_MAX_AR_PRESERVED]; 00152 00153 /* context access macros */ 00154 #define __UNW_CONTEXT_ACCESS_GR(x,i) (((x)->context.sc_gr)[i]) 00155 #define __UNW_CONTEXT_ACCESS_FR(x,i) (((x)->context.sc_fr)[i]) 00156 #define __UNW_CONTEXT_ACCESS_BR(x,i) (((x)->context.sc_br)[i]) 00157 00158 #if 0 /* !defined(_LP64 ) || defined( FOR_GDB ) -- removed GMB */ /* Amaury */ 00159 #define __UNW_CONTEXT_ACCESS_AR(x,i) (((x)->context.sc_ar)[i]) 00160 #define __UNW_AR_MAP(i) (_unw_ar_map[(i)]) 00161 #define __UNW_CONTEXT_ACCESS_AR_EC(x) (((x)->context.sc_ar)[66]) 00162 #else 00163 #define __UNW_AR_MAP(i) (_unw_ar_map[(i)]) 00164 #define __UNW_CONTEXT_ACCESS_AR(x,i) *(((uint64_t*) &((x)->context.sc_ar_bsp) + i)) 00165 #define __UNW_CONTEXT_ACCESS_AR_EC(x) ((x)->sc_ar_ec) 00166 #endif 00167 00168 #define __UNW_CONTEXT_ACCESS_IP(x) ((x)->context.sc_ip) 00169 #define __UNW_CONTEXT_ACCESS_GP(x) (((x)->context.sc_gr)[1]) 00170 #define __UNW_CONTEXT_ACCESS_PREDS(x) (((x)->context.sc_pr)) 00171 #define __UNW_CONTEXT_ACCESS_PRIUNAT(x) ((x)->sc_priunat) 00172 00173 /* XXX temporary sigcontext_t definition XXX 00174 typedef struct sigcontext_struct { 00175 __uint64_t _gr[128]; 00176 long double _fr[128]; 00177 __uint64_t _br[8]; 00178 __uint64_t _ar[128]; 00179 __uint64_t _ip; 00180 unsigned char _preds[64]; 00181 __uint64_t _priunat; 00182 } sigcontext_t; */ 00183 00184 /* prototypes */ 00185 __unw_error_t unwind_state_stack_reset(void); 00186 __unw_error_t unwind_state_stack_pop(__uint64_t); 00187 __unw_error_t unwind_state_stack_push(__unw_state_info_t **); 00188 __unw_error_t unwind_state_stack_top(__unw_state_info_t **); 00189 __unw_error_t unwind_state_stack_search(__unw_state_info_t **, __uint64_t); 00190 __unw_error_t unwind_process_desc(__uint64_t, __unw_info_t *, __unw_state_info_t *); 00191 __unw_error_t unwind_output(char *, ...); 00192 00193 #endif
1.5.6