1 /* Native support code for PPC AIX, for GDB the GNU debugger.
3 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
5 Free Software Foundation, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "gdb_string.h"
27 #include "rs6000-tdep.h"
31 /* Core file support. */
33 static struct ppc_reg_offsets rs6000_aix32_reg_offsets
=
35 /* General-purpose registers. */
47 /* Floating-point registers. */
49 56, /* fpscr_offset */
52 /* AltiVec registers. */
55 -1 /* vrsave_offset */
58 static struct ppc_reg_offsets rs6000_aix64_reg_offsets
=
60 /* General-purpose registers. */
72 /* Floating-point registers. */
74 296, /* fpscr_offset */
77 /* AltiVec registers. */
80 -1 /* vrsave_offset */
84 /* Supply register REGNUM in the general-purpose register set REGSET
85 from the buffer specified by GREGS and LEN to register cache
86 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
89 rs6000_aix_supply_regset (const struct regset
*regset
,
90 struct regcache
*regcache
, int regnum
,
91 const void *gregs
, size_t len
)
93 ppc_supply_gregset (regset
, regcache
, regnum
, gregs
, len
);
94 ppc_supply_fpregset (regset
, regcache
, regnum
, gregs
, len
);
97 /* Collect register REGNUM in the general-purpose register set
98 REGSET. from register cache REGCACHE into the buffer specified by
99 GREGS and LEN. If REGNUM is -1, do this for all registers in
103 rs6000_aix_collect_regset (const struct regset
*regset
,
104 const struct regcache
*regcache
, int regnum
,
105 void *gregs
, size_t len
)
107 ppc_collect_gregset (regset
, regcache
, regnum
, gregs
, len
);
108 ppc_collect_fpregset (regset
, regcache
, regnum
, gregs
, len
);
111 /* AIX register set. */
113 static struct regset rs6000_aix32_regset
=
115 &rs6000_aix32_reg_offsets
,
116 rs6000_aix_supply_regset
,
117 rs6000_aix_collect_regset
,
120 static struct regset rs6000_aix64_regset
=
122 &rs6000_aix64_reg_offsets
,
123 rs6000_aix_supply_regset
,
124 rs6000_aix_collect_regset
,
127 /* Return the appropriate register set for the core section identified
128 by SECT_NAME and SECT_SIZE. */
130 static const struct regset
*
131 rs6000_aix_regset_from_core_section (struct gdbarch
*gdbarch
,
132 const char *sect_name
, size_t sect_size
)
134 if (gdbarch_tdep (gdbarch
)->wordsize
== 4)
136 if (strcmp (sect_name
, ".reg") == 0 && sect_size
>= 592)
137 return &rs6000_aix32_regset
;
141 if (strcmp (sect_name
, ".reg") == 0 && sect_size
>= 576)
142 return &rs6000_aix64_regset
;
149 static enum gdb_osabi
150 rs6000_aix_osabi_sniffer (bfd
*abfd
)
153 if (bfd_get_flavour (abfd
) == bfd_target_xcoff_flavour
);
154 return GDB_OSABI_AIX
;
156 return GDB_OSABI_UNKNOWN
;
160 rs6000_aix_init_osabi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
162 /* RS6000/AIX does not support PT_STEP. Has to be simulated. */
163 set_gdbarch_software_single_step (gdbarch
, rs6000_software_single_step
);
165 /* Core file support. */
166 set_gdbarch_regset_from_core_section
167 (gdbarch
, rs6000_aix_regset_from_core_section
);
169 /* Minimum possible text address in AIX. */
170 gdbarch_tdep (gdbarch
)->text_segment_base
= 0x10000000;
174 _initialize_rs6000_aix_tdep (void)
176 gdbarch_register_osabi_sniffer (bfd_arch_rs6000
,
177 bfd_target_xcoff_flavour
,
178 rs6000_aix_osabi_sniffer
);
179 gdbarch_register_osabi_sniffer (bfd_arch_powerpc
,
180 bfd_target_xcoff_flavour
,
181 rs6000_aix_osabi_sniffer
);
183 gdbarch_register_osabi (bfd_arch_rs6000
, 0, GDB_OSABI_AIX
,
184 rs6000_aix_init_osabi
);
185 gdbarch_register_osabi (bfd_arch_powerpc
, 0, GDB_OSABI_AIX
,
186 rs6000_aix_init_osabi
);