* 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>
* glob.c (g_lstat): Change API minor test to match API minor number

View File

@ -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);
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");
}
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",