When I fix my dumb moment yeah I will commit it to my repo.
The following compiles and I am just about to test it. This is not ideal, but I want to start with something basic, then clean it up.
C:
//
// Perform TSC and FSB calculations. This is traditionally done in tsc.c in XNU.
//
// For AMD Family H and ExtFamily A
if (CpuInfo->Family == 0xF && CpuInfo->ExtFamily == 0xA) {
busFreqValue = CpuInfo->FSBFrequency;
busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
busFCvtn2tValue = DivU64x64Remainder(((1000000000ULL) << 32), busFCvtt2nValue, NULL);
tscFreqValue = CpuInfo->CPUFrequency;
tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
tscFCvtn2tValue = DivU64x64Remainder(((1000000000ULL) << 32), tscFCvtt2nValue, NULL);
}
else {
busFreqValue = CpuInfo->FSBFrequency;
busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
busFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, busFCvtt2nValue, NULL);
tscFreqValue = CpuInfo->CPUFrequency;
tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
tscFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, tscFCvtt2nValue, NULL);
}
Update:
- This works on AM5
- This also works on Intel i5-12600K (Z690)
- Added some debug logs -- will capture the logs now
Last edited: