Fix PTRACE_GETREGSET failure for compat inferiors on arm64
[deliverable/binutils-gdb.git] / gdb / sparc-tdep.h
1 /* Target-dependent code for SPARC.
2
3 Copyright (C) 2003-2017 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 sets. */
67 const struct regset *gregset;
68 size_t sizeof_gregset;
69 const struct regset *fpregset;
70 size_t sizeof_fpregset;
71
72 /* Offset of saved PC in jmp_buf. */
73 int jb_pc_offset;
74
75 /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't
76 treat the PLT special when doing prologue analysis. */
77 size_t plt_entry_size;
78
79 /* Alternative location for trap return. Used for single-stepping. */
80 CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn);
81
82 /* ISA-specific data types. */
83 struct type *sparc_psr_type;
84 struct type *sparc_fsr_type;
85 struct type *sparc64_pstate_type;
86 struct type *sparc64_fsr_type;
87 struct type *sparc64_fprs_type;
88 };
89
90 /* Register numbers of various important registers. */
91
92 enum sparc_regnum
93 {
94 SPARC_G0_REGNUM = 0, /* %g0 */
95 SPARC_G1_REGNUM,
96 SPARC_G2_REGNUM,
97 SPARC_G3_REGNUM,
98 SPARC_G4_REGNUM,
99 SPARC_G5_REGNUM,
100 SPARC_G6_REGNUM,
101 SPARC_G7_REGNUM, /* %g7 */
102 SPARC_O0_REGNUM, /* %o0 */
103 SPARC_O1_REGNUM,
104 SPARC_O2_REGNUM,
105 SPARC_O3_REGNUM,
106 SPARC_O4_REGNUM,
107 SPARC_O5_REGNUM,
108 SPARC_SP_REGNUM, /* %sp (%o6) */
109 SPARC_O7_REGNUM, /* %o7 */
110 SPARC_L0_REGNUM, /* %l0 */
111 SPARC_L1_REGNUM,
112 SPARC_L2_REGNUM,
113 SPARC_L3_REGNUM,
114 SPARC_L4_REGNUM,
115 SPARC_L5_REGNUM,
116 SPARC_L6_REGNUM,
117 SPARC_L7_REGNUM, /* %l7 */
118 SPARC_I0_REGNUM, /* %i0 */
119 SPARC_I1_REGNUM,
120 SPARC_I2_REGNUM,
121 SPARC_I3_REGNUM,
122 SPARC_I4_REGNUM,
123 SPARC_I5_REGNUM,
124 SPARC_FP_REGNUM, /* %fp (%i6) */
125 SPARC_I7_REGNUM, /* %i7 */
126 SPARC_F0_REGNUM, /* %f0 */
127 SPARC_F1_REGNUM,
128 SPARC_F2_REGNUM,
129 SPARC_F3_REGNUM,
130 SPARC_F4_REGNUM,
131 SPARC_F5_REGNUM,
132 SPARC_F6_REGNUM,
133 SPARC_F7_REGNUM,
134 SPARC_F31_REGNUM /* %f31 */
135 = SPARC_F0_REGNUM + 31
136 };
137
138 enum sparc32_regnum
139 {
140 SPARC32_Y_REGNUM /* %y */
141 = SPARC_F31_REGNUM + 1,
142 SPARC32_PSR_REGNUM, /* %psr */
143 SPARC32_WIM_REGNUM, /* %wim */
144 SPARC32_TBR_REGNUM, /* %tbr */
145 SPARC32_PC_REGNUM, /* %pc */
146 SPARC32_NPC_REGNUM, /* %npc */
147 SPARC32_FSR_REGNUM, /* %fsr */
148 SPARC32_CSR_REGNUM, /* %csr */
149 };
150
151 /* Pseudo registers. */
152 enum sparc32_pseudo_regnum
153 {
154 SPARC32_D0_REGNUM = 0, /* %d0 */
155 SPARC32_D30_REGNUM /* %d30 */
156 = SPARC32_D0_REGNUM + 15
157 };
158 \f
159
160 struct sparc_frame_cache
161 {
162 /* Base address. */
163 CORE_ADDR base;
164 CORE_ADDR pc;
165
166 /* Do we have a frame? */
167 int frameless_p;
168
169 /* The offset from the base register to the CFA. */
170 int frame_offset;
171
172 /* Mask of `local' and `in' registers saved in the register save area. */
173 unsigned short int saved_regs_mask;
174
175 /* Mask of `out' registers copied or renamed to their `in' sibling. */
176 unsigned char copied_regs_mask;
177
178 /* Do we have a Structure, Union or Quad-Precision return value? */
179 int struct_return_p;
180
181 /* Table of saved registers. */
182 struct trad_frame_saved_reg *saved_regs;
183 };
184
185 /* Fetch the instruction at PC. */
186 extern unsigned long sparc_fetch_instruction (CORE_ADDR pc);
187
188 /* Fetch StackGhost Per-Process XOR cookie. */
189 extern ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch);
190
191 /* Record the effect of a SAVE instruction on CACHE. */
192 extern void sparc_record_save_insn (struct sparc_frame_cache *cache);
193
194 /* Do a full analysis of the prologue at PC and update CACHE accordingly. */
195 extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch,
196 CORE_ADDR pc, CORE_ADDR current_pc,
197 struct sparc_frame_cache *cache);
198
199 extern struct sparc_frame_cache *
200 sparc_frame_cache (struct frame_info *this_frame, void **this_cache);
201
202 extern struct sparc_frame_cache *
203 sparc32_frame_cache (struct frame_info *this_frame, void **this_cache);
204
205 extern int
206 sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc);
207
208 \f
209
210 extern void sparc_supply_rwindow (struct regcache *regcache,
211 CORE_ADDR sp, int regnum);
212 extern void sparc_collect_rwindow (const struct regcache *regcache,
213 CORE_ADDR sp, int regnum);
214
215 /* Register offsets for SunOS 4. */
216 extern const struct sparc_gregmap sparc32_sunos4_gregmap;
217 extern const struct sparc_fpregmap sparc32_sunos4_fpregmap;
218 extern const struct sparc_fpregmap sparc32_bsd_fpregmap;
219
220 extern void sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
221 struct regcache *regcache,
222 int regnum, const void *gregs);
223 extern void sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
224 const struct regcache *regcache,
225 int regnum, void *gregs);
226 extern void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
227 struct regcache *regcache,
228 int regnum, const void *fpregs);
229 extern void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
230 const struct regcache *regcache,
231 int regnum, void *fpregs);
232
233 extern int sparc_is_annulled_branch_insn (CORE_ADDR pc);
234
235 /* Functions and variables exported from sparc-sol2-tdep.c. */
236
237 /* Register offsets for Solaris 2. */
238 extern const struct sparc_gregmap sparc32_sol2_gregmap;
239 extern const struct sparc_fpregmap sparc32_sol2_fpregmap;
240
241 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name);
242
243 extern const char *sparc_sol2_static_transform_name (const char *name);
244
245 extern void sparc32_sol2_init_abi (struct gdbarch_info info,
246 struct gdbarch *gdbarch);
247
248 /* Functions and variables exported from sparcnbsd-tdep.c. */
249
250 /* Register offsets for NetBSD. */
251 extern const struct sparc_gregmap sparc32nbsd_gregmap;
252
253 /* Return the address of a system call's alternative return
254 address. */
255 extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
256 unsigned long insn);
257
258 extern void sparc32nbsd_init_abi (struct gdbarch_info info,
259 struct gdbarch *gdbarch);
260
261 extern struct trad_frame_saved_reg *
262 sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
263
264 #endif /* sparc-tdep.h */
This page took 0.033621 seconds and 4 git commands to generate.