1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-10 22:59:13 +00:00

RDMSR: Fix casts in get_amd_multipliers()

Resolves #94
This commit is contained in:
Xorg 2018-11-04 17:11:38 +01:00
parent 3a8343c77c
commit 92d3a77105

View file

@ -702,7 +702,7 @@ static int get_amd_multipliers(struct msr_info_t *info, uint32_t pstate, double
Note: This family contains only APUs */ Note: This family contains only APUs */
err = cpu_rdmsr_range(info->handle, pstate, 8, 6, &CpuDid); err = cpu_rdmsr_range(info->handle, pstate, 8, 6, &CpuDid);
err += cpu_rdmsr_range(info->handle, pstate, 5, 0, &CpuFid); err += cpu_rdmsr_range(info->handle, pstate, 5, 0, &CpuFid);
*multiplier = (double) ((CpuFid + magic_constant) / (1ull << CpuDid)) / divisor; *multiplier = ((double) (CpuFid + magic_constant) / (1ull << CpuDid)) / divisor;
break; break;
case 0x17: case 0x17:
/* PPR 17h, pages 30 and 138-139 /* PPR 17h, pages 30 and 138-139
@ -711,7 +711,7 @@ static int get_amd_multipliers(struct msr_info_t *info, uint32_t pstate, double
CoreCOF is (Core::X86::Msr::PStateDef[CpuFid[7:0]] / Core::X86::Msr::PStateDef[CpuDfsId]) * 200 */ CoreCOF is (Core::X86::Msr::PStateDef[CpuFid[7:0]] / Core::X86::Msr::PStateDef[CpuDfsId]) * 200 */
err = cpu_rdmsr_range(info->handle, pstate, 13, 8, &CpuDid); err = cpu_rdmsr_range(info->handle, pstate, 13, 8, &CpuDid);
err += cpu_rdmsr_range(info->handle, pstate, 7, 0, &CpuFid); err += cpu_rdmsr_range(info->handle, pstate, 7, 0, &CpuFid);
*multiplier = (double) (CpuFid / CpuDid) * 2; *multiplier = ((double) CpuFid / CpuDid) * 2;
break; break;
default: default:
err = 1; err = 1;