Commit | Line | Data |
---|---|---|
386c036b | 1 | /* Target-dependent code for SPARC. |
c139e7d9 | 2 | |
386c036b | 3 | Copyright 2003, 2004 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 | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
386c036b MK |
22 | #ifndef SPARC_TDEP_H |
23 | #define SPARC_TDEP_H 1 | |
24 | ||
25 | struct gdbarch; | |
26 | struct regcache; | |
27 | struct trad_frame_saved_reg; | |
28 | ||
29 | /* Register offsets for the general-purpose register set. */ | |
30 | ||
31 | struct sparc_gregset | |
32 | { | |
33 | int r_psr_offset; | |
34 | int r_pc_offset; | |
35 | int r_npc_offset; | |
36 | int r_y_offset; | |
37 | int r_wim_offset; | |
38 | int r_tbr_offset; | |
39 | int r_g1_offset; | |
40 | int r_l0_offset; | |
41 | int r_y_size; | |
42 | }; | |
43 | ||
44 | /* SPARC architecture-specific information. */ | |
45 | ||
46 | struct gdbarch_tdep | |
47 | { | |
48 | /* Register numbers for the PN and nPC registers. The definitions | |
49 | for (64-bit) UltraSPARC differ from the (32-bit) SPARC | |
50 | definitions. */ | |
51 | int pc_regnum; | |
52 | int npc_regnum; | |
53 | ||
54 | /* Offset of saved PC in jmp_buf. */ | |
55 | int jb_pc_offset; | |
56 | ||
57 | /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't | |
58 | treat the PLT special when doing prologue analysis. */ | |
59 | size_t plt_entry_size; | |
60 | }; | |
61 | ||
62 | /* Register numbers of various important registers. */ | |
63 | ||
64 | enum sparc_regnum | |
65 | { | |
66 | SPARC_G0_REGNUM, /* %g0 */ | |
67 | SPARC_G1_REGNUM, | |
68 | SPARC_G2_REGNUM, | |
69 | SPARC_G3_REGNUM, | |
70 | SPARC_G4_REGNUM, | |
71 | SPARC_G5_REGNUM, | |
72 | SPARC_G6_REGNUM, | |
73 | SPARC_G7_REGNUM, /* %g7 */ | |
74 | SPARC_O0_REGNUM, /* %o0 */ | |
75 | SPARC_O1_REGNUM, | |
76 | SPARC_O2_REGNUM, | |
77 | SPARC_O3_REGNUM, | |
78 | SPARC_O4_REGNUM, | |
79 | SPARC_O5_REGNUM, | |
80 | SPARC_SP_REGNUM, /* %sp (%o6) */ | |
81 | SPARC_O7_REGNUM, /* %o7 */ | |
82 | SPARC_L0_REGNUM, /* %l0 */ | |
83 | SPARC_L1_REGNUM, | |
84 | SPARC_L2_REGNUM, | |
85 | SPARC_L3_REGNUM, | |
86 | SPARC_L4_REGNUM, | |
87 | SPARC_L5_REGNUM, | |
88 | SPARC_L6_REGNUM, | |
89 | SPARC_L7_REGNUM, /* %l7 */ | |
90 | SPARC_I0_REGNUM, /* %i0 */ | |
91 | SPARC_I1_REGNUM, | |
92 | SPARC_I2_REGNUM, | |
93 | SPARC_I3_REGNUM, | |
94 | SPARC_I4_REGNUM, | |
95 | SPARC_I5_REGNUM, | |
96 | SPARC_FP_REGNUM, /* %fp (%i6) */ | |
97 | SPARC_I7_REGNUM, /* %i7 */ | |
98 | SPARC_F0_REGNUM, /* %f0 */ | |
99 | SPARC_F1_REGNUM, | |
100 | SPARC_F31_REGNUM /* %f31 */ | |
101 | = SPARC_F0_REGNUM + 31 | |
102 | }; | |
103 | ||
104 | enum sparc32_regnum | |
105 | { | |
106 | SPARC32_Y_REGNUM /* %y */ | |
107 | = SPARC_F31_REGNUM + 1, | |
108 | SPARC32_PSR_REGNUM, /* %psr */ | |
109 | SPARC32_WIM_REGNUM, /* %wim */ | |
110 | SPARC32_TBR_REGNUM, /* %tbr */ | |
111 | SPARC32_PC_REGNUM, /* %pc */ | |
112 | SPARC32_NPC_REGNUM, /* %npc */ | |
113 | SPARC32_FSR_REGNUM, /* %fsr */ | |
114 | SPARC32_CSR_REGNUM, /* %csr */ | |
115 | ||
116 | /* Pseudo registers. */ | |
117 | SPARC32_D0_REGNUM, /* %d0 */ | |
118 | SPARC32_D30_REGNUM /* %d30 */ | |
119 | = SPARC32_D0_REGNUM + 15 | |
120 | }; | |
121 | \f | |
122 | ||
123 | struct sparc_frame_cache | |
124 | { | |
125 | /* Base address. */ | |
126 | CORE_ADDR base; | |
127 | CORE_ADDR pc; | |
128 | ||
129 | /* Do we have a frame? */ | |
130 | int frameless_p; | |
131 | ||
132 | /* Do we have a Structure, Union or Quad-Precision return value?. */ | |
133 | int struct_return_p; | |
134 | ||
135 | /* Table of saved registers. */ | |
136 | struct trad_frame_saved_reg *saved_regs; | |
137 | }; | |
138 | ||
139 | /* Fetch the instruction at PC. */ | |
140 | extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); | |
141 | ||
142 | extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, | |
143 | struct sparc_frame_cache *cache); | |
144 | ||
145 | extern struct sparc_frame_cache * | |
146 | sparc_frame_cache (struct frame_info *next_frame, void **this_cache); | |
147 | ||
148 | extern struct sparc_frame_cache * | |
149 | sparc32_frame_cache (struct frame_info *next_frame, void **this_cache); | |
150 | ||
151 | \f | |
152 | ||
153 | extern void sparc_software_single_step (enum target_signal sig, | |
154 | int insert_breakpoints_p); | |
155 | ||
156 | extern void sparc_supply_rwindow (struct regcache *regcache, | |
157 | CORE_ADDR sp, int regnum); | |
158 | extern void sparc_collect_rwindow (const struct regcache *regcache, | |
159 | CORE_ADDR sp, int regnum); | |
160 | ||
161 | /* Register offsets for SunOS 4. */ | |
162 | extern const struct sparc_gregset sparc32_sunos4_gregset; | |
163 | ||
164 | extern void sparc32_supply_gregset (const struct sparc_gregset *gregset, | |
165 | struct regcache *regcache, | |
166 | int regnum, const void *gregs); | |
167 | extern void sparc32_collect_gregset (const struct sparc_gregset *gregset, | |
168 | const struct regcache *regcache, | |
169 | int regnum, void *gregs); | |
170 | extern void sparc32_supply_fpregset (struct regcache *regcache, | |
171 | int regnum, const void *fpregs); | |
172 | extern void sparc32_collect_fpregset (const struct regcache *regcache, | |
173 | int regnum, void *fpregs); | |
174 | ||
175 | /* Functions and variables exported from sparc-sol2-tdep.c. */ | |
176 | ||
177 | /* Register offsets for Solaris 2. */ | |
178 | extern const struct sparc_gregset sparc32_sol2_gregset; | |
179 | ||
180 | extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name); | |
181 | ||
182 | extern void sparc32_sol2_init_abi (struct gdbarch_info info, | |
183 | struct gdbarch *gdbarch); | |
184 | ||
185 | /* Functions and variables exported from sparcnbsd-tdep.c. */ | |
186 | ||
187 | /* Register offsets for NetBSD. */ | |
188 | extern const struct sparc_gregset sparc32nbsd_gregset; | |
189 | ||
190 | #endif /* sparc-tdep.h */ |