aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-03-18 09:38:34 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-03-18 09:38:34 +0000
commit9c895ccaa3bd87d3d35cad94d1168393e88c1343 (patch)
tree9cc03565eb418db4a2fe713137565f5364a61f74
parentb6e3835b6a867b414a99082d3c62b9a84c409a61 (diff)
downloadnewlib-github/unlabeled-1.23.2.zip
newlib-github/unlabeled-1.23.2.tar.gz
newlib-github/unlabeled-1.23.2.tar.bz2
* fhandler_proc.cc (format_proc_cpuinfo): Use IsProcessorFeaturePresentgithub/unlabeled-1.23.2unlabeled-1.23.2
only on Windows NT. Read CPU Mhz value only on NT. Revert previous change so cpuid instruction is called even on non-NT systems.
-rw-r--r--winsup/cygwin/fhandler_proc.cc130
1 files changed, 77 insertions, 53 deletions
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index 9f7b1a8..2c8698f 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -631,42 +631,38 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
debug_printf ("processor does not support CPUID instruction");
}
- if (!wincap.is_winnt ())
- {
- bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
- read_value ("VendorIdentifier", REG_SZ);
- bufptr += __small_sprintf (bufptr, "vendor id : %s\n", szBuffer);
- read_value ("Identifier", REG_SZ);
- bufptr += __small_sprintf (bufptr, "identifier : %s\n", szBuffer);
- }
- else if (!has_cpuid)
+
+ if (!has_cpuid)
{
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
read_value ("VendorIdentifier", REG_SZ);
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", szBuffer);
read_value ("Identifier", REG_SZ);
bufptr += __small_sprintf (bufptr, "identifier : %s\n", szBuffer);
- read_value ("~Mhz", REG_DWORD);
- bufptr += __small_sprintf (bufptr, "cpu MHz : %u\n", *(DWORD *) szBuffer);
-
- print ("flags :");
- if (IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE))
- print (" 3dnow");
- if (IsProcessorFeaturePresent (PF_COMPARE_EXCHANGE_DOUBLE))
- print (" cx8");
- if (!IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED))
- print (" fpu");
- if (IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE))
- print (" mmx");
- if (IsProcessorFeaturePresent (PF_PAE_ENABLED))
- print (" pae");
- if (IsProcessorFeaturePresent (PF_RDTSC_INSTRUCTION_AVAILABLE))
- print (" tsc");
- if (IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE))
- print (" sse");
- if (IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE))
- print (" sse2");
- }
+ if (wincap.is_winnt ())
+ {
+ read_value ("~Mhz", REG_DWORD);
+ bufptr += __small_sprintf (bufptr, "cpu MHz : %u\n", *(DWORD *) szBuffer);
+
+ print ("flags :");
+ if (IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE))
+ print (" 3dnow");
+ if (IsProcessorFeaturePresent (PF_COMPARE_EXCHANGE_DOUBLE))
+ print (" cx8");
+ if (!IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED))
+ print (" fpu");
+ if (IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE))
+ print (" mmx");
+ if (IsProcessorFeaturePresent (PF_PAE_ENABLED))
+ print (" pae");
+ if (IsProcessorFeaturePresent (PF_RDTSC_INSTRUCTION_AVAILABLE))
+ print (" tsc");
+ if (IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE))
+ print (" sse");
+ if (IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE))
+ print (" sse2");
+ }
+ }
else
{
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
@@ -675,8 +671,12 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
maxf &= 0xffff;
vendor_id[3] = 0;
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", (char *)vendor_id);
- read_value ("~Mhz", REG_DWORD);
- unsigned cpu_mhz = *(DWORD *)szBuffer;
+ unsigned cpu_mhz = 0;
+ if (wincap.is_winnt ())
+ {
+ read_value ("~Mhz", REG_DWORD);
+ cpu_mhz = *(DWORD *)szBuffer;
+ }
if (maxf >= 1)
{
unsigned features2, features1, extra_info, cpuid_sig;
@@ -722,26 +722,50 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
// could implement a lookup table here if someone needs it
strcpy (szBuffer, "unknown");
}
- bufptr += __small_sprintf (bufptr, "type : %s\n"
- "cpu family : %d\n"
- "model : %d\n"
- "model name : %s\n"
- "stepping : %d\n"
- "brand id : %d\n"
- "cpu count : %d\n"
- "apic id : %d\n"
- "cpu MHz : %d\n"
- "fpu : %s\n",
- type_str,
- family,
- model,
- szBuffer,
- stepping,
- brand_id,
- cpu_count,
- apic_id,
- cpu_mhz,
- IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED) ? "no" : "yes");
+ if (wincap.is_winnt ())
+ {
+ bufptr += __small_sprintf (bufptr, "type : %s\n"
+ "cpu family : %d\n"
+ "model : %d\n"
+ "model name : %s\n"
+ "stepping : %d\n"
+ "brand id : %d\n"
+ "cpu count : %d\n"
+ "apic id : %d\n"
+ "cpu MHz : %d\n"
+ "fpu : %s\n",
+ type_str,
+ family,
+ model,
+ szBuffer,
+ stepping,
+ brand_id,
+ cpu_count,
+ apic_id,
+ cpu_mhz,
+ (features1 & (1 << 0)) ? "yes" : "no");
+ }
+ else
+ {
+ bufptr += __small_sprintf (bufptr, "type : %s\n"
+ "cpu family : %d\n"
+ "model : %d\n"
+ "model name : %s\n"
+ "stepping : %d\n"
+ "brand id : %d\n"
+ "cpu count : %d\n"
+ "apic id : %d\n"
+ "fpu : %s\n",
+ type_str,
+ family,
+ model,
+ szBuffer,
+ stepping,
+ brand_id,
+ cpu_count,
+ apic_id,
+ (features1 & (1 << 0)) ? "yes" : "no");
+ }
print ("flags :");
if (features1 & (1 << 0))
print (" fpu");
@@ -814,7 +838,7 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
if (features2 & (1 << 10))
print (" cid");
}
- else
+ else if (wincap.is_winnt ())
{
bufptr += __small_sprintf (bufptr, "cpu MHz : %d\n"
"fpu : %s\n",