1 /* Target-dependent code for GDB, the GNU debugger.
3 Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
32 /* From ppc-linux-tdep.c... */
33 enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
35 struct regcache *regcache,
37 const void *writebuf);
38 enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
40 struct regcache *regcache,
42 const void *writebuf);
43 CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
44 struct value *function,
45 struct regcache *regcache,
46 CORE_ADDR bp_addr, int nargs,
47 struct value **args, CORE_ADDR sp,
49 CORE_ADDR struct_addr);
50 CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
51 struct value *function,
52 struct regcache *regcache,
53 CORE_ADDR bp_addr, int nargs,
54 struct value **args, CORE_ADDR sp,
56 CORE_ADDR struct_addr);
57 CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch,
59 int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
60 struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
61 void ppc_linux_supply_gregset (struct regcache *regcache,
62 int regnum, const void *gregs, size_t size,
64 void ppc_linux_supply_fpregset (const struct regset *regset,
65 struct regcache *regcache,
66 int regnum, const void *gregs, size_t size);
68 enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch,
70 struct regcache *regcache,
72 const void *writebuf);
74 /* From rs6000-tdep.c... */
75 int altivec_register_p (int regno);
76 int spe_register_p (int regno);
78 /* Return non-zero if the architecture described by GDBARCH has
79 floating-point registers (f0 --- f31 and fpscr). */
80 int ppc_floating_point_unit_p (struct gdbarch *gdbarch);
82 /* Register set description. */
84 struct ppc_reg_offsets
86 /* General-purpose registers. */
96 /* Floating-point registers. */
100 /* AltiVec registers. */
106 /* Supply register REGNUM in the general-purpose register set REGSET
107 from the buffer specified by GREGS and LEN to register cache
108 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
110 extern void ppc_supply_gregset (const struct regset *regset,
111 struct regcache *regcache,
112 int regnum, const void *gregs, size_t len);
114 /* Supply register REGNUM in the floating-point register set REGSET
115 from the buffer specified by FPREGS and LEN to register cache
116 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
118 extern void ppc_supply_fpregset (const struct regset *regset,
119 struct regcache *regcache,
120 int regnum, const void *fpregs, size_t len);
122 /* Collect register REGNUM in the general-purpose register set
123 REGSET. from register cache REGCACHE into the buffer specified by
124 GREGS and LEN. If REGNUM is -1, do this for all registers in
127 extern void ppc_collect_gregset (const struct regset *regset,
128 const struct regcache *regcache,
129 int regnum, void *gregs, size_t len);
131 /* Collect register REGNUM in the floating-point register set
132 REGSET. from register cache REGCACHE into the buffer specified by
133 FPREGS and LEN. If REGNUM is -1, do this for all registers in
136 extern void ppc_collect_fpregset (const struct regset *regset,
137 const struct regcache *regcache,
138 int regnum, void *fpregs, size_t len);
140 /* Private data that this module attaches to struct gdbarch. */
144 int wordsize; /* size in bytes of fixed-point word */
145 const struct reg *regs; /* from current variant */
146 int ppc_gp0_regnum; /* GPR register 0 */
147 int ppc_gprs_pseudo_p; /* non-zero if GPRs are pseudo-registers */
148 int ppc_toc_regnum; /* TOC register */
149 int ppc_ps_regnum; /* Processor (or machine) status (%msr) */
150 int ppc_cr_regnum; /* Condition register */
151 int ppc_lr_regnum; /* Link register */
152 int ppc_ctr_regnum; /* Count register */
153 int ppc_xer_regnum; /* Integer exception register */
155 /* On PPC and RS6000 variants that have no floating-point
156 registers, the next two members will be -1. */
157 int ppc_fp0_regnum; /* floating-point register 0 */
158 int ppc_fpscr_regnum; /* Floating point status and condition
161 int ppc_sr0_regnum; /* segment register 0, or -1 on
162 variants that have no segment
165 int ppc_mq_regnum; /* Multiply/Divide extension register */
166 int ppc_vr0_regnum; /* First AltiVec register */
167 int ppc_vrsave_regnum; /* Last AltiVec register */
168 int ppc_ev0_regnum; /* First ev register */
169 int ppc_ev31_regnum; /* Last ev register */
170 int ppc_acc_regnum; /* SPE 'acc' register */
171 int ppc_spefscr_regnum; /* SPE 'spefscr' register */
172 int lr_frame_offset; /* Offset to ABI specific location where
173 link register is saved. */
177 /* Constants for register set sizes. */
180 ppc_num_gprs = 32, /* 32 general-purpose registers */
181 ppc_num_fprs = 32, /* 32 floating-point registers */
182 ppc_num_srs = 16, /* 16 segment registers */
183 ppc_num_vrs = 32 /* 32 Altivec vector registers */
187 /* Constants for SPR register numbers. These are *not* GDB register
188 numbers: they are the numbers used in the PowerPC ISA itself to
189 refer to these registers.
191 This table includes all the SPRs from all the variants I could find
194 There may be registers from different PowerPC variants assigned the
195 same number, but that's fine: GDB and the SIM always use the
196 numbers in the context of a particular variant, so it's not
199 We need to deviate from the naming pattern when variants have
200 special-purpose registers of the same name, but with different
201 numbers. Fortunately, this is rare: look below to see how we
202 handle the 'tcr' registers on the 403/403GX and 602. */
229 ppc_spr_counta = 150,
230 ppc_spr_countb = 151,
235 ppc_spr_lctrl1 = 156,
236 ppc_spr_lctrl2 = 157,
239 ppc_spr_vrsave = 256,
249 ppc_spr_spefscr = 512,
250 ppc_spr_ibat0u = 528,
251 ppc_spr_ibat0l = 529,
252 ppc_spr_ibat1u = 530,
253 ppc_spr_ibat1l = 531,
254 ppc_spr_ibat2u = 532,
255 ppc_spr_ibat2l = 533,
256 ppc_spr_ibat3u = 534,
257 ppc_spr_ibat3l = 535,
258 ppc_spr_dbat0u = 536,
259 ppc_spr_dbat0l = 537,
260 ppc_spr_dbat1u = 538,
261 ppc_spr_dbat1l = 539,
262 ppc_spr_dbat2u = 540,
263 ppc_spr_dbat2l = 541,
264 ppc_spr_dbat3u = 542,
265 ppc_spr_dbat3l = 543,
266 ppc_spr_ic_cst = 560,
267 ppc_spr_ic_adr = 561,
268 ppc_spr_ic_dat = 562,
269 ppc_spr_dc_cst = 568,
270 ppc_spr_dc_adr = 569,
271 ppc_spr_dc_dat = 570,
275 ppc_spr_mi_ctr = 784,
277 ppc_spr_mi_epn = 787,
278 ppc_spr_mi_twc = 789,
279 ppc_spr_mi_rpn = 790,
280 ppc_spr_mi_cam = 816,
281 ppc_spr_mi_ram0 = 817,
282 ppc_spr_mi_ram1 = 818,
283 ppc_spr_md_ctr = 792,
284 ppc_spr_m_casid = 793,
286 ppc_spr_md_epn = 795,
288 ppc_spr_md_twc = 797,
289 ppc_spr_md_rpn = 798,
291 ppc_spr_mi_dbcam = 816,
292 ppc_spr_mi_dbram0 = 817,
293 ppc_spr_mi_dbram1 = 818,
294 ppc_spr_md_dbcam = 824,
295 ppc_spr_md_cam = 824,
296 ppc_spr_md_dbram0 = 825,
297 ppc_spr_md_ram0 = 825,
298 ppc_spr_md_dbram1 = 826,
299 ppc_spr_md_ram1 = 826,
300 ppc_spr_ummcr0 = 936,
304 ppc_spr_ummcr1 = 940,
325 ppc_spr_icdbdr = 979,
334 ppc_spr_602_tcr = 984,
335 ppc_spr_403_tcr = 986,
338 ppc_spr_esasrr = 988,
359 ppc_spr_thrm1 = 1020,
361 ppc_spr_thrm2 = 1021,
363 ppc_spr_thrm3 = 1022,
365 ppc_spr_fpecr = 1022,