[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/36] target/alpha: Extract clk_helper.c from sys_helper.c
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 09/36] target/alpha: Extract clk_helper.c from sys_helper.c |
Date: |
Fri, 19 Jan 2024 12:34:38 +0100 |
Except helper_load_pcc(), all helpers from sys_helper.c
are system-emulation specific. In preparation of restricting
sys_helper.c to system emulation, extract helper_load_pcc()
to clk_helper.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231207105426.49339-2-philmd@linaro.org>
---
target/alpha/clk_helper.c | 32 ++++++++++++++++++++++++++++++++
target/alpha/sys_helper.c | 15 ---------------
target/alpha/meson.build | 1 +
3 files changed, 33 insertions(+), 15 deletions(-)
create mode 100644 target/alpha/clk_helper.c
diff --git a/target/alpha/clk_helper.c b/target/alpha/clk_helper.c
new file mode 100644
index 0000000000..26ffc231cd
--- /dev/null
+++ b/target/alpha/clk_helper.c
@@ -0,0 +1,32 @@
+/*
+ * QEMU Alpha clock helpers.
+ *
+ * Copyright (c) 2007 Jocelyn Mayer
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/timer.h"
+#include "exec/helper-proto.h"
+#include "cpu.h"
+
+uint64_t helper_load_pcc(CPUAlphaState *env)
+{
+#ifndef CONFIG_USER_ONLY
+ /*
+ * In system mode we have access to a decent high-resolution clock.
+ * In order to make OS-level time accounting work with the RPCC,
+ * present it with a well-timed clock fixed at 250MHz.
+ */
+ return (((uint64_t)env->pcc_ofs << 32)
+ | (uint32_t)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) >> 2));
+#else
+ /*
+ * In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist. Just pass through
+ * the host cpu clock ticks. Also, don't bother taking PCC_OFS into
+ * account.
+ */
+ return (uint32_t)cpu_get_host_ticks();
+#endif
+}
diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c
index c83c92dd4c..98d9a0fff7 100644
--- a/target/alpha/sys_helper.c
+++ b/target/alpha/sys_helper.c
@@ -27,21 +27,6 @@
#include "qemu/timer.h"
-uint64_t helper_load_pcc(CPUAlphaState *env)
-{
-#ifndef CONFIG_USER_ONLY
- /* In system mode we have access to a decent high-resolution clock.
- In order to make OS-level time accounting work with the RPCC,
- present it with a well-timed clock fixed at 250MHz. */
- return (((uint64_t)env->pcc_ofs << 32)
- | (uint32_t)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) >> 2));
-#else
- /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist. Just pass through the
host cpu
- clock ticks. Also, don't bother taking PCC_OFS into account. */
- return (uint32_t)cpu_get_host_ticks();
-#endif
-}
-
/* PALcode support special instructions */
#ifndef CONFIG_USER_ONLY
void helper_tbia(CPUAlphaState *env)
diff --git a/target/alpha/meson.build b/target/alpha/meson.build
index d3502dd823..ea252c99a5 100644
--- a/target/alpha/meson.build
+++ b/target/alpha/meson.build
@@ -4,6 +4,7 @@ alpha_ss.add(files(
'fpu_helper.c',
'gdbstub.c',
'helper.c',
+ 'clk_helper.c',
'int_helper.c',
'mem_helper.c',
'sys_helper.c',
--
2.41.0
- [PULL 00/36] HW core patches for 2024-01-19, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 01/36] hw/timer/hpet: Convert DPRINTF to trace events, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 02/36] backends/cryptodev: Do not ignore throttle/backends Errors, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 03/36] accel: Do not set CPUState::tcg_cflags in non-TCG accels, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 04/36] accel: Do not set CPUState::can_do_io in non-TCG accels, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 05/36] target/xtensa: use generic instruction breakpoint infrastructure, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 06/36] tests/tcg/xtensa: add icount/ibreak priority test, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 07/36] accel/tcg: Remove unused tb_invalidate_phys_addr(), Philippe Mathieu-Daudé, 2024/01/19
- [PULL 08/36] accel/tcg: Remove tb_invalidate_phys_page() from system emulation, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 09/36] target/alpha: Extract clk_helper.c from sys_helper.c,
Philippe Mathieu-Daudé <=
- [PULL 10/36] target/alpha: Only build sys_helper.c on system emulation, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 11/36] system/cpu-timers: Have icount_configure() return a boolean, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 12/36] system/cpu-timers: Introduce ICountMode enumerator, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 13/36] target/arm: Ensure icount is enabled when emulating INST_RETIRED, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 14/36] util/async: Only call icount_notify_exit() if icount is enabled, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 15/36] target/sh4: Deprecate the shix machine, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 16/36] hw/block: Deprecate the TC58128 block device, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 17/36] hw/i386/pc_piix: Make piix_intx_routing_notifier_xen() more device independent, Philippe Mathieu-Daudé, 2024/01/19
- [PULL 18/36] hw/pflash: refactor pflash_data_write(), Philippe Mathieu-Daudé, 2024/01/19
- [PULL 19/36] hw/pflash: use ldn_{be,le}_p and stn_{be,le}_p, Philippe Mathieu-Daudé, 2024/01/19