diff mbox series

[21/37] target/xtensa: Protect semihosting call with CONFIG_SEMIHOSTING

Message ID 20250313034524.3069690-22-richard.henderson@linaro.org
State New
Headers show
Series accel/tcg, codebase: Build once patches | expand

Commit Message

Richard Henderson March 13, 2025, 3:45 a.m. UTC
Semihosting is not enabled for user-only.
Avoid the test for that case.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/xtensa/translate.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 4f02cefde3..d13d05878e 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -2241,13 +2241,16 @@  static uint32_t test_exceptions_simcall(DisasContext *dc,
                                         const OpcodeArg arg[],
                                         const uint32_t par[])
 {
-    bool is_semi = semihosting_enabled(dc->cring != 0);
-#ifdef CONFIG_USER_ONLY
-    bool ill = true;
-#else
+    bool ill = true, is_semi = false;
+
+#ifndef CONFIG_USER_ONLY
     /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
-    bool ill = dc->config->hw_version <= 250002 && !is_semi;
+    ill = dc->config->hw_version <= 250002 && !is_semi;
 #endif
+#ifdef CONFIG_SEMIHOSTING
+    is_semi = semihosting_enabled(dc->cring != 0);
+#endif
+
     if (ill || !is_semi) {
         qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n");
     }