mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
fhandler_proc.cc(format_proc_cpuinfo): fix cpuid level count
Fix cpuid level count as number of non-zero leafs excluding sub-leafs.
This commit is contained in:
parent
acc8849f84
commit
74aa6e3cdb
@ -927,13 +927,30 @@ format_proc_cpuinfo (void *, char *&destbuf)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* level is number of non-zero leafs exc. sub-leafs */
|
||||||
|
int level = maxf + 1 + (maxe & 0x7fffffff) + 1;
|
||||||
|
|
||||||
|
for (uint32_t l = maxe; 0x80000001 < l; --l)
|
||||||
|
{
|
||||||
|
uint32_t a, b, c, d;
|
||||||
|
cpuid (&a, &b, &c, &d, l);
|
||||||
|
if (!(a | b | c | d)) --level;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t l = maxf; 1 < l; --l)
|
||||||
|
{
|
||||||
|
uint32_t a, b, c, d;
|
||||||
|
cpuid (&a, &b, &c, &d, l);
|
||||||
|
if (!(a | b | c | d)) --level;
|
||||||
|
}
|
||||||
|
|
||||||
bufptr += __small_sprintf (bufptr, "fpu\t\t: %s\n"
|
bufptr += __small_sprintf (bufptr, "fpu\t\t: %s\n"
|
||||||
"fpu_exception\t: %s\n"
|
"fpu_exception\t: %s\n"
|
||||||
"cpuid level\t: %d\n"
|
"cpuid level\t: %d\n"
|
||||||
"wp\t\t: yes\n",
|
"wp\t\t: yes\n",
|
||||||
(features1 & (1 << 0)) ? "yes" : "no",
|
(features1 & (1 << 0)) ? "yes" : "no",
|
||||||
(features1 & (1 << 0)) ? "yes" : "no",
|
(features1 & (1 << 0)) ? "yes" : "no",
|
||||||
maxf);
|
level);
|
||||||
print ("flags\t\t:");
|
print ("flags\t\t:");
|
||||||
if (features1 & (1 << 0))
|
if (features1 & (1 << 0))
|
||||||
print (" fpu");
|
print (" fpu");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user