Back to index

glibc  2.9
dl-procinfo.h
Go to the documentation of this file.
00001 /* i386 version of processor capability information handling macros.
00002    Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _DL_PROCINFO_H
00022 #define _DL_PROCINFO_H      1
00023 #include <ldsodefs.h>
00024 
00025 #define _DL_HWCAP_COUNT 32
00026 
00027 #define _DL_PLATFORMS_COUNT 4
00028 
00029 /* Start at 48 to reserve some space.  */
00030 #define _DL_FIRST_PLATFORM  48
00031 /* Mask to filter out platforms.  */
00032 #define _DL_HWCAP_PLATFORM  (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
00033                              << _DL_FIRST_PLATFORM)
00034 
00035 enum
00036 {
00037   HWCAP_I386_FPU   = 1 << 0,
00038   HWCAP_I386_VME   = 1 << 1,
00039   HWCAP_I386_DE    = 1 << 2,
00040   HWCAP_I386_PSE   = 1 << 3,
00041   HWCAP_I386_TSC   = 1 << 4,
00042   HWCAP_I386_MSR   = 1 << 5,
00043   HWCAP_I386_PAE   = 1 << 6,
00044   HWCAP_I386_MCE   = 1 << 7,
00045   HWCAP_I386_CX8   = 1 << 8,
00046   HWCAP_I386_APIC  = 1 << 9,
00047   HWCAP_I386_SEP   = 1 << 11,
00048   HWCAP_I386_MTRR  = 1 << 12,
00049   HWCAP_I386_PGE   = 1 << 13,
00050   HWCAP_I386_MCA   = 1 << 14,
00051   HWCAP_I386_CMOV  = 1 << 15,
00052   HWCAP_I386_FCMOV = 1 << 16,
00053   HWCAP_I386_MMX   = 1 << 23,
00054   HWCAP_I386_OSFXSR = 1 << 24,
00055   HWCAP_I386_XMM   = 1 << 25,
00056   HWCAP_I386_XMM2  = 1 << 26,
00057   HWCAP_I386_AMD3D = 1 << 31,
00058 
00059   /* XXX Which others to add here?  */
00060   HWCAP_IMPORTANT = (HWCAP_I386_XMM2)
00061 
00062 };
00063 
00064 /* We cannot provide a general printing function.  */
00065 #define _dl_procinfo(word) -1
00066 
00067 static inline const char *
00068 __attribute__ ((unused))
00069 _dl_hwcap_string (int idx)
00070 {
00071   return GLRO(dl_x86_cap_flags)[idx];
00072 };
00073 
00074 static inline const char *
00075 __attribute__ ((unused))
00076 _dl_platform_string (int idx)
00077 {
00078   return GLRO(dl_x86_platforms)[idx - _DL_FIRST_PLATFORM];
00079 };
00080 
00081 static inline int
00082 __attribute__ ((unused, always_inline))
00083 _dl_string_hwcap (const char *str)
00084 {
00085   int i;
00086 
00087   for (i = 0; i < _DL_HWCAP_COUNT; i++)
00088     {
00089       if (strcmp (str, GLRO(dl_x86_cap_flags)[i]) == 0)
00090        return i;
00091     }
00092   return -1;
00093 };
00094 
00095 static inline int
00096 __attribute__ ((unused, always_inline))
00097 _dl_string_platform (const char *str)
00098 {
00099   int i;
00100 
00101   if (str != NULL)
00102     for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
00103       {
00104        if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0)
00105          return _DL_FIRST_PLATFORM + i;
00106       }
00107   return -1;
00108 };
00109 
00110 #endif /* dl-procinfo.h */