* README: Mention gdbserver/README.
[deliverable/binutils-gdb.git] / gdb / sparc-tdep.h
CommitLineData
386c036b 1/* Target-dependent code for SPARC.
c139e7d9 2
9b254dd1 3 Copyright (C) 2003, 2004, 2006, 2007, 2008 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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
c139e7d9
DJ
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
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c139e7d9 19
386c036b
MK
20#ifndef SPARC_TDEP_H
21#define SPARC_TDEP_H 1
22
566626fa 23struct frame_info;
386c036b
MK
24struct gdbarch;
25struct regcache;
a54124c5 26struct regset;
386c036b
MK
27struct trad_frame_saved_reg;
28
29/* Register offsets for the general-purpose register set. */
30
31struct 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
46struct 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
a54124c5
MK
54 /* Register sets. */
55 struct regset *gregset;
56 size_t sizeof_gregset;
57 struct regset *fpregset;
58 size_t sizeof_fpregset;
59
386c036b
MK
60 /* Offset of saved PC in jmp_buf. */
61 int jb_pc_offset;
62
63 /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't
64 treat the PLT special when doing prologue analysis. */
65 size_t plt_entry_size;
c893be75
MK
66
67 /* Alternative location for trap return. Used for single-stepping. */
0b1b3e42 68 CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn);
386c036b
MK
69};
70
71/* Register numbers of various important registers. */
72
73enum sparc_regnum
74{
75 SPARC_G0_REGNUM, /* %g0 */
76 SPARC_G1_REGNUM,
77 SPARC_G2_REGNUM,
78 SPARC_G3_REGNUM,
79 SPARC_G4_REGNUM,
80 SPARC_G5_REGNUM,
81 SPARC_G6_REGNUM,
82 SPARC_G7_REGNUM, /* %g7 */
83 SPARC_O0_REGNUM, /* %o0 */
84 SPARC_O1_REGNUM,
85 SPARC_O2_REGNUM,
86 SPARC_O3_REGNUM,
87 SPARC_O4_REGNUM,
88 SPARC_O5_REGNUM,
89 SPARC_SP_REGNUM, /* %sp (%o6) */
90 SPARC_O7_REGNUM, /* %o7 */
91 SPARC_L0_REGNUM, /* %l0 */
92 SPARC_L1_REGNUM,
93 SPARC_L2_REGNUM,
94 SPARC_L3_REGNUM,
95 SPARC_L4_REGNUM,
96 SPARC_L5_REGNUM,
97 SPARC_L6_REGNUM,
98 SPARC_L7_REGNUM, /* %l7 */
99 SPARC_I0_REGNUM, /* %i0 */
100 SPARC_I1_REGNUM,
101 SPARC_I2_REGNUM,
102 SPARC_I3_REGNUM,
103 SPARC_I4_REGNUM,
104 SPARC_I5_REGNUM,
105 SPARC_FP_REGNUM, /* %fp (%i6) */
106 SPARC_I7_REGNUM, /* %i7 */
107 SPARC_F0_REGNUM, /* %f0 */
108 SPARC_F1_REGNUM,
109 SPARC_F31_REGNUM /* %f31 */
110 = SPARC_F0_REGNUM + 31
111};
112
113enum sparc32_regnum
114{
115 SPARC32_Y_REGNUM /* %y */
116 = SPARC_F31_REGNUM + 1,
117 SPARC32_PSR_REGNUM, /* %psr */
118 SPARC32_WIM_REGNUM, /* %wim */
119 SPARC32_TBR_REGNUM, /* %tbr */
120 SPARC32_PC_REGNUM, /* %pc */
121 SPARC32_NPC_REGNUM, /* %npc */
122 SPARC32_FSR_REGNUM, /* %fsr */
123 SPARC32_CSR_REGNUM, /* %csr */
124
125 /* Pseudo registers. */
126 SPARC32_D0_REGNUM, /* %d0 */
127 SPARC32_D30_REGNUM /* %d30 */
128 = SPARC32_D0_REGNUM + 15
129};
130\f
131
132struct sparc_frame_cache
133{
134 /* Base address. */
135 CORE_ADDR base;
136 CORE_ADDR pc;
137
138 /* Do we have a frame? */
139 int frameless_p;
140
141 /* Do we have a Structure, Union or Quad-Precision return value?. */
142 int struct_return_p;
143
144 /* Table of saved registers. */
145 struct trad_frame_saved_reg *saved_regs;
146};
147
148/* Fetch the instruction at PC. */
149extern unsigned long sparc_fetch_instruction (CORE_ADDR pc);
150
1c800673
MK
151/* Fetch StackGhost Per-Process XOR cookie. */
152extern ULONGEST sparc_fetch_wcookie (void);
153
be8626e0
MD
154extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch,
155 CORE_ADDR pc, CORE_ADDR current_pc,
386c036b
MK
156 struct sparc_frame_cache *cache);
157
158extern struct sparc_frame_cache *
159 sparc_frame_cache (struct frame_info *next_frame, void **this_cache);
160
161extern struct sparc_frame_cache *
162 sparc32_frame_cache (struct frame_info *next_frame, void **this_cache);
163
164\f
165
0b1b3e42 166extern int sparc_software_single_step (struct frame_info *frame);
386c036b
MK
167
168extern void sparc_supply_rwindow (struct regcache *regcache,
169 CORE_ADDR sp, int regnum);
170extern void sparc_collect_rwindow (const struct regcache *regcache,
171 CORE_ADDR sp, int regnum);
172
173/* Register offsets for SunOS 4. */
174extern const struct sparc_gregset sparc32_sunos4_gregset;
175
176extern void sparc32_supply_gregset (const struct sparc_gregset *gregset,
177 struct regcache *regcache,
178 int regnum, const void *gregs);
179extern void sparc32_collect_gregset (const struct sparc_gregset *gregset,
180 const struct regcache *regcache,
181 int regnum, void *gregs);
182extern void sparc32_supply_fpregset (struct regcache *regcache,
183 int regnum, const void *fpregs);
184extern void sparc32_collect_fpregset (const struct regcache *regcache,
185 int regnum, void *fpregs);
186
187/* Functions and variables exported from sparc-sol2-tdep.c. */
188
189/* Register offsets for Solaris 2. */
190extern const struct sparc_gregset sparc32_sol2_gregset;
191
192extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name);
193
149ad273
UW
194extern char *sparc_sol2_static_transform_name (char *name);
195
386c036b
MK
196extern void sparc32_sol2_init_abi (struct gdbarch_info info,
197 struct gdbarch *gdbarch);
198
199/* Functions and variables exported from sparcnbsd-tdep.c. */
200
201/* Register offsets for NetBSD. */
202extern const struct sparc_gregset sparc32nbsd_gregset;
203
c893be75
MK
204/* Return the address of a system call's alternative return
205 address. */
0b1b3e42
UW
206extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
207 unsigned long insn);
c893be75 208
19671c2b
MK
209extern void sparc32nbsd_elf_init_abi (struct gdbarch_info info,
210 struct gdbarch *gdbarch);
211
566626fa
MK
212extern struct trad_frame_saved_reg *
213 sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
214
386c036b 215#endif /* sparc-tdep.h */
This page took 0.42631 seconds and 4 git commands to generate.