2.9
[glibc/nacl-glibc.git] / sysdeps / s390 / dl-procinfo.h
blob178d7cc017c82ca087dd33ad97307e26a7e32c53
1 /* s390 version of processor capability information handling macros.
2 Copyright (C) 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2006.
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 7
27 #define _DL_PLATFORMS_COUNT 4
29 /* The kernel provides up to 32 capability bits with elf_hwcap. */
30 #define _DL_FIRST_PLATFORM 32
31 /* Mask to filter out platforms. */
32 #define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
33 << _DL_FIRST_PLATFORM)
35 /* Hardware capablity bit numbers are derived directly from the
36 facility indications as stored by the "store facility list" (STFL)
37 instruction. */
39 enum
41 HWCAP_S390_ESAN3 = 1 << 0,
42 HWCAP_S390_ZARCH = 1 << 1,
43 HWCAP_S390_STFLE = 1 << 2,
44 HWCAP_S390_MSA = 1 << 3,
45 HWCAP_S390_LDISP = 1 << 4,
46 HWCAP_S390_EIMM = 1 << 5,
47 HWCAP_S390_DFP = 1 << 6,
50 #define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
51 | HWCAP_S390_EIMM | HWCAP_S390_DFP)
53 /* We cannot provide a general printing function. */
54 #define _dl_procinfo(word) -1
56 static inline const char *
57 __attribute__ ((unused))
58 _dl_hwcap_string (int idx)
60 return GLRO(dl_s390_cap_flags)[idx];
63 static inline const char *
64 __attribute__ ((unused))
65 _dl_platform_string (int idx)
67 return GLRO(dl_s390_platforms)[idx - _DL_FIRST_PLATFORM];
70 static inline int
71 __attribute__ ((unused, always_inline))
72 _dl_string_hwcap (const char *str)
74 int i;
76 for (i = 0; i < _DL_HWCAP_COUNT; i++)
78 if (strcmp (str, GLRO(dl_s390_cap_flags)[i]) == 0)
79 return i;
81 return -1;
84 static inline int
85 __attribute__ ((unused, always_inline))
86 _dl_string_platform (const char *str)
88 int i;
90 if (str != NULL)
91 for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
93 if (strcmp (str, GLRO(dl_s390_platforms)[i]) == 0)
94 return _DL_FIRST_PLATFORM + i;
96 return -1;
99 #endif /* dl-procinfo.h */