Back to index

glibc  2.9
dl-procinfo.h
Go to the documentation of this file.
00001 /* s390 version of processor capability information handling macros.
00002    Copyright (C) 2006 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2006.
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 7
00026 
00027 #define _DL_PLATFORMS_COUNT 4
00028 
00029 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
00030 #define _DL_FIRST_PLATFORM  32
00031 /* Mask to filter out platforms.  */
00032 #define _DL_HWCAP_PLATFORM  (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
00033                              << _DL_FIRST_PLATFORM)
00034 
00035 /* Hardware capablity bit numbers are derived directly from the
00036    facility indications as stored by the "store facility list" (STFL)
00037    instruction.  */
00038 
00039 enum
00040 {
00041   HWCAP_S390_ESAN3 = 1 << 0,
00042   HWCAP_S390_ZARCH = 1 << 1,
00043   HWCAP_S390_STFLE = 1 << 2,
00044   HWCAP_S390_MSA = 1 << 3,
00045   HWCAP_S390_LDISP = 1 << 4,
00046   HWCAP_S390_EIMM = 1 << 5,
00047   HWCAP_S390_DFP = 1 << 6,
00048 };
00049 
00050 #define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
00051                        | HWCAP_S390_EIMM | HWCAP_S390_DFP)
00052 
00053 /* We cannot provide a general printing function.  */
00054 #define _dl_procinfo(word) -1
00055 
00056 static inline const char *
00057 __attribute__ ((unused))
00058 _dl_hwcap_string (int idx)
00059 {
00060   return GLRO(dl_s390_cap_flags)[idx];
00061 };
00062 
00063 static inline const char *
00064 __attribute__ ((unused))
00065 _dl_platform_string (int idx)
00066 {
00067   return GLRO(dl_s390_platforms)[idx - _DL_FIRST_PLATFORM];
00068 };
00069 
00070 static inline int
00071 __attribute__ ((unused, always_inline))
00072 _dl_string_hwcap (const char *str)
00073 {
00074   int i;
00075 
00076   for (i = 0; i < _DL_HWCAP_COUNT; i++)
00077     {
00078       if (strcmp (str, GLRO(dl_s390_cap_flags)[i]) == 0)
00079        return i;
00080     }
00081   return -1;
00082 };
00083 
00084 static inline int
00085 __attribute__ ((unused, always_inline))
00086 _dl_string_platform (const char *str)
00087 {
00088   int i;
00089 
00090   if (str != NULL)
00091     for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
00092       {
00093        if (strcmp (str, GLRO(dl_s390_platforms)[i]) == 0)
00094          return _DL_FIRST_PLATFORM + i;
00095       }
00096   return -1;
00097 };
00098 
00099 #endif /* dl-procinfo.h */