mirror of
https://github.com/anrieff/libcpuid
synced 2024-11-10 22:59:13 +00:00
Fix previous commit based on comments in issue #89 thread.
This should be correct now.
This commit is contained in:
parent
88483aaba0
commit
8fe734c493
1 changed files with 3 additions and 3 deletions
|
@ -631,8 +631,8 @@ static int get_amd_multipliers(struct msr_info_t *info, uint32_t pstate, uint64_
|
|||
{ 0x6, 8 },
|
||||
{ 0x7, 12 },
|
||||
{ 0x8, 16 },
|
||||
{ CpuDid, 0 },
|
||||
};
|
||||
int num_dids = (int) COUNT_OF(divisor_t);
|
||||
|
||||
if (pstate < MSR_PSTATE_0 || MSR_PSTATE_7 < pstate)
|
||||
return 1;
|
||||
|
@ -646,9 +646,9 @@ static int get_amd_multipliers(struct msr_info_t *info, uint32_t pstate, uint64_
|
|||
err = cpu_rdmsr_range(info->handle, pstate, 8, 4, &CpuFid);
|
||||
err += cpu_rdmsr_range(info->handle, pstate, 3, 0, &CpuDid);
|
||||
i = 0;
|
||||
while(divisor_t[i].did != CpuDid)
|
||||
while (i < num_dids && divisor_t[i].did != CpuDid)
|
||||
i++;
|
||||
if (divisor_t[i].divisor > 0)
|
||||
if (i < num_dids)
|
||||
*multiplier = (uint64_t) ((CpuFid + 0x10) / divisor_t[i].divisor);
|
||||
else
|
||||
err++;
|
||||
|
|
Loading…
Reference in a new issue