4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 03:20:28 +08:00

* 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.
This commit is contained in:
Corinna Vinschen 2003-03-18 09:30:03 +00:00
parent bc1658ad66
commit dcd350f0ec
2 changed files with 82 additions and 52 deletions

View File

@ -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> 2003-03-17 Corinna Vinschen <corinna@vinschen.de>
* glob.c (g_lstat): Change API minor test to match API minor number * glob.c (g_lstat): Change API minor test to match API minor number

View File

@ -631,21 +631,16 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
debug_printf ("processor does not support CPUID instruction"); debug_printf ("processor does not support CPUID instruction");
} }
if (!wincap.is_winnt ())
if (!has_cpuid)
{ {
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number); bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
read_value ("VendorIdentifier", REG_SZ); read_value ("VendorIdentifier", REG_SZ);
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", szBuffer); bufptr += __small_sprintf (bufptr, "vendor id : %s\n", szBuffer);
read_value ("Identifier", REG_SZ); read_value ("Identifier", REG_SZ);
bufptr += __small_sprintf (bufptr, "identifier : %s\n", szBuffer); bufptr += __small_sprintf (bufptr, "identifier : %s\n", szBuffer);
} if (wincap.is_winnt ())
else 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); read_value ("~Mhz", REG_DWORD);
bufptr += __small_sprintf (bufptr, "cpu MHz : %u\n", *(DWORD *) szBuffer); bufptr += __small_sprintf (bufptr, "cpu MHz : %u\n", *(DWORD *) szBuffer);
@ -667,6 +662,7 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
if (IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE)) if (IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE))
print (" sse2"); print (" sse2");
} }
}
else else
{ {
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number); bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
@ -675,8 +671,12 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
maxf &= 0xffff; maxf &= 0xffff;
vendor_id[3] = 0; vendor_id[3] = 0;
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", (char *)vendor_id); bufptr += __small_sprintf (bufptr, "vendor id : %s\n", (char *)vendor_id);
unsigned cpu_mhz = 0;
if (wincap.is_winnt ())
{
read_value ("~Mhz", REG_DWORD); read_value ("~Mhz", REG_DWORD);
unsigned cpu_mhz = *(DWORD *)szBuffer; cpu_mhz = *(DWORD *)szBuffer;
}
if (maxf >= 1) if (maxf >= 1)
{ {
unsigned features2, features1, extra_info, cpuid_sig; unsigned features2, features1, extra_info, cpuid_sig;
@ -722,6 +722,8 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
// could implement a lookup table here if someone needs it // could implement a lookup table here if someone needs it
strcpy (szBuffer, "unknown"); strcpy (szBuffer, "unknown");
} }
if (wincap.is_winnt ())
{
bufptr += __small_sprintf (bufptr, "type : %s\n" bufptr += __small_sprintf (bufptr, "type : %s\n"
"cpu family : %d\n" "cpu family : %d\n"
"model : %d\n" "model : %d\n"
@ -741,7 +743,29 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
cpu_count, cpu_count,
apic_id, apic_id,
cpu_mhz, cpu_mhz,
IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED) ? "no" : "yes"); (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 :"); print ("flags :");
if (features1 & (1 << 0)) if (features1 & (1 << 0))
print (" fpu"); print (" fpu");
@ -814,7 +838,7 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
if (features2 & (1 << 10)) if (features2 & (1 << 10))
print (" cid"); print (" cid");
} }
else else if (wincap.is_winnt ())
{ {
bufptr += __small_sprintf (bufptr, "cpu MHz : %d\n" bufptr += __small_sprintf (bufptr, "cpu MHz : %d\n"
"fpu : %s\n", "fpu : %s\n",