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 | { | |
53 | if (features.cell) | |
54 | tdesc = tdesc_powerpc_cell64l; | |
55 | else if (features.vsx) | |
8d619c01 EBM |
56 | tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx64l |
57 | : features.isa207? tdesc_powerpc_isa207_vsx64l | |
f2cf6173 | 58 | : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l |
7ca18ed6 | 59 | : features.isa205? tdesc_powerpc_isa205_vsx64l |
71733a7b | 60 | : tdesc_powerpc_vsx64l); |
bd64614e | 61 | else if (features.altivec) |
71733a7b PFC |
62 | tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l |
63 | : tdesc_powerpc_altivec64l); | |
bd64614e | 64 | else |
71733a7b PFC |
65 | tdesc = (features.isa205? tdesc_powerpc_isa205_64l |
66 | : tdesc_powerpc_64l); | |
bd64614e PFC |
67 | } |
68 | else | |
69 | { | |
70 | gdb_assert (features.wordsize == 4); | |
71 | ||
72 | if (features.cell) | |
73 | tdesc = tdesc_powerpc_cell32l; | |
74 | else if (features.vsx) | |
8d619c01 EBM |
75 | tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx32l |
76 | : features.isa207? tdesc_powerpc_isa207_vsx32l | |
f2cf6173 | 77 | : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l |
7ca18ed6 | 78 | : features.isa205? tdesc_powerpc_isa205_vsx32l |
71733a7b | 79 | : tdesc_powerpc_vsx32l); |
bd64614e | 80 | else if (features.altivec) |
71733a7b PFC |
81 | tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l |
82 | : tdesc_powerpc_altivec32l); | |
bd64614e | 83 | else |
71733a7b PFC |
84 | tdesc = (features.isa205? tdesc_powerpc_isa205_32l |
85 | : tdesc_powerpc_32l); | |
bd64614e PFC |
86 | } |
87 | ||
88 | gdb_assert (tdesc != NULL); | |
89 | ||
90 | return tdesc; | |
91 | } |