On 4/3/25 04:38, Alex Bennée wrote:
Rather than allowing cpus_get_virtual_clock() to fall through to
cpu_get_clock() introduce a TCG handler so it can make a decision
about what time it is.

Initially this just calls cpu_get_clock() as before but this will
change in later commits.

Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
  accel/tcg/tcg-accel-ops.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index d9b662efe3..1432d1c5b1 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -197,6 +197,11 @@ static inline void tcg_remove_all_breakpoints(CPUState 
*cpu)
      cpu_watchpoint_remove_all(cpu, BP_GDB);
  }
+static int64_t tcg_get_virtual_clock(void)
+{
+    return cpu_get_clock();
+}
+
  static void tcg_accel_ops_init(AccelOpsClass *ops)
  {
      if (qemu_tcg_mttcg_enabled()) {
@@ -212,6 +217,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
              ops->get_virtual_clock = icount_get;
              ops->get_elapsed_ticks = icount_get;
          } else {
+            ops->get_virtual_clock = tcg_get_virtual_clock;
              ops->handle_interrupt = tcg_handle_interrupt;
          }
      }

Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>

Reply via email to