target-i386: avoid overflow in the tsc-frequency property

The TSC frequency fits comfortably in an int when expressed in kHz,
but it may overflow when converted to Hz. In this case,
tsc-frequency returns a negative value because x86_cpuid_get_tsc_freq
does a 32-bit multiplication before assigning to int64_t.

For simplicity just make tsc_khz a 64-bit value.

Backports commit 06ef227e5158cca6710e6c268d6a7f65a5e2811b from qemu
This commit is contained in:
Paolo Bonzini 2018-02-14 08:51:08 -05:00 committed by Lioncash
parent 13b919f5c8
commit fa2b872b0b
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -954,7 +954,7 @@ typedef struct CPUX86State {
uint8_t has_error_code;
uint32_t sipi_vector;
bool tsc_valid;
int tsc_khz;
int64_t tsc_khz;
void *kvm_xsave_buf;
uint64_t mcg_cap;