Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ ALL_TARGET_OBS = \
arch/arm-get-next-pcs.o \
arch/arm-linux.o \
arch/i386.o \
arch/ppc-fbsd-common.o \
arch/ppc-linux-common.o \
arm-bsd-tdep.o \
arm-fbsd-tdep.o \
Expand Down Expand Up @@ -1414,6 +1415,7 @@ HFILES_NO_SRCDIR = \
arch/aarch64-insn.h \
arch/arm.h \
arch/i386.h \
arch/ppc-fbsd-common.h \
arch/ppc-linux-common.h \
arch/ppc-linux-tdesc.h \
cli/cli-cmds.h \
Expand Down
59 changes: 59 additions & 0 deletions gdb/arch/ppc-fbsd-common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Common target dependent code for FreeBSD 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-fbsd-common.h"

extern struct target_desc *tdesc_powerpc_32;
extern struct target_desc *tdesc_powerpc_altivec32;
extern struct target_desc *tdesc_powerpc_vsx32;
extern struct target_desc *tdesc_powerpc_64;
extern struct target_desc *tdesc_powerpc_altivec64;
extern struct target_desc *tdesc_powerpc_vsx64;

const struct target_desc *
ppc_fbsd_match_description (struct ppc_fbsd_features features)
{
struct target_desc *tdesc = NULL;

if (features.wordsize == 8)
{
if (features.vsx)
tdesc = tdesc_powerpc_vsx64;
else if (features.altivec)
tdesc = tdesc_powerpc_altivec64;
else
tdesc = tdesc_powerpc_64;
}
else
{
gdb_assert (features.wordsize == 4);

if (features.vsx)
tdesc = tdesc_powerpc_vsx32;
else if (features.altivec)
tdesc = tdesc_powerpc_altivec32;
else
tdesc = tdesc_powerpc_32;
}

gdb_assert (tdesc != NULL);

return tdesc;
}
86 changes: 86 additions & 0 deletions gdb/arch/ppc-fbsd-common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* Common target dependent code for FreeBSD 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/>. */

#ifndef ARCH_PPC_FBSD_COMMON_H
#define ARCH_PPC_FBSD_COMMON_H

struct target_desc;

#define PPC_FBSD_SIZEOF_GREGSET_32 148
#define PPC_FBSD_SIZEOF_GREGSET_64 296
#define PPC_FBSD_SIZEOF_FPREGSET 264

/* PT_GETVRREGS returns data as defined in machine/pcb.h:
32 128-bit registers + 8 spare bytes + VRSAVE (4 bytes) + VSCR (4 bytes). */
#define PPC_FBSD_SIZEOF_VRREGSET (32*16 + 8 + 4 + 4)

/* This is the layout of the POWER7 VSX registers and the way they overlap
with the existing FPR and VMX registers.

VSR doubleword 0 VSR doubleword 1
----------------------------------------------------------------
VSR[0] | FPR[0] | |
----------------------------------------------------------------
VSR[1] | FPR[1] | |
----------------------------------------------------------------
| ... | |
| ... | |
----------------------------------------------------------------
VSR[30] | FPR[30] | |
----------------------------------------------------------------
VSR[31] | FPR[31] | |
----------------------------------------------------------------
VSR[32] | VR[0] |
----------------------------------------------------------------
VSR[33] | VR[1] |
----------------------------------------------------------------
| ... |
| ... |
----------------------------------------------------------------
VSR[62] | VR[30] |
----------------------------------------------------------------
VSR[63] | VR[31] |
----------------------------------------------------------------

VSX has 64 128bit registers. The first 32 registers overlap with
the FP registers (doubleword 0) and hence extend them with additional
64 bits (doubleword 1). The other 32 regs overlap with the VMX
registers. */
#define PPC_FBSD_SIZEOF_VSXREGSET (32*8)

/* Features used to determine the target description. */
struct ppc_fbsd_features
{
unsigned int wordsize;
bool altivec;
bool vsx;
};

/* Base value for ppc_fbsd_features variables. */
const struct ppc_fbsd_features ppc_fbsd_no_features = {
0,
false,
false
};

/* Return a target description that matches FEATURES. */
const struct target_desc *
ppc_fbsd_match_description (struct ppc_fbsd_features features);

#endif /* ARCH_PPC_FBSD_COMMON_H */
3 changes: 2 additions & 1 deletion gdb/configure.tgt
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ powerpc*-*-freebsd*)
# Target: FreeBSD/powerpc
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
ppc-fbsd-tdep.o \
ravenscar-thread.o ppc-ravenscar-thread.o"
ravenscar-thread.o ppc-ravenscar-thread.o \
arch/ppc-fbsd-common.o"
;;

powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
Expand Down
Loading