
This patch adds gdb support for the Program Priorty Register and the Data Stream Control Register, for the powerpc linux native and core file targets, and for the powerpc linux server stub. gdb/ChangeLog: 2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * arch/ppc-linux-tdesc.h (tdesc_powerpc_isa205_ppr_dscr_vsx32l) (tdesc_powerpc_isa205_ppr_dscr_vsx64l): Declare. * arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_PPRREGSET) (PPC_LINUX_SIZEOF_DSCRREGSET): Define. (struct ppc_linux_features) <ppr_dscr>: New field. (ppc_linux_no_features): Add initializer for ppr_dscr field. * arch/ppc-linux-common.c (ppc_linux_match_description): Return new tdescs. * nat/ppc-linux.h (PPC_FEATURE2_DSCR, NT_PPC_PPR, NT_PPC_DSCR): Define if not already defined. * features/Makefile (WHICH): Add rs6000/powerpc-isa205-ppr-dscr-vsx32l and rs6000/powerpc-isa205-ppr-dscr-vsx64l. (XMLTOC): Add rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml. * features/rs6000/power-dscr.xml: New file. * features/rs6000/power-ppr.xml: New file. * features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml: New file. * features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml: New file. * features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c: Generate. * features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c: Generate. * regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat: Generate. * regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat: Generate. * ppc-linux-nat.c: Include <sys/uio.h>. (fetch_regset, store_regset, check_regset): New functions. (fetch_register, fetch_ppc_registers): Call fetch_regset with DSCR and PPR regsets. (store_register, store_ppc_registers): Call store_regset with DSCR and PPR regsets. (ppc_linux_get_hwcap2): New function. (ppc_linux_nat_target::read_description): Call ppc_linux_get_hwcap2 and check_regset, set ppr_dscr field in the features struct if needed. * ppc-linux-tdep.c: Include features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c and features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c. (ppc32_regmap_ppr, ppc32_regmap_dscr, ppc32_linux_pprregset) (ppc32_linux_dscrregset): New globals. (ppc_linux_iterate_over_regset_sections): Call back with the ppr and dscr regsets. (ppc_linux_core_read_description): Check if the ppr and dscr sections are present and set ppr_dscr in the features struct. (_initialize_ppc_linux_tdep): Call initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l and initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l. * ppc-linux-tdep.h (ppc32_linux_pprregset) (ppc32_linux_dscrregset): Declare. * ppc-tdep.h (struct gdbarch_tdep) <ppc_ppr_regnum>: New field. <ppc_dscr_regnum>: New field. (enum) <PPC_PPR_REGNUM, PPC_DSCR_REGNUM>: New enum values. * rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate ppr and dscr features. (ppc_process_record_op31): Record changes to PPR and DSCR. gdb/gdbserver/ChangeLog: 2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * configure.srv (ipa_ppc_linux_regobj): Add powerpc-isa205-ppr-dscr-vsx32l-ipa.o and powerpc-isa205-ppr-dscr-vsx64l-ipa.o. (powerpc*-*-linux*): Add powerpc-isa205-ppr-dscr-vsx32l.o and powerpc-isa205-ppr-dscr-vsx64l.o to srv_regobj, add rs6000/power-dscr.xml, rs6000/power-ppr.xml, rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml to srv_xmlfiles. * linux-ppc-tdesc-init.h (enum ppc_linux_tdesc) <PPC_TDESC_ISA205_PPR_DSCR_VSX>: New enum value. (init_registers_powerpc_isa205_ppr_dscr_vsx32l) (init_registers_powerpc_isa205_ppr_dscr_vsx64l): Declare. * linux-ppc-low.c: Include "elf/common.h" and <sys/uio.h>. (ppc_hwcap): Add comment. (ppc_hwcap2): New global. (ppc_check_regset, ppc_fill_pprregset, ppc_store_pprregset) (ppc_fill_dscrregset, ppc_store_dscrregset): New functions. (ppc_regsets): Add entries for the DSCR and PPR regsets. (ppc_arch_setup): Get AT_HWCAP2. Set ppr_dscr in features struct when needed. Set sizes for the the DSCR and PPR regsets. (ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA205_PPR_DSCR_VSX. (initialize_low_arch): Call init_registers_powerpc_isa205_ppr_dscr_vsx32l and init_registers_powerpc_isa205_ppr_dscr_vsx64l. * linux-ppc-ipa.c (get_ipa_tdesc): Handle PPC_TDESC_ISA205_PPR_DSCR_VSX. (initialize_low_tracepoint): Call init_registers_powerpc_isa205_ppr_dscr_vsx32l and init_registers_powerpc_isa205_ppr_dscr_vsx64l. gdb/testsuite/ChangeLog: 2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * gdb.arch/powerpc-ppr-dscr.c: New file. * gdb.arch/powerpc-ppr-dscr.exp: New file. gdb/doc/ChangeLog: 2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * gdb.texinfo (PowerPC Features): Describe new features "org.gnu.gdb.power.ppr" and "org.gnu.gdb.power.dscr".
87 lines
2.8 KiB
C
87 lines
2.8 KiB
C
/* Common target dependent code for GNU/Linux on PPC systems.
|
|
|
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "common-defs.h"
|
|
#include "arch/ppc-linux-common.h"
|
|
#include "arch/ppc-linux-tdesc.h"
|
|
|
|
/* Decimal Floating Point bit in AT_HWCAP.
|
|
|
|
This file can be used by a host with another architecture, e.g.
|
|
when debugging core files, which might not provide this constant. */
|
|
|
|
#ifndef PPC_FEATURE_HAS_DFP
|
|
#define PPC_FEATURE_HAS_DFP 0x00000400
|
|
#endif
|
|
|
|
bool
|
|
ppc_linux_has_isa205 (CORE_ADDR hwcap)
|
|
{
|
|
/* Power ISA 2.05 (implemented by Power 6 and newer processors)
|
|
increases the FPSCR from 32 bits to 64 bits. Even though Power 7
|
|
supports this ISA version, it doesn't have PPC_FEATURE_ARCH_2_05
|
|
set, only PPC_FEATURE_ARCH_2_06. Since for now the only bits
|
|
used in the higher half of the register are for Decimal Floating
|
|
Point, we check if that feature is available to decide the size
|
|
of the FPSCR. */
|
|
return ((hwcap & PPC_FEATURE_HAS_DFP) != 0);
|
|
}
|
|
|
|
const struct target_desc *
|
|
ppc_linux_match_description (struct ppc_linux_features features)
|
|
{
|
|
struct target_desc *tdesc = NULL;
|
|
|
|
if (features.wordsize == 8)
|
|
{
|
|
if (features.cell)
|
|
tdesc = tdesc_powerpc_cell64l;
|
|
else if (features.vsx)
|
|
tdesc = (features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l
|
|
: features.isa205? tdesc_powerpc_isa205_vsx64l
|
|
: tdesc_powerpc_vsx64l);
|
|
else if (features.altivec)
|
|
tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
|
|
: tdesc_powerpc_altivec64l);
|
|
else
|
|
tdesc = (features.isa205? tdesc_powerpc_isa205_64l
|
|
: tdesc_powerpc_64l);
|
|
}
|
|
else
|
|
{
|
|
gdb_assert (features.wordsize == 4);
|
|
|
|
if (features.cell)
|
|
tdesc = tdesc_powerpc_cell32l;
|
|
else if (features.vsx)
|
|
tdesc = (features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l
|
|
: features.isa205? tdesc_powerpc_isa205_vsx32l
|
|
: tdesc_powerpc_vsx32l);
|
|
else if (features.altivec)
|
|
tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
|
|
: tdesc_powerpc_altivec32l);
|
|
else
|
|
tdesc = (features.isa205? tdesc_powerpc_isa205_32l
|
|
: tdesc_powerpc_32l);
|
|
}
|
|
|
|
gdb_assert (tdesc != NULL);
|
|
|
|
return tdesc;
|
|
}
|