Skip to content

Commit

Permalink
tools: turbostat: fix bitwise and operand
Browse files Browse the repository at this point in the history
bug could cause false positive on indicating
presence of invarient TSC or APERF support.

Signed-off-by: Thomas Renninger <[email protected]>
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
watologo1 authored and lenb committed Feb 11, 2011
1 parent 6148a47 commit 8209e05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ void check_cpuid()
* this check is valid for both Intel and AMD
*/
asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x80000007));
has_invariant_tsc = edx && (1 << 8);
has_invariant_tsc = edx & (1 << 8);

if (!has_invariant_tsc) {
fprintf(stderr, "No invariant TSC\n");
Expand All @@ -905,7 +905,7 @@ void check_cpuid()
*/

asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x6));
has_aperf = ecx && (1 << 0);
has_aperf = ecx & (1 << 0);
if (!has_aperf) {
fprintf(stderr, "No APERF MSR\n");
exit(1);
Expand Down

0 comments on commit 8209e05

Please sign in to comment.