mirror of https://github.com/xemu-project/xemu.git
target/mips/cp0_timer: Explicit unit in variable name
Name variables holding nanoseconds with the '_ns' suffix. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> Message-Id: <20201012095804.3335117-7-f4bug@amsat.org>
This commit is contained in:
parent
2dc29222a6
commit
62f8f2603d
|
@ -32,13 +32,14 @@
|
|||
/* MIPS R4K timer */
|
||||
static void cpu_mips_timer_update(CPUMIPSState *env)
|
||||
{
|
||||
uint64_t now, next;
|
||||
uint64_t now_ns, next_ns;
|
||||
uint32_t wait;
|
||||
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
wait = env->CP0_Compare - env->CP0_Count - (uint32_t)(now / TIMER_PERIOD);
|
||||
next = now + (uint64_t)wait * TIMER_PERIOD;
|
||||
timer_mod(env->timer, next);
|
||||
now_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
wait = env->CP0_Compare - env->CP0_Count -
|
||||
(uint32_t)(now_ns / TIMER_PERIOD);
|
||||
next_ns = now_ns + (uint64_t)wait * TIMER_PERIOD;
|
||||
timer_mod(env->timer, next_ns);
|
||||
}
|
||||
|
||||
/* Expire the timer. */
|
||||
|
@ -56,16 +57,16 @@ uint32_t cpu_mips_get_count(CPUMIPSState *env)
|
|||
if (env->CP0_Cause & (1 << CP0Ca_DC)) {
|
||||
return env->CP0_Count;
|
||||
} else {
|
||||
uint64_t now;
|
||||
uint64_t now_ns;
|
||||
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
now_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
if (timer_pending(env->timer)
|
||||
&& timer_expired(env->timer, now)) {
|
||||
&& timer_expired(env->timer, now_ns)) {
|
||||
/* The timer has already expired. */
|
||||
cpu_mips_timer_expire(env);
|
||||
}
|
||||
|
||||
return env->CP0_Count + (uint32_t)(now / TIMER_PERIOD);
|
||||
return env->CP0_Count + (uint32_t)(now_ns / TIMER_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue