Chameleon

Chameleon Commit Details

Date:2011-07-20 16:08:27 (12 years 9 months ago)
Author:Evan Lojewski
Commit:1196
Parents: 1195
Message:Add a couple of div by 0 checks, just in case.
Changes:
M/trunk/i386/libsaio/cpu.c

File differences

trunk/i386/libsaio/cpu.c
451451
452452
453453
454
454
455455
456456
457457
......
467467
468468
469469
470
471
470
471
472472
473473
474474
......
487487
488488
489489
490
491
490
491
492
493
494
492495
493496
494497
p->CPU.Features |= CPU_FEATURE_MOBILE;
}
}
else if((p->CPU.Vendor == 0x68747541 /* AMD */) && (p->CPU.Family == 0x0f))
else if((p->CPU.Vendor == CPUID_VENDOR_AMD) && (p->CPU.Family == 0x0f))
{
switch(p->CPU.ExtFamily)
{
uint64_t aperf = measure_aperf_frequency();
// NOTE: tsc runs at the maccoeff (non turbo)
// *not* at the turbo frequency.
maxcoef = bitfield(msr, 54, 49) / 2 + 4; // VRIFY
currcoef = bitfield(msr, 5, 0) + 0x10; // note: this is * 2
maxcoef = bitfield(msr, 54, 49) / 2 + 4;
currcoef = bitfield(msr, 5, 0) + 0x10;
currdiv = 2 << bitfield(msr, 8, 6);
cpuFrequency = aperf;
break;
}
if (maxcoef) {
if (currdiv) {
if (maxcoef)
{
if (currdiv)
{
if(!currcoef) currcoef = maxcoef;
if(!cpuFrequency)
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
else

Archive Download the corresponding diff file

Revision: 1196