Commit | Line | Data |
---|---|---|
386c036b | 1 | /* Target-dependent code for SPARC. |
c139e7d9 | 2 | |
6aba47ca | 3 | Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. |
c139e7d9 DJ |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
197e01b6 EZ |
19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. */ | |
c139e7d9 | 21 | |
386c036b MK |
22 | #ifndef SPARC_TDEP_H |
23 | #define SPARC_TDEP_H 1 | |
24 | ||
566626fa | 25 | struct frame_info; |
386c036b MK |
26 | struct gdbarch; |
27 | struct regcache; | |
a54124c5 | 28 | struct regset; |
386c036b MK |
29 | struct trad_frame_saved_reg; |
30 | ||
31 | /* Register offsets for the general-purpose register set. */ | |
32 | ||
33 | struct sparc_gregset | |
34 | { | |
35 | int r_psr_offset; | |
36 | int r_pc_offset; | |
37 | int r_npc_offset; | |
38 | int r_y_offset; | |
39 | int r_wim_offset; | |
40 | int r_tbr_offset; | |
41 | int r_g1_offset; | |
42 | int r_l0_offset; | |
43 | int r_y_size; | |
44 | }; | |
45 | ||
46 | /* SPARC architecture-specific information. */ | |
47 | ||
48 | struct gdbarch_tdep | |
49 | { | |
50 | /* Register numbers for the PN and nPC registers. The definitions | |
51 | for (64-bit) UltraSPARC differ from the (32-bit) SPARC | |
52 | definitions. */ | |
53 | int pc_regnum; | |
54 | int npc_regnum; | |
55 | ||
a54124c5 MK |
56 | /* Register sets. */ |
57 | struct regset *gregset; | |
58 | size_t sizeof_gregset; | |
59 | struct regset *fpregset; | |
60 | size_t sizeof_fpregset; | |
61 | ||
386c036b MK |
62 | /* Offset of saved PC in jmp_buf. */ |
63 | int jb_pc_offset; | |
64 | ||
65 | /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't | |
66 | treat the PLT special when doing prologue analysis. */ | |
67 | size_t plt_entry_size; | |
c893be75 MK |
68 | |
69 | /* Alternative location for trap return. Used for single-stepping. */ | |
70 | CORE_ADDR (*step_trap) (unsigned long insn); | |
386c036b MK |
71 | }; |
72 | ||
73 | /* Register numbers of various important registers. */ | |
74 | ||
75 | enum sparc_regnum | |
76 | { | |
77 | SPARC_G0_REGNUM, /* %g0 */ | |
78 | SPARC_G1_REGNUM, | |
79 | SPARC_G2_REGNUM, | |
80 | SPARC_G3_REGNUM, | |
81 | SPARC_G4_REGNUM, | |
82 | SPARC_G5_REGNUM, | |
83 | SPARC_G6_REGNUM, | |
84 | SPARC_G7_REGNUM, /* %g7 */ | |
85 | SPARC_O0_REGNUM, /* %o0 */ | |
86 | SPARC_O1_REGNUM, | |
87 | SPARC_O2_REGNUM, | |
88 | SPARC_O3_REGNUM, | |
89 | SPARC_O4_REGNUM, | |
90 | SPARC_O5_REGNUM, | |
91 | SPARC_SP_REGNUM, /* %sp (%o6) */ | |
92 | SPARC_O7_REGNUM, /* %o7 */ | |
93 | SPARC_L0_REGNUM, /* %l0 */ | |
94 | SPARC_L1_REGNUM, | |
95 | SPARC_L2_REGNUM, | |
96 | SPARC_L3_REGNUM, | |
97 | SPARC_L4_REGNUM, | |
98 | SPARC_L5_REGNUM, | |
99 | SPARC_L6_REGNUM, | |
100 | SPARC_L7_REGNUM, /* %l7 */ | |
101 | SPARC_I0_REGNUM, /* %i0 */ | |
102 | SPARC_I1_REGNUM, | |
103 | SPARC_I2_REGNUM, | |
104 | SPARC_I3_REGNUM, | |
105 | SPARC_I4_REGNUM, | |
106 | SPARC_I5_REGNUM, | |
107 | SPARC_FP_REGNUM, /* %fp (%i6) */ | |
108 | SPARC_I7_REGNUM, /* %i7 */ | |
109 | SPARC_F0_REGNUM, /* %f0 */ | |
110 | SPARC_F1_REGNUM, | |
111 | SPARC_F31_REGNUM /* %f31 */ | |
112 | = SPARC_F0_REGNUM + 31 | |
113 | }; | |
114 | ||
115 | enum sparc32_regnum | |
116 | { | |
117 | SPARC32_Y_REGNUM /* %y */ | |
118 | = SPARC_F31_REGNUM + 1, | |
119 | SPARC32_PSR_REGNUM, /* %psr */ | |
120 | SPARC32_WIM_REGNUM, /* %wim */ | |
121 | SPARC32_TBR_REGNUM, /* %tbr */ | |
122 | SPARC32_PC_REGNUM, /* %pc */ | |
123 | SPARC32_NPC_REGNUM, /* %npc */ | |
124 | SPARC32_FSR_REGNUM, /* %fsr */ | |
125 | SPARC32_CSR_REGNUM, /* %csr */ | |
126 | ||
127 | /* Pseudo registers. */ | |
128 | SPARC32_D0_REGNUM, /* %d0 */ | |
129 | SPARC32_D30_REGNUM /* %d30 */ | |
130 | = SPARC32_D0_REGNUM + 15 | |
131 | }; | |
132 | \f | |
133 | ||
134 | struct sparc_frame_cache | |
135 | { | |
136 | /* Base address. */ | |
137 | CORE_ADDR base; | |
138 | CORE_ADDR pc; | |
139 | ||
140 | /* Do we have a frame? */ | |
141 | int frameless_p; | |
142 | ||
143 | /* Do we have a Structure, Union or Quad-Precision return value?. */ | |
144 | int struct_return_p; | |
145 | ||
146 | /* Table of saved registers. */ | |
147 | struct trad_frame_saved_reg *saved_regs; | |
148 | }; | |
149 | ||
150 | /* Fetch the instruction at PC. */ | |
151 | extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); | |
152 | ||
c893be75 MK |
153 | /* Return the contents if register REGNUM as an address. */ |
154 | extern CORE_ADDR sparc_address_from_register (int regnum); | |
155 | ||
1c800673 MK |
156 | /* Fetch StackGhost Per-Process XOR cookie. */ |
157 | extern ULONGEST sparc_fetch_wcookie (void); | |
158 | ||
386c036b MK |
159 | extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, |
160 | struct sparc_frame_cache *cache); | |
161 | ||
162 | extern struct sparc_frame_cache * | |
163 | sparc_frame_cache (struct frame_info *next_frame, void **this_cache); | |
164 | ||
165 | extern struct sparc_frame_cache * | |
166 | sparc32_frame_cache (struct frame_info *next_frame, void **this_cache); | |
167 | ||
168 | \f | |
169 | ||
e6590a1b UW |
170 | extern int sparc_software_single_step (enum target_signal sig, |
171 | int insert_breakpoints_p); | |
386c036b MK |
172 | |
173 | extern void sparc_supply_rwindow (struct regcache *regcache, | |
174 | CORE_ADDR sp, int regnum); | |
175 | extern void sparc_collect_rwindow (const struct regcache *regcache, | |
176 | CORE_ADDR sp, int regnum); | |
177 | ||
178 | /* Register offsets for SunOS 4. */ | |
179 | extern const struct sparc_gregset sparc32_sunos4_gregset; | |
180 | ||
181 | extern void sparc32_supply_gregset (const struct sparc_gregset *gregset, | |
182 | struct regcache *regcache, | |
183 | int regnum, const void *gregs); | |
184 | extern void sparc32_collect_gregset (const struct sparc_gregset *gregset, | |
185 | const struct regcache *regcache, | |
186 | int regnum, void *gregs); | |
187 | extern void sparc32_supply_fpregset (struct regcache *regcache, | |
188 | int regnum, const void *fpregs); | |
189 | extern void sparc32_collect_fpregset (const struct regcache *regcache, | |
190 | int regnum, void *fpregs); | |
191 | ||
192 | /* Functions and variables exported from sparc-sol2-tdep.c. */ | |
193 | ||
194 | /* Register offsets for Solaris 2. */ | |
195 | extern const struct sparc_gregset sparc32_sol2_gregset; | |
196 | ||
197 | extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name); | |
198 | ||
199 | extern void sparc32_sol2_init_abi (struct gdbarch_info info, | |
200 | struct gdbarch *gdbarch); | |
201 | ||
202 | /* Functions and variables exported from sparcnbsd-tdep.c. */ | |
203 | ||
204 | /* Register offsets for NetBSD. */ | |
205 | extern const struct sparc_gregset sparc32nbsd_gregset; | |
206 | ||
c893be75 MK |
207 | /* Return the address of a system call's alternative return |
208 | address. */ | |
209 | extern CORE_ADDR sparcnbsd_step_trap (unsigned long insn); | |
210 | ||
19671c2b MK |
211 | extern void sparc32nbsd_elf_init_abi (struct gdbarch_info info, |
212 | struct gdbarch *gdbarch); | |
213 | ||
566626fa MK |
214 | extern struct trad_frame_saved_reg * |
215 | sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame); | |
216 | ||
386c036b | 217 | #endif /* sparc-tdep.h */ |