[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/16] target/mips/cp0_timer: Explicit unit in variable name
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 03/16] target/mips/cp0_timer: Explicit unit in variable name |
Date: |
Mon, 28 Sep 2020 19:15:26 +0200 |
Name variables holding nanoseconds with the '_ns' suffix.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/cp0_timer.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/target/mips/cp0_timer.c b/target/mips/cp0_timer.c
index 9c38e9da1c8..5194c967ae3 100644
--- a/target/mips/cp0_timer.c
+++ b/target/mips/cp0_timer.c
@@ -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);
}
}
--
2.26.2
- [PATCH 00/16] hw/mips: Set CPU frequency, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 05/16] target/mips/cpu: Set default CPU frequency to 200 MHz, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 04/16] target/mips/cpu: Introduce mips_cpu_properties[], Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 01/16] hw/core/cpu: Let CPU object have a clock source, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 09/16] hw/mips/mipssim: Correct CPU frequency, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 02/16] target/mips: Move cpu_mips_get_random() with CP0 helpers, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 03/16] target/mips/cp0_timer: Explicit unit in variable name,
Philippe Mathieu-Daudé <=
- [PATCH 08/16] hw/mips/fuloong2e: Set CPU frequency to 533 MHz, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 06/16] target/mips: Keep CP0 counter in sync with the CPU frequency, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 07/16] hw/mips/r4k: Explicit CPU frequency is 200 MHz, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 12/16] hw/mips/boston: Set CPU frequency to 1 GHz, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 13/16] hw/mips/malta: Set CPU frequency to 320 MHz, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 10/16] hw/mips/jazz: Correct CPU frequencies, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 11/16] hw/mips/cps: Expose input clock and connect it to CPU cores, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 14/16] hw/mips/cps: Do not allow use without input clock, Philippe Mathieu-Daudé, 2020/09/28
- [PATCH 15/16] target/mips/cpu: Do not allow system-mode use without input clock, Philippe Mathieu-Daudé, 2020/09/28