GDB (API)
|
00001 /* Target-dependent code for SPARC. 00002 00003 Copyright (C) 2003-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #ifndef SPARC_TDEP_H 00021 #define SPARC_TDEP_H 1 00022 00023 struct frame_info; 00024 struct gdbarch; 00025 struct regcache; 00026 struct regset; 00027 struct trad_frame_saved_reg; 00028 00029 /* Register offsets for the general-purpose register set. */ 00030 00031 struct sparc_gregset 00032 { 00033 int r_psr_offset; 00034 int r_pc_offset; 00035 int r_npc_offset; 00036 int r_y_offset; 00037 int r_wim_offset; 00038 int r_tbr_offset; 00039 int r_g1_offset; 00040 int r_l0_offset; 00041 int r_y_size; 00042 }; 00043 00044 struct sparc_fpregset 00045 { 00046 int r_f0_offset; 00047 int r_fsr_offset; 00048 }; 00049 00050 /* SPARC architecture-specific information. */ 00051 00052 struct gdbarch_tdep 00053 { 00054 /* Register numbers for the PN and nPC registers. The definitions 00055 for (64-bit) UltraSPARC differ from the (32-bit) SPARC 00056 definitions. */ 00057 int pc_regnum; 00058 int npc_regnum; 00059 00060 /* Register sets. */ 00061 struct regset *gregset; 00062 size_t sizeof_gregset; 00063 struct regset *fpregset; 00064 size_t sizeof_fpregset; 00065 00066 /* Offset of saved PC in jmp_buf. */ 00067 int jb_pc_offset; 00068 00069 /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't 00070 treat the PLT special when doing prologue analysis. */ 00071 size_t plt_entry_size; 00072 00073 /* Alternative location for trap return. Used for single-stepping. */ 00074 CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn); 00075 00076 /* ISA-specific data types. */ 00077 struct type *sparc_psr_type; 00078 struct type *sparc_fsr_type; 00079 struct type *sparc64_pstate_type; 00080 struct type *sparc64_fsr_type; 00081 struct type *sparc64_fprs_type; 00082 }; 00083 00084 /* Register numbers of various important registers. */ 00085 00086 enum sparc_regnum 00087 { 00088 SPARC_G0_REGNUM, /* %g0 */ 00089 SPARC_G1_REGNUM, 00090 SPARC_G2_REGNUM, 00091 SPARC_G3_REGNUM, 00092 SPARC_G4_REGNUM, 00093 SPARC_G5_REGNUM, 00094 SPARC_G6_REGNUM, 00095 SPARC_G7_REGNUM, /* %g7 */ 00096 SPARC_O0_REGNUM, /* %o0 */ 00097 SPARC_O1_REGNUM, 00098 SPARC_O2_REGNUM, 00099 SPARC_O3_REGNUM, 00100 SPARC_O4_REGNUM, 00101 SPARC_O5_REGNUM, 00102 SPARC_SP_REGNUM, /* %sp (%o6) */ 00103 SPARC_O7_REGNUM, /* %o7 */ 00104 SPARC_L0_REGNUM, /* %l0 */ 00105 SPARC_L1_REGNUM, 00106 SPARC_L2_REGNUM, 00107 SPARC_L3_REGNUM, 00108 SPARC_L4_REGNUM, 00109 SPARC_L5_REGNUM, 00110 SPARC_L6_REGNUM, 00111 SPARC_L7_REGNUM, /* %l7 */ 00112 SPARC_I0_REGNUM, /* %i0 */ 00113 SPARC_I1_REGNUM, 00114 SPARC_I2_REGNUM, 00115 SPARC_I3_REGNUM, 00116 SPARC_I4_REGNUM, 00117 SPARC_I5_REGNUM, 00118 SPARC_FP_REGNUM, /* %fp (%i6) */ 00119 SPARC_I7_REGNUM, /* %i7 */ 00120 SPARC_F0_REGNUM, /* %f0 */ 00121 SPARC_F1_REGNUM, 00122 SPARC_F2_REGNUM, 00123 SPARC_F3_REGNUM, 00124 SPARC_F4_REGNUM, 00125 SPARC_F5_REGNUM, 00126 SPARC_F6_REGNUM, 00127 SPARC_F7_REGNUM, 00128 SPARC_F31_REGNUM /* %f31 */ 00129 = SPARC_F0_REGNUM + 31 00130 }; 00131 00132 enum sparc32_regnum 00133 { 00134 SPARC32_Y_REGNUM /* %y */ 00135 = SPARC_F31_REGNUM + 1, 00136 SPARC32_PSR_REGNUM, /* %psr */ 00137 SPARC32_WIM_REGNUM, /* %wim */ 00138 SPARC32_TBR_REGNUM, /* %tbr */ 00139 SPARC32_PC_REGNUM, /* %pc */ 00140 SPARC32_NPC_REGNUM, /* %npc */ 00141 SPARC32_FSR_REGNUM, /* %fsr */ 00142 SPARC32_CSR_REGNUM, /* %csr */ 00143 00144 /* Pseudo registers. */ 00145 SPARC32_D0_REGNUM, /* %d0 */ 00146 SPARC32_D30_REGNUM /* %d30 */ 00147 = SPARC32_D0_REGNUM + 15 00148 }; 00149 00150 00151 struct sparc_frame_cache 00152 { 00153 /* Base address. */ 00154 CORE_ADDR base; 00155 CORE_ADDR pc; 00156 00157 /* Do we have a frame? */ 00158 int frameless_p; 00159 00160 /* The offset from the base register to the CFA. */ 00161 int frame_offset; 00162 00163 /* Mask of `local' and `in' registers saved in the register save area. */ 00164 unsigned short int saved_regs_mask; 00165 00166 /* Mask of `out' registers copied or renamed to their `in' sibling. */ 00167 unsigned char copied_regs_mask; 00168 00169 /* Do we have a Structure, Union or Quad-Precision return value? */ 00170 int struct_return_p; 00171 00172 /* Table of saved registers. */ 00173 struct trad_frame_saved_reg *saved_regs; 00174 }; 00175 00176 /* Fetch the instruction at PC. */ 00177 extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); 00178 00179 /* Fetch StackGhost Per-Process XOR cookie. */ 00180 extern ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch); 00181 00182 /* Record the effect of a SAVE instruction on CACHE. */ 00183 extern void sparc_record_save_insn (struct sparc_frame_cache *cache); 00184 00185 /* Do a full analysis of the prologue at PC and update CACHE accordingly. */ 00186 extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch, 00187 CORE_ADDR pc, CORE_ADDR current_pc, 00188 struct sparc_frame_cache *cache); 00189 00190 extern struct sparc_frame_cache * 00191 sparc_frame_cache (struct frame_info *this_frame, void **this_cache); 00192 00193 extern struct sparc_frame_cache * 00194 sparc32_frame_cache (struct frame_info *this_frame, void **this_cache); 00195 00196 00197 00198 extern int sparc_software_single_step (struct frame_info *frame); 00199 00200 extern void sparc_supply_rwindow (struct regcache *regcache, 00201 CORE_ADDR sp, int regnum); 00202 extern void sparc_collect_rwindow (const struct regcache *regcache, 00203 CORE_ADDR sp, int regnum); 00204 00205 /* Register offsets for SunOS 4. */ 00206 extern const struct sparc_gregset sparc32_sunos4_gregset; 00207 extern const struct sparc_fpregset sparc32_sunos4_fpregset; 00208 extern const struct sparc_fpregset sparc32_bsd_fpregset; 00209 00210 extern void sparc32_supply_gregset (const struct sparc_gregset *gregset, 00211 struct regcache *regcache, 00212 int regnum, const void *gregs); 00213 extern void sparc32_collect_gregset (const struct sparc_gregset *gregset, 00214 const struct regcache *regcache, 00215 int regnum, void *gregs); 00216 extern void sparc32_supply_fpregset (const struct sparc_fpregset *fpregset, 00217 struct regcache *regcache, 00218 int regnum, const void *fpregs); 00219 extern void sparc32_collect_fpregset (const struct sparc_fpregset *fpregset, 00220 const struct regcache *regcache, 00221 int regnum, void *fpregs); 00222 00223 /* Functions and variables exported from sparc-sol2-tdep.c. */ 00224 00225 /* Register offsets for Solaris 2. */ 00226 extern const struct sparc_gregset sparc32_sol2_gregset; 00227 extern const struct sparc_fpregset sparc32_sol2_fpregset; 00228 00229 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name); 00230 00231 extern const char *sparc_sol2_static_transform_name (const char *name); 00232 00233 extern void sparc32_sol2_init_abi (struct gdbarch_info info, 00234 struct gdbarch *gdbarch); 00235 00236 /* Functions and variables exported from sparcnbsd-tdep.c. */ 00237 00238 /* Register offsets for NetBSD. */ 00239 extern const struct sparc_gregset sparc32nbsd_gregset; 00240 00241 /* Return the address of a system call's alternative return 00242 address. */ 00243 extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame, 00244 unsigned long insn); 00245 00246 extern void sparc32nbsd_elf_init_abi (struct gdbarch_info info, 00247 struct gdbarch *gdbarch); 00248 00249 extern struct trad_frame_saved_reg * 00250 sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame); 00251 00252 #endif /* sparc-tdep.h */