GDB (xrefs)

/tmp/gdb-8.1/gdb/sparc-tdep.h
Go to the documentation of this file.
1 /* Target-dependent code for SPARC.
2
3 Copyright (C) 2003-2018 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 3 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, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef SPARC_TDEP_H
21 #define SPARC_TDEP_H 1
22
23 #define SPARC_CORE_REGISTERS \
24 "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
25 "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
26 "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
27 "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7"
28
29 struct frame_info;
30 struct gdbarch;
31 struct regcache;
32 struct regset;
33 struct trad_frame_saved_reg;
34
35 /* Register offsets for the general-purpose register set. */
36
37 struct sparc_gregmap
38 {
39 int r_psr_offset;
40 int r_pc_offset;
41 int r_npc_offset;
42 int r_y_offset;
43 int r_wim_offset;
44 int r_tbr_offset;
45 int r_g1_offset;
46 int r_l0_offset;
47 int r_y_size;
48 };
49
50 struct sparc_fpregmap
51 {
52 int r_f0_offset;
53 int r_fsr_offset;
54 };
55
56 /* SPARC architecture-specific information. */
57
58 struct gdbarch_tdep
59 {
60 /* Register numbers for the PN and nPC registers. The definitions
61 for (64-bit) UltraSPARC differ from the (32-bit) SPARC
62 definitions. */
63 int pc_regnum;
64 int npc_regnum;
65
66 /* Register names specific for architecture (sparc32 vs. sparc64) */
67 const char **fpu_register_names;
68 size_t fpu_registers_num;
69 const char **cp0_register_names;
70 size_t cp0_registers_num;
71
72 /* Register sets. */
73 const struct regset *gregset;
74 size_t sizeof_gregset;
75 const struct regset *fpregset;
76 size_t sizeof_fpregset;
77
78 /* Offset of saved PC in jmp_buf. */
79 int jb_pc_offset;
80
81 /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't
82 treat the PLT special when doing prologue analysis. */
83 size_t plt_entry_size;
84
85 /* Alternative location for trap return. Used for single-stepping. */
86 CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn);
87
88 /* ISA-specific data types. */
89 struct type *sparc_psr_type;
90 struct type *sparc_fsr_type;
91 struct type *sparc64_ccr_type;
92 struct type *sparc64_pstate_type;
93 struct type *sparc64_fsr_type;
94 struct type *sparc64_fprs_type;
95 };
96
97 /* Register numbers of various important registers. */
98
99 enum sparc_regnum
100 {
101 SPARC_G0_REGNUM = 0, /* %g0 */
102 SPARC_G1_REGNUM,
103 SPARC_G2_REGNUM,
104 SPARC_G3_REGNUM,
105 SPARC_G4_REGNUM,
106 SPARC_G5_REGNUM,
107 SPARC_G6_REGNUM,
108 SPARC_G7_REGNUM, /* %g7 */
109 SPARC_O0_REGNUM, /* %o0 */
110 SPARC_O1_REGNUM,
111 SPARC_O2_REGNUM,
112 SPARC_O3_REGNUM,
113 SPARC_O4_REGNUM,
114 SPARC_O5_REGNUM,
115 SPARC_SP_REGNUM, /* %sp (%o6) */
116 SPARC_O7_REGNUM, /* %o7 */
117 SPARC_L0_REGNUM, /* %l0 */
118 SPARC_L1_REGNUM,
119 SPARC_L2_REGNUM,
120 SPARC_L3_REGNUM,
121 SPARC_L4_REGNUM,
122 SPARC_L5_REGNUM,
123 SPARC_L6_REGNUM,
124 SPARC_L7_REGNUM, /* %l7 */
125 SPARC_I0_REGNUM, /* %i0 */
126 SPARC_I1_REGNUM,
127 SPARC_I2_REGNUM,
128 SPARC_I3_REGNUM,
129 SPARC_I4_REGNUM,
130 SPARC_I5_REGNUM,
131 SPARC_FP_REGNUM, /* %fp (%i6) */
132 SPARC_I7_REGNUM, /* %i7 */
133 SPARC_F0_REGNUM, /* %f0 */
134 SPARC_F1_REGNUM,
135 SPARC_F2_REGNUM,
136 SPARC_F3_REGNUM,
137 SPARC_F4_REGNUM,
138 SPARC_F5_REGNUM,
139 SPARC_F6_REGNUM,
140 SPARC_F7_REGNUM,
141 SPARC_F31_REGNUM /* %f31 */
142 = SPARC_F0_REGNUM + 31
143 };
144
145 enum sparc32_regnum
146 {
147 SPARC32_Y_REGNUM /* %y */
148 = SPARC_F31_REGNUM + 1,
149 SPARC32_PSR_REGNUM, /* %psr */
150 SPARC32_WIM_REGNUM, /* %wim */
151 SPARC32_TBR_REGNUM, /* %tbr */
152 SPARC32_PC_REGNUM, /* %pc */
153 SPARC32_NPC_REGNUM, /* %npc */
154 SPARC32_FSR_REGNUM, /* %fsr */
155 SPARC32_CSR_REGNUM, /* %csr */
156 };
157
158 /* Pseudo registers. */
159 enum sparc32_pseudo_regnum
160 {
161 SPARC32_D0_REGNUM = 0, /* %d0 */
162 SPARC32_D30_REGNUM /* %d30 */
163 = SPARC32_D0_REGNUM + 15
164 };
165
166
167 struct sparc_frame_cache
168 {
169 /* Base address. */
170 CORE_ADDR base;
171 CORE_ADDR pc;
172
173 /* Do we have a frame? */
174 int frameless_p;
175
176 /* The offset from the base register to the CFA. */
177 int frame_offset;
178
179 /* Mask of `local' and `in' registers saved in the register save area. */
180 unsigned short int saved_regs_mask;
181
182 /* Mask of `out' registers copied or renamed to their `in' sibling. */
183 unsigned char copied_regs_mask;
184
185 /* Do we have a Structure, Union or Quad-Precision return value? */
186 int struct_return_p;
187
188 /* Table of saved registers. */
189 struct trad_frame_saved_reg *saved_regs;
190 };
191
192 /* Fetch the instruction at PC. */
193 extern unsigned long sparc_fetch_instruction (CORE_ADDR pc);
194
195 /* Fetch StackGhost Per-Process XOR cookie. */
196 extern ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch);
197
198 /* Record the effect of a SAVE instruction on CACHE. */
199 extern void sparc_record_save_insn (struct sparc_frame_cache *cache);
200
201 /* Do a full analysis of the prologue at PC and update CACHE accordingly. */
202 extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch,
203 CORE_ADDR pc, CORE_ADDR current_pc,
204 struct sparc_frame_cache *cache);
205
206 extern struct sparc_frame_cache *
207 sparc_frame_cache (struct frame_info *this_frame, void **this_cache);
208
209 extern struct sparc_frame_cache *
210 sparc32_frame_cache (struct frame_info *this_frame, void **this_cache);
211
212 extern int
213 sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc);
214
215
216
217 extern void sparc_supply_rwindow (struct regcache *regcache,
218 CORE_ADDR sp, int regnum);
219 extern void sparc_collect_rwindow (const struct regcache *regcache,
220 CORE_ADDR sp, int regnum);
221
222 /* Register offsets for SunOS 4. */
223 extern const struct sparc_gregmap sparc32_sunos4_gregmap;
224 extern const struct sparc_fpregmap sparc32_sunos4_fpregmap;
225 extern const struct sparc_fpregmap sparc32_bsd_fpregmap;
226
227 extern void sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
228 struct regcache *regcache,
229 int regnum, const void *gregs);
230 extern void sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
231 const struct regcache *regcache,
232 int regnum, void *gregs);
233 extern void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
234 struct regcache *regcache,
235 int regnum, const void *fpregs);
236 extern void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
237 const struct regcache *regcache,
238 int regnum, void *fpregs);
239
240 extern int sparc_is_annulled_branch_insn (CORE_ADDR pc);
241
242 /* Functions and variables exported from sparc-sol2-tdep.c. */
243
244 /* Register offsets for Solaris 2. */
245 extern const struct sparc_gregmap sparc32_sol2_gregmap;
246 extern const struct sparc_fpregmap sparc32_sol2_fpregmap;
247
248 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name);
249
250 extern const char *sparc_sol2_static_transform_name (const char *name);
251
252 extern void sparc32_sol2_init_abi (struct gdbarch_info info,
253 struct gdbarch *gdbarch);
254
255 /* Functions and variables exported from sparcnbsd-tdep.c. */
256
257 /* Register offsets for NetBSD. */
258 extern const struct sparc_gregmap sparc32nbsd_gregmap;
259
260 /* Return the address of a system call's alternative return
261 address. */
262 extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
263 unsigned long insn);
264
265 extern void sparc32nbsd_init_abi (struct gdbarch_info info,
266 struct gdbarch *gdbarch);
267
268 extern struct trad_frame_saved_reg *
269 sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
270
271 #endif /* sparc-tdep.h */
gdbarch
Definition: gdbarch.c:127
SPARC_L6_REGNUM
Definition: sparc-tdep.h:123
gdbarch_tdep::jb_pc_offset
int jb_pc_offset
Definition: i386-tdep.h:210
sparc_gregmap::r_g1_offset
int r_g1_offset
Definition: sparc-tdep.h:45
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
sparc_sol2_pc_in_sigtramp
int sparc_sol2_pc_in_sigtramp(CORE_ADDR pc, const char *name)
Definition: sparc-sol2-tdep.c:119
sparc_frame_cache::pc
CORE_ADDR pc
Definition: sparc-tdep.h:171
SPARC_G4_REGNUM
Definition: sparc-tdep.h:105
SPARC_L1_REGNUM
Definition: sparc-tdep.h:118
gdbarch_tdep::fpu_register_names
const char ** fpu_register_names
Definition: sparc-tdep.h:67
SPARC32_PC_REGNUM
Definition: sparc-tdep.h:152
SPARC_F3_REGNUM
Definition: sparc-tdep.h:136
sparc32nbsd_init_abi
void sparc32nbsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: sparc-nbsd-tdep.c:294
gdbarch_tdep::gregset
const struct regset * gregset
Definition: sparc-tdep.h:73
SPARC32_D0_REGNUM
Definition: sparc-tdep.h:161
SPARC32_D30_REGNUM
Definition: sparc-tdep.h:162
sparc32_collect_gregset
void sparc32_collect_gregset(const struct sparc_gregmap *gregmap, const struct regcache *regcache, int regnum, void *gregs)
Definition: sparc-tdep.c:2134
gdbarch_tdep
Definition: aarch64-tdep.h:55
SPARC_O7_REGNUM
Definition: sparc-tdep.h:116
gdbarch_tdep::cp0_registers_num
size_t cp0_registers_num
Definition: sparc-tdep.h:70
SPARC32_NPC_REGNUM
Definition: sparc-tdep.h:153
sparc_fpregmap::r_fsr_offset
int r_fsr_offset
Definition: sparc-tdep.h:53
sparc32_sol2_init_abi
void sparc32_sol2_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: sparc-sol2-tdep.c:257
frame_info
Definition: frame.c:85
SPARC_G3_REGNUM
Definition: sparc-tdep.h:104
sparc_gregmap::r_y_offset
int r_y_offset
Definition: sparc-tdep.h:42
SPARC_I0_REGNUM
Definition: sparc-tdep.h:125
sparc_supply_rwindow
void sparc_supply_rwindow(struct regcache *regcache, CORE_ADDR sp, int regnum)
Definition: sparc-tdep.c:1925
SPARC_L5_REGNUM
Definition: sparc-tdep.h:122
sparc_gregmap
Definition: sparc-tdep.h:37
sparc_analyze_prologue
CORE_ADDR sparc_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct sparc_frame_cache *cache)
Definition: sparc-tdep.c:965
SPARC_G6_REGNUM
Definition: sparc-tdep.h:107
gdbarch_tdep::step_trap
CORE_ADDR(* step_trap)(struct frame_info *frame, unsigned long insn)
Definition: sparc-tdep.h:86
SPARC_I1_REGNUM
Definition: sparc-tdep.h:126
sparc32_sunos4_fpregmap
const struct sparc_fpregmap sparc32_sunos4_fpregmap
Definition: sparc-tdep.c:2244
SPARC_O3_REGNUM
Definition: sparc-tdep.h:112
sparc32_supply_gregset
void sparc32_supply_gregset(const struct sparc_gregmap *gregmap, struct regcache *regcache, int regnum, const void *gregs)
Definition: sparc-tdep.c:2069
gdbarch_tdep::sizeof_fpregset
size_t sizeof_fpregset
Definition: i386-tdep.h:66
sparc_record_save_insn
void sparc_record_save_insn(struct sparc_frame_cache *cache)
Definition: sparc-tdep.c:942
gdbarch_tdep::npc_regnum
int npc_regnum
Definition: sparc-tdep.h:64
SPARC_F31_REGNUM
Definition: sparc-tdep.h:141
SPARC_F0_REGNUM
Definition: sparc-tdep.h:133
sparc32nbsd_gregmap
const struct sparc_gregmap sparc32nbsd_gregmap
Definition: sparc-nbsd-tdep.c:41
SPARC_O2_REGNUM
Definition: sparc-tdep.h:111
SPARC_G0_REGNUM
Definition: sparc-tdep.h:101
sparc32_supply_fpregset
void sparc32_supply_fpregset(const struct sparc_fpregmap *fpregmap, struct regcache *regcache, int regnum, const void *fpregs)
Definition: sparc-tdep.c:2189
sparc_collect_rwindow
void sparc_collect_rwindow(const struct regcache *regcache, CORE_ADDR sp, int regnum)
Definition: sparc-tdep.c:1998
sparc32_sol2_fpregmap
const struct sparc_fpregmap sparc32_sol2_fpregmap
Definition: sparc-sol2-tdep.c:49
sparc_frame_cache::saved_regs
struct trad_frame_saved_reg * saved_regs
Definition: sparc-tdep.h:189
sparc32_frame_cache
struct sparc_frame_cache * sparc32_frame_cache(struct frame_info *this_frame, void **this_cache)
Definition: sparc-tdep.c:1231
SPARC_F2_REGNUM
Definition: sparc-tdep.h:135
sparc_gregmap::r_pc_offset
int r_pc_offset
Definition: sparc-tdep.h:40
SPARC_SP_REGNUM
Definition: sparc-tdep.h:115
regset
Definition: regset.h:34
SPARC_I7_REGNUM
Definition: sparc-tdep.h:132
gdbarch_tdep::pc_regnum
int pc_regnum
Definition: s390-linux-tdep.c:110
name
const char *const name
Definition: aarch64-tdep.c:76
SPARC_I5_REGNUM
Definition: sparc-tdep.h:130
gdbarch_tdep::sparc64_ccr_type
struct type * sparc64_ccr_type
Definition: sparc-tdep.h:91
sparc_frame_cache::frame_offset
int frame_offset
Definition: sparc-tdep.h:177
sparc_regnum
sparc_regnum
Definition: sparc-tdep.h:99
SPARC_L0_REGNUM
Definition: sparc-tdep.h:117
SPARC_O5_REGNUM
Definition: sparc-tdep.h:114
sparc_frame_cache::saved_regs_mask
unsigned short int saved_regs_mask
Definition: sparc-tdep.h:180
gdbarch_tdep::sparc64_fprs_type
struct type * sparc64_fprs_type
Definition: sparc-tdep.h:94
SPARC32_TBR_REGNUM
Definition: sparc-tdep.h:151
sparc_gregmap::r_l0_offset
int r_l0_offset
Definition: sparc-tdep.h:46
sparc_frame_cache::base
CORE_ADDR base
Definition: sparc-tdep.h:170
sparc_fetch_instruction
unsigned long sparc_fetch_instruction(CORE_ADDR pc)
Definition: sparc-tdep.c:98
sparc_fpregmap
Definition: sparc-tdep.h:50
gdbarch_tdep::cp0_register_names
const char ** cp0_register_names
Definition: sparc-tdep.h:69
type
Definition: gdbtypes.h:749
sparc_is_annulled_branch_insn
int sparc_is_annulled_branch_insn(CORE_ADDR pc)
Definition: sparc-tdep.c:130
sparc32nbsd_sigcontext_saved_regs
struct trad_frame_saved_reg * sparc32nbsd_sigcontext_saved_regs(struct frame_info *next_frame)
Definition: sparc-nbsd-tdep.c:97
SPARC_I2_REGNUM
Definition: sparc-tdep.h:127
sparc32_bsd_fpregmap
const struct sparc_fpregmap sparc32_bsd_fpregmap
Definition: sparc-tdep.c:2250
SPARC32_FSR_REGNUM
Definition: sparc-tdep.h:154
SPARC_G1_REGNUM
Definition: sparc-tdep.h:102
sparc_gregmap::r_y_size
int r_y_size
Definition: sparc-tdep.h:47
SPARC_L2_REGNUM
Definition: sparc-tdep.h:119
SPARC32_PSR_REGNUM
Definition: sparc-tdep.h:149
regnum
int regnum
Definition: aarch64-tdep.c:77
SPARC_F5_REGNUM
Definition: sparc-tdep.h:138
sparc_gregmap::r_tbr_offset
int r_tbr_offset
Definition: sparc-tdep.h:44
SPARC_L3_REGNUM
Definition: sparc-tdep.h:120
sparc_sol2_static_transform_name
const char * sparc_sol2_static_transform_name(const char *name)
Definition: sparc-sol2-tdep.c:227
gdbarch_tdep::sparc64_fsr_type
struct type * sparc64_fsr_type
Definition: sparc-tdep.h:93
sparc32_regnum
sparc32_regnum
Definition: sparc-tdep.h:145
sparc32_sunos4_gregmap
const struct sparc_gregmap sparc32_sunos4_gregmap
Definition: sparc-tdep.c:2232
sparc32_collect_fpregset
void sparc32_collect_fpregset(const struct sparc_fpregmap *fpregmap, const struct regcache *regcache, int regnum, void *fpregs)
Definition: sparc-tdep.c:2209
SPARC_G5_REGNUM
Definition: sparc-tdep.h:106
sparc32_pseudo_regnum
sparc32_pseudo_regnum
Definition: sparc-tdep.h:159
gdbarch_tdep::sparc_fsr_type
struct type * sparc_fsr_type
Definition: sparc-tdep.h:90
SPARC32_CSR_REGNUM
Definition: sparc-tdep.h:155
gdbarch_tdep::sparc_psr_type
struct type * sparc_psr_type
Definition: sparc-tdep.h:89
SPARC_I3_REGNUM
Definition: sparc-tdep.h:128
sparc_gregmap::r_npc_offset
int r_npc_offset
Definition: sparc-tdep.h:41
SPARC_O1_REGNUM
Definition: sparc-tdep.h:110
SPARC_O0_REGNUM
Definition: sparc-tdep.h:109
sparc_frame_cache::copied_regs_mask
unsigned char copied_regs_mask
Definition: sparc-tdep.h:183
SPARC32_WIM_REGNUM
Definition: sparc-tdep.h:150
SPARC_F4_REGNUM
Definition: sparc-tdep.h:137
SPARC_G2_REGNUM
Definition: sparc-tdep.h:103
gdbarch_tdep::sparc64_pstate_type
struct type * sparc64_pstate_type
Definition: sparc-tdep.h:92
SPARC_I4_REGNUM
Definition: sparc-tdep.h:129
SPARC_F7_REGNUM
Definition: sparc-tdep.h:140
gdbarch_tdep::sizeof_gregset
size_t sizeof_gregset
Definition: i386-tdep.h:63
gdbarch_tdep::fpu_registers_num
size_t fpu_registers_num
Definition: sparc-tdep.h:68
SPARC_L4_REGNUM
Definition: sparc-tdep.h:121
sparc_gregmap::r_psr_offset
int r_psr_offset
Definition: sparc-tdep.h:39
sparc_fpregmap::r_f0_offset
int r_f0_offset
Definition: sparc-tdep.h:52
gdbarch_tdep::fpregset
const struct regset * fpregset
Definition: i386-tdep.h:253
sparc_stack_frame_destroyed_p
int sparc_stack_frame_destroyed_p(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition: sparc-tdep.c:537
ULONGEST
unsigned long long ULONGEST
Definition: common-types.h:53
SPARC_F1_REGNUM
Definition: sparc-tdep.h:134
regcache
Definition: regcache.h:232
SPARC_O4_REGNUM
Definition: sparc-tdep.h:113
sparc32_sol2_gregmap
const struct sparc_gregmap sparc32_sol2_gregmap
Definition: sparc-sol2-tdep.c:37
gdbarch_info
Definition: gdbarch.h:1626
sparc_frame_cache::struct_return_p
int struct_return_p
Definition: sparc-tdep.h:186
SPARC_FP_REGNUM
Definition: sparc-tdep.h:131
SPARC_L7_REGNUM
Definition: sparc-tdep.h:124
sparc_frame_cache::frameless_p
int frameless_p
Definition: sparc-tdep.h:174
gdbarch_tdep::plt_entry_size
size_t plt_entry_size
Definition: sparc-tdep.h:83
sparc_fetch_wcookie
ULONGEST sparc_fetch_wcookie(struct gdbarch *gdbarch)
Definition: sparc-tdep.c:189
SPARC_F6_REGNUM
Definition: sparc-tdep.h:139
sparc_frame_cache
Definition: sparc-tdep.h:167
sparc_frame_cache
struct sparc_frame_cache * sparc_frame_cache(struct frame_info *this_frame, void **this_cache)
Definition: sparc-tdep.c:1174
trad_frame_saved_reg
Definition: trad-frame.h:81
SPARC32_Y_REGNUM
Definition: sparc-tdep.h:147
sparcnbsd_step_trap
CORE_ADDR sparcnbsd_step_trap(struct frame_info *frame, unsigned long insn)
Definition: sparc-nbsd-tdep.c:265
sparc_gregmap::r_wim_offset
int r_wim_offset
Definition: sparc-tdep.h:43
SPARC_G7_REGNUM
Definition: sparc-tdep.h:108