Use 64-bit intermediate in get_tsc_offset_ns to avoid overflow.
Discussed (3 weeks ago) on port-xen; okayed by yamt@, bouyer@.
This commit is contained in:
parent
294582997b
commit
12c1c974f7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: clock.c,v 1.16 2006/01/15 22:09:52 bouyer Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.17 2006/02/03 04:59:03 jld Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -34,7 +34,7 @@
|
||||
#include "opt_xen.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.16 2006/01/15 22:09:52 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.17 2006/02/03 04:59:03 jld Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -110,11 +110,11 @@ get_time_values_from_xen(void)
|
||||
static uint64_t
|
||||
get_tsc_offset_ns(void)
|
||||
{
|
||||
uint32_t tsc_delta;
|
||||
uint64_t tsc_delta;
|
||||
struct cpu_info *ci = curcpu();
|
||||
|
||||
tsc_delta = cpu_counter32() - shadow_tsc_stamp;
|
||||
return tsc_delta * 1000000000 / cpu_frequency(ci);
|
||||
tsc_delta = cpu_counter() - shadow_tsc_stamp;
|
||||
return tsc_delta * 1000000000ULL / cpu_frequency(ci);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user