From b0092bd84eca905b41aa7caaddcb16bbb7142c23 Mon Sep 17 00:00:00 2001 From: Veselin Georgiev Date: Fri, 2 Oct 2009 09:14:45 +0000 Subject: [PATCH] Added support for reading the max multiplier git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@74 3b4be424-7ac5-41d7-8526-f4ddcb85d872 --- cpuid_tool/cpuid_tool.c | 3 ++- libcpuid/rdmsr.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cpuid_tool/cpuid_tool.c b/cpuid_tool/cpuid_tool.c index bbfffae..16c51e6 100644 --- a/cpuid_tool/cpuid_tool.c +++ b/cpuid_tool/cpuid_tool.c @@ -411,7 +411,8 @@ static void print_info(output_data_switch query, struct cpu_raw_data_t* raw, } else { fprintf(fout, "mperf = %d\n", cpu_msrinfo(handle, INFO_MPERF)); fprintf(fout, "aperf = %d\n", cpu_msrinfo(handle, INFO_APERF)); - fprintf(fout, "cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_CUR_MULTIPLIER) / 100.0f); + fprintf(fout, "current cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_CUR_MULTIPLIER) / 100.0f); + fprintf(fout, "max cpu:fsb = %.1f\n", cpu_msrinfo(handle, INFO_MAX_MULTIPLIER) / 100.0f); cpu_msr_driver_close(handle); } break; diff --git a/libcpuid/rdmsr.c b/libcpuid/rdmsr.c index 45bc2ce..2ea1790 100644 --- a/libcpuid/rdmsr.c +++ b/libcpuid/rdmsr.c @@ -389,9 +389,14 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which) { err = cpu_rdmsr(handle, 0x2a, &r); if (err) return CPU_INVALID_VALUE; - return (int) ((r >> 22) & 0x3f) * 100; + return (int) ((r>>22) & 0x1f) * 100; } case INFO_MAX_MULTIPLIER: + { + err = cpu_rdmsr(handle, 0x198, &r); + if (err) return CPU_INVALID_VALUE; + return (int) ((r >> 40) & 0x1f) * 100; + } case INFO_TEMPERATURE: case INFO_THROTTLING: default: