source: trunk/libs/newlib/src/newlib/libc/sys/linux/machine/i386/dl-procinfo.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 3.3 KB
Line 
1/* Linux/i386 version of processor capability information handling macros.
2   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3   This file is part of the GNU C Library.
4   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
5
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.
10
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.
15
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.  */
20
21#ifndef _DL_PROCINFO_H
22#define _DL_PROCINFO_H  1
23
24#include <ldsodefs.h>
25
26/* If anything should be added here check whether the size of each string
27   is still ok with the given array size.  */
28extern const char _dl_x86_cap_flags[][7];
29#define _DL_HWCAP_COUNT 32
30
31extern const char _dl_x86_platforms[][5];
32#define _DL_PLATFORMS_COUNT     4
33
34/* Start at 48 to reserve some space.  */
35#define _DL_FIRST_PLATFORM      48
36/* Mask to filter out platforms.  */
37#define _DL_HWCAP_PLATFORM      (7ULL << _DL_FIRST_PLATFORM)
38
39
40static inline int
41__attribute__ ((__unused__))
42_dl_procinfo (int word)
43{
44  /* This table should match the information from arch/i386/kernel/setup.c
45     in the kernel sources.  */
46  int i;
47
48  _dl_printf ("AT_HWCAP:   ");
49
50  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
51    if (word & (1 << i))
52      _dl_printf (" %s", _dl_x86_cap_flags[i]);
53
54  _dl_printf ("\n");
55
56  return 0;
57}
58
59static inline const char *
60__attribute__ ((__unused__))
61_dl_hwcap_string (int idx)
62{
63  return _dl_x86_cap_flags[idx];
64};
65
66static inline const char *
67__attribute__ ((__unused__))
68_dl_platform_string (int idx)
69{
70  return _dl_x86_platforms [idx - _DL_FIRST_PLATFORM];
71};
72
73enum
74{
75  HWCAP_I386_FPU   = 1 << 0,
76  HWCAP_I386_VME   = 1 << 1,
77  HWCAP_I386_DE    = 1 << 2,
78  HWCAP_I386_PSE   = 1 << 3,
79  HWCAP_I386_TSC   = 1 << 4,
80  HWCAP_I386_MSR   = 1 << 5,
81  HWCAP_I386_PAE   = 1 << 6,
82  HWCAP_I386_MCE   = 1 << 7,
83  HWCAP_I386_CX8   = 1 << 8,
84  HWCAP_I386_APIC  = 1 << 9,
85  HWCAP_I386_SEP   = 1 << 11,
86  HWCAP_I386_MTRR  = 1 << 12,
87  HWCAP_I386_PGE   = 1 << 13,
88  HWCAP_I386_MCA   = 1 << 14,
89  HWCAP_I386_CMOV  = 1 << 15,
90  HWCAP_I386_FCMOV = 1 << 16,
91  HWCAP_I386_MMX   = 1 << 23,
92  HWCAP_I386_OSFXSR = 1 << 24,
93  HWCAP_I386_XMM   = 1 << 25,
94  HWCAP_I386_XMM2  = 1 << 26,
95  HWCAP_I386_AMD3D = 1 << 31,
96
97  /* XXX Which others to add here?  */
98  HWCAP_IMPORTANT = (HWCAP_I386_MMX)
99
100};
101
102static inline int
103__attribute__ ((__unused__))
104_dl_string_hwcap (const char *str)
105{
106  int i;
107
108  for (i = 0; i < _DL_HWCAP_COUNT; i++)
109    {
110      if (strcmp (str, _dl_x86_cap_flags[i]) == 0)
111        return i;
112    }
113  return -1;
114};
115
116
117static inline int
118__attribute__ ((__unused__))
119_dl_string_platform (const char *str)
120{
121  int i;
122
123  if (str != NULL)
124    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
125      {
126        if (strcmp (str, _dl_x86_platforms[i]) == 0)
127          return _DL_FIRST_PLATFORM + i;
128      }
129  return -1;
130};
131
132#endif /* dl-procinfo.h */
Note: See TracBrowser for help on using the repository browser.