2004-01-12 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / sparc-tdep.h
1 /* Target-dependent code for SPARC.
2
3 Copyright 2003, 2004 Free Software Foundation, Inc.
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
22 #ifndef SPARC_TDEP_H
23 #define SPARC_TDEP_H 1
24
25 struct gdbarch;
26 struct regcache;
27 struct regset;
28 struct trad_frame_saved_reg;
29 struct frame_info;
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
56 /* Register sets. */
57 struct regset *gregset;
58 size_t sizeof_gregset;
59 struct regset *fpregset;
60 size_t sizeof_fpregset;
61
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;
68 };
69
70 /* Register numbers of various important registers. */
71
72 enum sparc_regnum
73 {
74 SPARC_G0_REGNUM, /* %g0 */
75 SPARC_G1_REGNUM,
76 SPARC_G2_REGNUM,
77 SPARC_G3_REGNUM,
78 SPARC_G4_REGNUM,
79 SPARC_G5_REGNUM,
80 SPARC_G6_REGNUM,
81 SPARC_G7_REGNUM, /* %g7 */
82 SPARC_O0_REGNUM, /* %o0 */
83 SPARC_O1_REGNUM,
84 SPARC_O2_REGNUM,
85 SPARC_O3_REGNUM,
86 SPARC_O4_REGNUM,
87 SPARC_O5_REGNUM,
88 SPARC_SP_REGNUM, /* %sp (%o6) */
89 SPARC_O7_REGNUM, /* %o7 */
90 SPARC_L0_REGNUM, /* %l0 */
91 SPARC_L1_REGNUM,
92 SPARC_L2_REGNUM,
93 SPARC_L3_REGNUM,
94 SPARC_L4_REGNUM,
95 SPARC_L5_REGNUM,
96 SPARC_L6_REGNUM,
97 SPARC_L7_REGNUM, /* %l7 */
98 SPARC_I0_REGNUM, /* %i0 */
99 SPARC_I1_REGNUM,
100 SPARC_I2_REGNUM,
101 SPARC_I3_REGNUM,
102 SPARC_I4_REGNUM,
103 SPARC_I5_REGNUM,
104 SPARC_FP_REGNUM, /* %fp (%i6) */
105 SPARC_I7_REGNUM, /* %i7 */
106 SPARC_F0_REGNUM, /* %f0 */
107 SPARC_F1_REGNUM,
108 SPARC_F31_REGNUM /* %f31 */
109 = SPARC_F0_REGNUM + 31
110 };
111
112 enum sparc32_regnum
113 {
114 SPARC32_Y_REGNUM /* %y */
115 = SPARC_F31_REGNUM + 1,
116 SPARC32_PSR_REGNUM, /* %psr */
117 SPARC32_WIM_REGNUM, /* %wim */
118 SPARC32_TBR_REGNUM, /* %tbr */
119 SPARC32_PC_REGNUM, /* %pc */
120 SPARC32_NPC_REGNUM, /* %npc */
121 SPARC32_FSR_REGNUM, /* %fsr */
122 SPARC32_CSR_REGNUM, /* %csr */
123
124 /* Pseudo registers. */
125 SPARC32_D0_REGNUM, /* %d0 */
126 SPARC32_D30_REGNUM /* %d30 */
127 = SPARC32_D0_REGNUM + 15
128 };
129 \f
130
131 struct sparc_frame_cache
132 {
133 /* Base address. */
134 CORE_ADDR base;
135 CORE_ADDR pc;
136
137 /* Do we have a frame? */
138 int frameless_p;
139
140 /* Do we have a Structure, Union or Quad-Precision return value?. */
141 int struct_return_p;
142
143 /* Table of saved registers. */
144 struct trad_frame_saved_reg *saved_regs;
145 };
146
147 /* Fetch the instruction at PC. */
148 extern unsigned long sparc_fetch_instruction (CORE_ADDR pc);
149
150 extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
151 struct sparc_frame_cache *cache);
152
153 extern struct sparc_frame_cache *
154 sparc_frame_cache (struct frame_info *next_frame, void **this_cache);
155
156 extern struct sparc_frame_cache *
157 sparc32_frame_cache (struct frame_info *next_frame, void **this_cache);
158
159 \f
160
161 extern void sparc_software_single_step (enum target_signal sig,
162 int insert_breakpoints_p);
163
164 extern void sparc_supply_rwindow (struct regcache *regcache,
165 CORE_ADDR sp, int regnum);
166 extern void sparc_collect_rwindow (const struct regcache *regcache,
167 CORE_ADDR sp, int regnum);
168
169 /* Register offsets for SunOS 4. */
170 extern const struct sparc_gregset sparc32_sunos4_gregset;
171
172 extern void sparc32_supply_gregset (const struct sparc_gregset *gregset,
173 struct regcache *regcache,
174 int regnum, const void *gregs);
175 extern void sparc32_collect_gregset (const struct sparc_gregset *gregset,
176 const struct regcache *regcache,
177 int regnum, void *gregs);
178 extern void sparc32_supply_fpregset (struct regcache *regcache,
179 int regnum, const void *fpregs);
180 extern void sparc32_collect_fpregset (const struct regcache *regcache,
181 int regnum, void *fpregs);
182
183 /* Functions and variables exported from sparc-sol2-tdep.c. */
184
185 /* Register offsets for Solaris 2. */
186 extern const struct sparc_gregset sparc32_sol2_gregset;
187
188 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name);
189
190 extern void sparc32_sol2_init_abi (struct gdbarch_info info,
191 struct gdbarch *gdbarch);
192
193 /* Functions and variables exported from sparcnbsd-tdep.c. */
194
195 /* Register offsets for NetBSD. */
196 extern const struct sparc_gregset sparc32nbsd_gregset;
197
198 #endif /* sparc-tdep.h */
This page took 0.034441 seconds and 5 git commands to generate.