Commit | Line | Data |
---|---|---|
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 | ||
33 | bool | |
34 | ppc_linux_has_isa205 (unsigned long hwcap) | |
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) | |
56 | tdesc = features.isa205 | |
57 | ? tdesc_powerpc_isa205_vsx64l : tdesc_powerpc_vsx64l; | |
58 | else if (features.altivec) | |
59 | tdesc = features.isa205 | |
60 | ? tdesc_powerpc_isa205_altivec64l : tdesc_powerpc_altivec64l; | |
61 | else | |
62 | tdesc = features.isa205? | |
63 | tdesc_powerpc_isa205_64l : tdesc_powerpc_64l; | |
64 | } | |
65 | else | |
66 | { | |
67 | gdb_assert (features.wordsize == 4); | |
68 | ||
69 | if (features.cell) | |
70 | tdesc = tdesc_powerpc_cell32l; | |
71 | else if (features.vsx) | |
72 | tdesc = features.isa205 | |
73 | ? tdesc_powerpc_isa205_vsx32l : tdesc_powerpc_vsx32l; | |
74 | else if (features.altivec) | |
75 | tdesc = features.isa205 | |
76 | ? tdesc_powerpc_isa205_altivec32l : tdesc_powerpc_altivec32l; | |
77 | else | |
78 | tdesc = features.isa205 | |
79 | ? tdesc_powerpc_isa205_32l : tdesc_powerpc_32l; | |
80 | } | |
81 | ||
82 | gdb_assert (tdesc != NULL); | |
83 | ||
84 | return tdesc; | |
85 | } |