[PowerPC] Add support for TAR
[deliverable/binutils-gdb.git] / gdb / arch / ppc-linux-common.c
CommitLineData
bd64614e
PFC
1/* Common target dependent code for GNU/Linux on PPC systems.
2
3 Copyright (C) 2018 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20#include "common-defs.h"
21#include "arch/ppc-linux-common.h"
22#include "arch/ppc-linux-tdesc.h"
23
24/* Decimal Floating Point bit in AT_HWCAP.
25
26 This file can be used by a host with another architecture, e.g.
27 when debugging core files, which might not provide this constant. */
28
29#ifndef PPC_FEATURE_HAS_DFP
30#define PPC_FEATURE_HAS_DFP 0x00000400
31#endif
32
33bool
0ec848ad 34ppc_linux_has_isa205 (CORE_ADDR hwcap)
bd64614e
PFC
35{
36 /* Power ISA 2.05 (implemented by Power 6 and newer processors)
37 increases the FPSCR from 32 bits to 64 bits. Even though Power 7
38 supports this ISA version, it doesn't have PPC_FEATURE_ARCH_2_05
39 set, only PPC_FEATURE_ARCH_2_06. Since for now the only bits
40 used in the higher half of the register are for Decimal Floating
41 Point, we check if that feature is available to decide the size
42 of the FPSCR. */
43 return ((hwcap & PPC_FEATURE_HAS_DFP) != 0);
44}
45
46const struct target_desc *
47ppc_linux_match_description (struct ppc_linux_features features)
48{
49 struct target_desc *tdesc = NULL;
50
51 if (features.wordsize == 8)
52 {
53 if (features.cell)
54 tdesc = tdesc_powerpc_cell64l;
55 else if (features.vsx)
f2cf6173
EBM
56 tdesc = (features.isa207? tdesc_powerpc_isa207_vsx64l
57 : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l
7ca18ed6 58 : features.isa205? tdesc_powerpc_isa205_vsx64l
71733a7b 59 : tdesc_powerpc_vsx64l);
bd64614e 60 else if (features.altivec)
71733a7b
PFC
61 tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
62 : tdesc_powerpc_altivec64l);
bd64614e 63 else
71733a7b
PFC
64 tdesc = (features.isa205? tdesc_powerpc_isa205_64l
65 : tdesc_powerpc_64l);
bd64614e
PFC
66 }
67 else
68 {
69 gdb_assert (features.wordsize == 4);
70
71 if (features.cell)
72 tdesc = tdesc_powerpc_cell32l;
73 else if (features.vsx)
f2cf6173
EBM
74 tdesc = (features.isa207? tdesc_powerpc_isa207_vsx32l
75 : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l
7ca18ed6 76 : features.isa205? tdesc_powerpc_isa205_vsx32l
71733a7b 77 : tdesc_powerpc_vsx32l);
bd64614e 78 else if (features.altivec)
71733a7b
PFC
79 tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
80 : tdesc_powerpc_altivec32l);
bd64614e 81 else
71733a7b
PFC
82 tdesc = (features.isa205? tdesc_powerpc_isa205_32l
83 : tdesc_powerpc_32l);
bd64614e
PFC
84 }
85
86 gdb_assert (tdesc != NULL);
87
88 return tdesc;
89}
This page took 0.058679 seconds and 4 git commands to generate.