@@ -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.
*
@@ -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;
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(-)