Commit | Line | Data |
---|---|---|
bd64614e PFC |
1 | /* Common target dependent code for GNU/Linux on PPC systems. |
2 | ||
42a4f53d | 3 | Copyright (C) 2018-2019 Free Software Foundation, Inc. |
bd64614e PFC |
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 | ||
268a13a5 | 20 | #include "gdbsupport/common-defs.h" |
bd64614e PFC |
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 | ||
33 | bool | |
0ec848ad | 34 | ppc_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 | ||
46 | const struct target_desc * | |
47 | ppc_linux_match_description (struct ppc_linux_features features) | |
48 | { | |
49 | struct target_desc *tdesc = NULL; | |
50 | ||
51 | if (features.wordsize == 8) | |
52 | { | |
abf516c6 | 53 | if (features.vsx) |
8d619c01 EBM |
54 | tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx64l |
55 | : features.isa207? tdesc_powerpc_isa207_vsx64l | |
f2cf6173 | 56 | : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l |
7ca18ed6 | 57 | : features.isa205? tdesc_powerpc_isa205_vsx64l |
71733a7b | 58 | : tdesc_powerpc_vsx64l); |
bd64614e | 59 | else if (features.altivec) |
71733a7b PFC |
60 | tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l |
61 | : tdesc_powerpc_altivec64l); | |
bd64614e | 62 | else |
71733a7b PFC |
63 | tdesc = (features.isa205? tdesc_powerpc_isa205_64l |
64 | : tdesc_powerpc_64l); | |
bd64614e PFC |
65 | } |
66 | else | |
67 | { | |
68 | gdb_assert (features.wordsize == 4); | |
69 | ||
abf516c6 | 70 | if (features.vsx) |
8d619c01 EBM |
71 | tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx32l |
72 | : features.isa207? tdesc_powerpc_isa207_vsx32l | |
f2cf6173 | 73 | : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l |
7ca18ed6 | 74 | : features.isa205? tdesc_powerpc_isa205_vsx32l |
71733a7b | 75 | : tdesc_powerpc_vsx32l); |
bd64614e | 76 | else if (features.altivec) |
71733a7b PFC |
77 | tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l |
78 | : tdesc_powerpc_altivec32l); | |
bd64614e | 79 | else |
71733a7b PFC |
80 | tdesc = (features.isa205? tdesc_powerpc_isa205_32l |
81 | : tdesc_powerpc_32l); | |
bd64614e PFC |
82 | } |
83 | ||
84 | gdb_assert (tdesc != NULL); | |
85 | ||
86 | return tdesc; | |
87 | } |