ulong restricts us to ~4.3sec on 32 bit x86 systems. We do a cast to ullong in any case, so simply pass a wider type.
Signed-off-by: Ralf Ramsauer <[email protected]> --- inmates/lib/x86/include/inmate.h | 2 +- inmates/lib/x86/timing.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/inmates/lib/x86/include/inmate.h b/inmates/lib/x86/include/inmate.h index 7664570d..f8208b7d 100644 --- a/inmates/lib/x86/include/inmate.h +++ b/inmates/lib/x86/include/inmate.h @@ -249,7 +249,7 @@ unsigned long tsc_init(void); void delay_us(unsigned long microsecs); unsigned long apic_timer_init(unsigned int vector); -void apic_timer_set(unsigned long timeout_ns); +void apic_timer_set(unsigned long long timeout_ns); u32 pci_read_config(u16 bdf, unsigned int addr, unsigned int size); void pci_write_config(u16 bdf, unsigned int addr, u32 value, diff --git a/inmates/lib/x86/timing.c b/inmates/lib/x86/timing.c index 1b28ae48..2d485e4b 100644 --- a/inmates/lib/x86/timing.c +++ b/inmates/lib/x86/timing.c @@ -139,10 +139,10 @@ unsigned long apic_timer_init(unsigned int vector) return apic_freq; } -void apic_timer_set(unsigned long timeout_ns) +void apic_timer_set(unsigned long long timeout_ns) { - unsigned long long ticks = - (unsigned long long)timeout_ns * apic_tick_freq / NS_PER_SEC; + unsigned long long ticks = timeout_ns * apic_tick_freq / NS_PER_SEC; + if (tsc_deadline) write_msr(IA32_TSC_DEADLINE, rdtsc() + ticks); else -- 2.22.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20190612130332.6175-4-ralf.ramsauer%40oth-regensburg.de. For more options, visit https://groups.google.com/d/optout.
