Update.
[glibc.git] / sysdeps / unix / sysv / linux / i386 / dl-procinfo.h
blobc4a4e324e68f0a9cd1f18272076d38b95dca769e
1 /* Linux/i386 version of processor capability information handling macros.
2 Copyright (C) 1998, 1999, 2000 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 Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #ifndef _DL_PROCINFO_H
22 #define _DL_PROCINFO_H 1
24 /* If anything should be added here check whether the size of each string
25 is still ok with the given array size. */
26 static const char x86_cap_flags[][7] =
28 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
29 "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov",
30 "pat", "pse36", "psn", "19", "20", "21", "22", "mmx",
31 "osfxsr", "xmm", "26", "27", "28", "29", "30", "amd3d"
33 #define _DL_HWCAP_COUNT 32
35 static inline int
36 __attribute__ ((unused))
37 _dl_procinfo (int word)
39 /* This table should match the information from arch/i386/kernel/setup.c
40 in the kernel sources. */
41 int i;
43 _dl_sysdep_message ("AT_HWCAP: ", NULL);
45 for (i = 0; i < _DL_HWCAP_COUNT; ++i)
46 if (word & (1 << i))
47 _dl_sysdep_message (" ", x86_cap_flags[i], NULL);
49 _dl_sysdep_message ("\n", NULL);
51 return 0;
54 static inline const char *
55 __attribute__ ((unused))
56 _dl_hwcap_string (int idx)
58 return x86_cap_flags[idx];
61 enum
63 HWCAP_I386_FPU = 1 << 0,
64 HWCAP_I386_VME = 1 << 1,
65 HWCAP_I386_DE = 1 << 2,
66 HWCAP_I386_PSE = 1 << 3,
67 HWCAP_I386_TSC = 1 << 4,
68 HWCAP_I386_MSR = 1 << 5,
69 HWCAP_I386_PAE = 1 << 6,
70 HWCAP_I386_MCE = 1 << 7,
71 HWCAP_I386_CX8 = 1 << 8,
72 HWCAP_I386_APIC = 1 << 9,
73 HWCAP_I386_SEP = 1 << 11,
74 HWCAP_I386_MTRR = 1 << 12,
75 HWCAP_I386_PGE = 1 << 13,
76 HWCAP_I386_MCA = 1 << 14,
77 HWCAP_I386_CMOV = 1 << 15,
78 HWCAP_I386_FCMOV = 1 << 16,
79 HWCAP_I386_MMX = 1 << 23,
80 HWCAP_I386_OSFXSR = 1 << 24,
81 HWCAP_I386_AMD3D = 1 << 31,
83 /* XXX Which others to add here? */
84 HWCAP_IMPORTANT = (HWCAP_I386_MMX)
87 static inline int
88 __attribute__ ((unused))
89 _dl_string_hwcap (const char *str)
91 int i;
93 for (i = 0; i < _DL_HWCAP_COUNT; i++)
95 if (strcmp (str, x86_cap_flags[i]) == 0)
96 return i;
98 return -1;
101 #endif /* dl-procinfo.h */