.
[glibc/pb-stable.git] / sysdeps / i386 / dl-procinfo.h
blobd114fec79e7a6ae8135cdca41d103ac2e56c1a46
1 /* i386 version of processor capability information handling macros.
2 Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
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.
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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifndef _DL_PROCINFO_H
22 #define _DL_PROCINFO_H 1
23 #include <ldsodefs.h>
25 #define _DL_HWCAP_COUNT 32
27 #define _DL_PLATFORMS_COUNT 4
29 /* Start at 48 to reserve some space. */
30 #define _DL_FIRST_PLATFORM 48
31 /* Mask to filter out platforms. */
32 #define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
33 << _DL_FIRST_PLATFORM)
35 enum
37 HWCAP_I386_FPU = 1 << 0,
38 HWCAP_I386_VME = 1 << 1,
39 HWCAP_I386_DE = 1 << 2,
40 HWCAP_I386_PSE = 1 << 3,
41 HWCAP_I386_TSC = 1 << 4,
42 HWCAP_I386_MSR = 1 << 5,
43 HWCAP_I386_PAE = 1 << 6,
44 HWCAP_I386_MCE = 1 << 7,
45 HWCAP_I386_CX8 = 1 << 8,
46 HWCAP_I386_APIC = 1 << 9,
47 HWCAP_I386_SEP = 1 << 11,
48 HWCAP_I386_MTRR = 1 << 12,
49 HWCAP_I386_PGE = 1 << 13,
50 HWCAP_I386_MCA = 1 << 14,
51 HWCAP_I386_CMOV = 1 << 15,
52 HWCAP_I386_FCMOV = 1 << 16,
53 HWCAP_I386_MMX = 1 << 23,
54 HWCAP_I386_OSFXSR = 1 << 24,
55 HWCAP_I386_XMM = 1 << 25,
56 HWCAP_I386_XMM2 = 1 << 26,
57 HWCAP_I386_AMD3D = 1 << 31,
59 /* XXX Which others to add here? */
60 HWCAP_IMPORTANT = (HWCAP_I386_XMM2)
64 /* We cannot provide a general printing function. */
65 #define _dl_procinfo(word) -1
67 static inline const char *
68 __attribute__ ((unused))
69 _dl_hwcap_string (int idx)
71 return GLRO(dl_x86_cap_flags)[idx];
74 static inline const char *
75 __attribute__ ((unused))
76 _dl_platform_string (int idx)
78 return GLRO(dl_x86_platforms)[idx - _DL_FIRST_PLATFORM];
81 static inline int
82 __attribute__ ((unused, always_inline))
83 _dl_string_hwcap (const char *str)
85 int i;
87 for (i = 0; i < _DL_HWCAP_COUNT; i++)
89 if (strcmp (str, GLRO(dl_x86_cap_flags)[i]) == 0)
90 return i;
92 return -1;
95 static inline int
96 __attribute__ ((unused, always_inline))
97 _dl_string_platform (const char *str)
99 int i;
101 if (str != NULL)
102 for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
104 if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0)
105 return _DL_FIRST_PLATFORM + i;
107 return -1;
110 #endif /* dl-procinfo.h */