1 | /* i386 version of processor capability information handling macros. |
2 | Copyright (C) 1998-2016 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2.1 of the License, or (at your option) any later version. |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Lesser General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ |
19 | |
20 | #ifndef _DL_PROCINFO_H |
21 | #define _DL_PROCINFO_H 1 |
22 | #include <ldsodefs.h> |
23 | |
24 | #define _DL_HWCAP_COUNT 32 |
25 | |
26 | #define _DL_PLATFORMS_COUNT 4 |
27 | |
28 | /* Start at 48 to reserve some space. */ |
29 | #define _DL_FIRST_PLATFORM 48 |
30 | /* Mask to filter out platforms. */ |
31 | #define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \ |
32 | << _DL_FIRST_PLATFORM) |
33 | |
34 | enum |
35 | { |
36 | HWCAP_I386_FPU = 1 << 0, |
37 | HWCAP_I386_VME = 1 << 1, |
38 | HWCAP_I386_DE = 1 << 2, |
39 | HWCAP_I386_PSE = 1 << 3, |
40 | HWCAP_I386_TSC = 1 << 4, |
41 | HWCAP_I386_MSR = 1 << 5, |
42 | HWCAP_I386_PAE = 1 << 6, |
43 | HWCAP_I386_MCE = 1 << 7, |
44 | HWCAP_I386_CX8 = 1 << 8, |
45 | HWCAP_I386_APIC = 1 << 9, |
46 | HWCAP_I386_SEP = 1 << 11, |
47 | HWCAP_I386_MTRR = 1 << 12, |
48 | HWCAP_I386_PGE = 1 << 13, |
49 | HWCAP_I386_MCA = 1 << 14, |
50 | HWCAP_I386_CMOV = 1 << 15, |
51 | HWCAP_I386_FCMOV = 1 << 16, |
52 | HWCAP_I386_MMX = 1 << 23, |
53 | HWCAP_I386_OSFXSR = 1 << 24, |
54 | HWCAP_I386_XMM = 1 << 25, |
55 | HWCAP_I386_XMM2 = 1 << 26, |
56 | HWCAP_I386_AMD3D = 1 << 31, |
57 | |
58 | /* XXX Which others to add here? */ |
59 | HWCAP_IMPORTANT = (HWCAP_I386_XMM2) |
60 | |
61 | }; |
62 | |
63 | /* We cannot provide a general printing function. */ |
64 | #define _dl_procinfo(type, word) -1 |
65 | |
66 | static inline const char * |
67 | __attribute__ ((unused)) |
68 | _dl_hwcap_string (int idx) |
69 | { |
70 | return GLRO(dl_x86_cap_flags)[idx]; |
71 | }; |
72 | |
73 | static inline const char * |
74 | __attribute__ ((unused)) |
75 | _dl_platform_string (int idx) |
76 | { |
77 | return GLRO(dl_x86_platforms)[idx - _DL_FIRST_PLATFORM]; |
78 | }; |
79 | |
80 | static inline int |
81 | __attribute__ ((unused, always_inline)) |
82 | _dl_string_hwcap (const char *str) |
83 | { |
84 | int i; |
85 | |
86 | for (i = 0; i < _DL_HWCAP_COUNT; i++) |
87 | { |
88 | if (strcmp (str, GLRO(dl_x86_cap_flags)[i]) == 0) |
89 | return i; |
90 | } |
91 | return -1; |
92 | }; |
93 | |
94 | static inline int |
95 | __attribute__ ((unused, always_inline)) |
96 | _dl_string_platform (const char *str) |
97 | { |
98 | int i; |
99 | |
100 | if (str != NULL) |
101 | for (i = 0; i < _DL_PLATFORMS_COUNT; ++i) |
102 | { |
103 | if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0) |
104 | return _DL_FIRST_PLATFORM + i; |
105 | } |
106 | return -1; |
107 | }; |
108 | |
109 | #endif /* dl-procinfo.h */ |
110 | |