[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/20] accel/tcg: Build tcg_flags helpers as common code
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 07/20] accel/tcg: Build tcg_flags helpers as common code |
Date: |
Fri, 24 Jan 2025 00:44:01 +0100 |
While cpu-exec.c is build for each target,tcg_flags helpers
aren't target specific. Move them to cpu-exec-common.c to
build them once.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/cpu-exec-common.c | 33 +++++++++++++++++++++++++++++++++
accel/tcg/cpu-exec.c | 32 --------------------------------
2 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index 6ecfc4e7c21..100746d555a 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "exec/log.h"
#include "system/cpus.h"
#include "system/tcg.h"
#include "qemu/plugin.h"
@@ -25,6 +26,38 @@
bool tcg_allowed;
+bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
+{
+ return cpu->tcg_cflags & flags;
+}
+
+void tcg_cflags_set(CPUState *cpu, uint32_t flags)
+{
+ cpu->tcg_cflags |= flags;
+}
+
+uint32_t curr_cflags(CPUState *cpu)
+{
+ uint32_t cflags = cpu->tcg_cflags;
+
+ /*
+ * Record gdb single-step. We should be exiting the TB by raising
+ * EXCP_DEBUG, but to simplify other tests, disable chaining too.
+ *
+ * For singlestep and -d nochain, suppress goto_tb so that
+ * we can log -d cpu,exec after every TB.
+ */
+ if (unlikely(cpu->singlestep_enabled)) {
+ cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
+ } else if (qatomic_read(&one_insn_per_tb)) {
+ cflags |= CF_NO_GOTO_TB | 1;
+ } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
+ cflags |= CF_NO_GOTO_TB;
+ }
+
+ return cflags;
+}
+
/* exit the current TB, but without causing any exception to be raised */
void cpu_loop_exit_noexc(CPUState *cpu)
{
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 8b773d88478..be2ba199d3d 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -148,38 +148,6 @@ static void init_delay_params(SyncClocks *sc, const
CPUState *cpu)
}
#endif /* CONFIG USER ONLY */
-bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
-{
- return cpu->tcg_cflags & flags;
-}
-
-void tcg_cflags_set(CPUState *cpu, uint32_t flags)
-{
- cpu->tcg_cflags |= flags;
-}
-
-uint32_t curr_cflags(CPUState *cpu)
-{
- uint32_t cflags = cpu->tcg_cflags;
-
- /*
- * Record gdb single-step. We should be exiting the TB by raising
- * EXCP_DEBUG, but to simplify other tests, disable chaining too.
- *
- * For singlestep and -d nochain, suppress goto_tb so that
- * we can log -d cpu,exec after every TB.
- */
- if (unlikely(cpu->singlestep_enabled)) {
- cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
- } else if (qatomic_read(&one_insn_per_tb)) {
- cflags |= CF_NO_GOTO_TB | 1;
- } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
- cflags |= CF_NO_GOTO_TB;
- }
-
- return cflags;
-}
-
struct tb_desc {
vaddr pc;
uint64_t cs_base;
--
2.47.1
- Re: [PATCH 02/20] user: Extract common MMAP API to 'user/mmap.h', (continued)
- [PATCH 03/20] gdbstub: Check for TCG before calling tb_flush(), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 04/20] cpus: Cache CPUClass early in instance_init() handler, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 05/20] cpus: Keep default fields initialization in cpu_common_initfn(), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 06/20] accel/kvm: Remove unused 'system/cpus.h' header in kvm-cpus.h, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 07/20] accel/tcg: Build tcg_flags helpers as common code,
Philippe Mathieu-Daudé <=
- [PATCH 08/20] accel/tcg: Restrict tlb_init() / destroy() to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 09/20] accel/tcg: Restrict 'icount_align_option' global to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 10/20] accel/tcg: Rename 'hw/core/tcg-cpu-ops.h' -> 'accel/tcg/cpu-ops.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 11/20] accel: Rename 'hw/core/accel-cpu.h' -> 'accel/accel-cpu-target.h', Philippe Mathieu-Daudé, 2025/01/23