1 /* Target-dependent code for SPARC.
3 Copyright (C) 2003-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
21 #define SPARC_TDEP_H 1
27 struct trad_frame_saved_reg
;
29 /* Register offsets for the general-purpose register set. */
50 /* SPARC architecture-specific information. */
54 /* Register numbers for the PN and nPC registers. The definitions
55 for (64-bit) UltraSPARC differ from the (32-bit) SPARC
61 const struct regset
*gregset
;
62 size_t sizeof_gregset
;
63 const struct regset
*fpregset
;
64 size_t sizeof_fpregset
;
66 /* Offset of saved PC in jmp_buf. */
69 /* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't
70 treat the PLT special when doing prologue analysis. */
71 size_t plt_entry_size
;
73 /* Alternative location for trap return. Used for single-stepping. */
74 CORE_ADDR (*step_trap
) (struct frame_info
*frame
, unsigned long insn
);
76 /* ISA-specific data types. */
77 struct type
*sparc_psr_type
;
78 struct type
*sparc_fsr_type
;
79 struct type
*sparc64_pstate_type
;
80 struct type
*sparc64_fsr_type
;
81 struct type
*sparc64_fprs_type
;
84 /* Register numbers of various important registers. */
88 SPARC_G0_REGNUM
, /* %g0 */
95 SPARC_G7_REGNUM
, /* %g7 */
96 SPARC_O0_REGNUM
, /* %o0 */
102 SPARC_SP_REGNUM
, /* %sp (%o6) */
103 SPARC_O7_REGNUM
, /* %o7 */
104 SPARC_L0_REGNUM
, /* %l0 */
111 SPARC_L7_REGNUM
, /* %l7 */
112 SPARC_I0_REGNUM
, /* %i0 */
118 SPARC_FP_REGNUM
, /* %fp (%i6) */
119 SPARC_I7_REGNUM
, /* %i7 */
120 SPARC_F0_REGNUM
, /* %f0 */
128 SPARC_F31_REGNUM
/* %f31 */
129 = SPARC_F0_REGNUM
+ 31
134 SPARC32_Y_REGNUM
/* %y */
135 = SPARC_F31_REGNUM
+ 1,
136 SPARC32_PSR_REGNUM
, /* %psr */
137 SPARC32_WIM_REGNUM
, /* %wim */
138 SPARC32_TBR_REGNUM
, /* %tbr */
139 SPARC32_PC_REGNUM
, /* %pc */
140 SPARC32_NPC_REGNUM
, /* %npc */
141 SPARC32_FSR_REGNUM
, /* %fsr */
142 SPARC32_CSR_REGNUM
, /* %csr */
144 /* Pseudo registers. */
145 SPARC32_D0_REGNUM
, /* %d0 */
146 SPARC32_D30_REGNUM
/* %d30 */
147 = SPARC32_D0_REGNUM
+ 15
151 struct sparc_frame_cache
157 /* Do we have a frame? */
160 /* The offset from the base register to the CFA. */
163 /* Mask of `local' and `in' registers saved in the register save area. */
164 unsigned short int saved_regs_mask
;
166 /* Mask of `out' registers copied or renamed to their `in' sibling. */
167 unsigned char copied_regs_mask
;
169 /* Do we have a Structure, Union or Quad-Precision return value? */
172 /* Table of saved registers. */
173 struct trad_frame_saved_reg
*saved_regs
;
176 /* Fetch the instruction at PC. */
177 extern unsigned long sparc_fetch_instruction (CORE_ADDR pc
);
179 /* Fetch StackGhost Per-Process XOR cookie. */
180 extern ULONGEST
sparc_fetch_wcookie (struct gdbarch
*gdbarch
);
182 /* Record the effect of a SAVE instruction on CACHE. */
183 extern void sparc_record_save_insn (struct sparc_frame_cache
*cache
);
185 /* Do a full analysis of the prologue at PC and update CACHE accordingly. */
186 extern CORE_ADDR
sparc_analyze_prologue (struct gdbarch
*gdbarch
,
187 CORE_ADDR pc
, CORE_ADDR current_pc
,
188 struct sparc_frame_cache
*cache
);
190 extern struct sparc_frame_cache
*
191 sparc_frame_cache (struct frame_info
*this_frame
, void **this_cache
);
193 extern struct sparc_frame_cache
*
194 sparc32_frame_cache (struct frame_info
*this_frame
, void **this_cache
);
197 sparc_in_function_epilogue_p (struct gdbarch
*gdbarch
, CORE_ADDR pc
);
201 extern int sparc_software_single_step (struct frame_info
*frame
);
203 extern void sparc_supply_rwindow (struct regcache
*regcache
,
204 CORE_ADDR sp
, int regnum
);
205 extern void sparc_collect_rwindow (const struct regcache
*regcache
,
206 CORE_ADDR sp
, int regnum
);
208 /* Register offsets for SunOS 4. */
209 extern const struct sparc_gregmap sparc32_sunos4_gregmap
;
210 extern const struct sparc_fpregmap sparc32_sunos4_fpregmap
;
211 extern const struct sparc_fpregmap sparc32_bsd_fpregmap
;
213 extern void sparc32_supply_gregset (const struct sparc_gregmap
*gregmap
,
214 struct regcache
*regcache
,
215 int regnum
, const void *gregs
);
216 extern void sparc32_collect_gregset (const struct sparc_gregmap
*gregmap
,
217 const struct regcache
*regcache
,
218 int regnum
, void *gregs
);
219 extern void sparc32_supply_fpregset (const struct sparc_fpregmap
*fpregmap
,
220 struct regcache
*regcache
,
221 int regnum
, const void *fpregs
);
222 extern void sparc32_collect_fpregset (const struct sparc_fpregmap
*fpregmap
,
223 const struct regcache
*regcache
,
224 int regnum
, void *fpregs
);
226 extern int sparc_is_annulled_branch_insn (CORE_ADDR pc
);
228 /* Functions and variables exported from sparc-sol2-tdep.c. */
230 /* Register offsets for Solaris 2. */
231 extern const struct sparc_gregmap sparc32_sol2_gregmap
;
232 extern const struct sparc_fpregmap sparc32_sol2_fpregmap
;
234 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc
, const char *name
);
236 extern const char *sparc_sol2_static_transform_name (const char *name
);
238 extern void sparc32_sol2_init_abi (struct gdbarch_info info
,
239 struct gdbarch
*gdbarch
);
241 /* Functions and variables exported from sparcnbsd-tdep.c. */
243 /* Register offsets for NetBSD. */
244 extern const struct sparc_gregmap sparc32nbsd_gregmap
;
246 /* Return the address of a system call's alternative return
248 extern CORE_ADDR
sparcnbsd_step_trap (struct frame_info
*frame
,
251 extern void sparc32nbsd_elf_init_abi (struct gdbarch_info info
,
252 struct gdbarch
*gdbarch
);
254 extern struct trad_frame_saved_reg
*
255 sparc32nbsd_sigcontext_saved_regs (struct frame_info
*next_frame
);
257 #endif /* sparc-tdep.h */