diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-03-18 09:30:03 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-03-18 09:30:03 +0000 |
commit | dcd350f0ec963e59b91118ae437e5f783a283e94 (patch) | |
tree | f40ceef0ba7e8a11e2c60e3630739fb59eddd58d /winsup | |
parent | bc1658ad661302312779eedf741ac27a25e9a747 (diff) | |
download | newlib-dcd350f0ec963e59b91118ae437e5f783a283e94.zip newlib-dcd350f0ec963e59b91118ae437e5f783a283e94.tar.gz newlib-dcd350f0ec963e59b91118ae437e5f783a283e94.tar.bz2 |
* fhandler_proc.cc (format_proc_cpuinfo): Use IsProcessorFeaturePresent
only on Windows NT. Read CPU Mhz value only on NT. Revert previous
change so cpuid instruction is called even on non-NT systems.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_proc.cc | 130 |
2 files changed, 83 insertions, 53 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6807e30..e70ae93 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2003-03-18 Christopher January <chris@atomice.net> + + * fhandler_proc.cc (format_proc_cpuinfo): Use IsProcessorFeaturePresent + only on Windows NT. Read CPU Mhz value only on NT. Revert previous + change so cpuid instruction is called even on non-NT systems. + 2003-03-17 Corinna Vinschen <corinna@vinschen.de> * glob.c (g_lstat): Change API minor test to match API minor number 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", |