mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 19:02:45 -06:00
guard against div-by-zero
This commit is contained in:
parent
b2ad4dd189
commit
e71d457af9
1 changed files with 5 additions and 2 deletions
|
@ -170,8 +170,11 @@ static CPUCaps Detect() {
|
|||
// The CPU model can be detected to use the values from turbostat
|
||||
// https://github.com/torvalds/linux/blob/master/tools/power/x86/turbostat/turbostat.c#L5569
|
||||
// but it's easier to just estimate the TSC tick rate for these cases.
|
||||
caps.tsc_frequency = static_cast<u64>(caps.crystal_frequency) *
|
||||
caps.tsc_crystal_ratio_numerator / caps.tsc_crystal_ratio_denominator;
|
||||
if (caps.tsc_crystal_ratio_denominator) {
|
||||
caps.tsc_frequency = static_cast<u64>(caps.crystal_frequency) *
|
||||
caps.tsc_crystal_ratio_numerator /
|
||||
caps.tsc_crystal_ratio_denominator;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_std_fn >= 0x16) {
|
||||
|
|
Loading…
Reference in a new issue