qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/10] accel/tcg: remove the fake_user_interrupt guards


From: Alex Bennée
Subject: [PATCH 05/10] accel/tcg: remove the fake_user_interrupt guards
Date: Mon, 20 Mar 2023 10:10:30 +0000

At the cost of an empty tcg_ops field for most targets we can avoid
target specific hacks in cpu-exec.c

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/hw/core/tcg-cpu-ops.h |  2 +-
 accel/tcg/cpu-exec.c          | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 20e3c0ffbb..66c0cecdde 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -50,7 +50,7 @@ struct TCGCPUOps {
     void (*debug_excp_handler)(CPUState *cpu);
 
 #ifdef NEED_CPU_H
-#if defined(CONFIG_USER_ONLY) && defined(TARGET_I386)
+#if defined(CONFIG_USER_ONLY)
     /**
      * @fake_user_interrupt: Callback for 'fake exception' handling.
      *
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index f883be197f..ea2e7004fe 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -698,13 +698,13 @@ static inline bool cpu_handle_exception(CPUState *cpu, 
int *ret)
         return true;
     } else {
 #if defined(CONFIG_USER_ONLY)
-        /* if user mode only, we simulate a fake exception
-           which will be handled outside the cpu execution
-           loop */
-#if defined(TARGET_I386)
-        CPUClass *cc = CPU_GET_CLASS(cpu);
-        cc->tcg_ops->fake_user_interrupt(cpu);
-#endif /* TARGET_I386 */
+        /*
+         * For some user mode handling we simulate a fake exception
+         * which will be handled outside the cpu execution loop
+         */
+        if (cpu->cc->tcg_ops->fake_user_interrupt) {
+            cpu->cc->tcg_ops->fake_user_interrupt(cpu);
+        }
         *ret = cpu->exception_index;
         cpu->exception_index = -1;
         return true;
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]