diff mbox series

[01/14] target/i386: Simplify get_memio_eip()

Message ID 20240427155714.53669-2-philmd@linaro.org
State New
Headers show
Series exec: Rework around CPUState user fields | expand

Commit Message

Philippe Mathieu-Daudé April 27, 2024, 3:57 p.m. UTC
The single call to get_memio_eip(), in cpu_report_tpr_access(),
is protected by a check on tcg_enabled(). Since the call only
exists when CONFIG_TCG is defined, we can slightly simplify.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/helper.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Richard Henderson April 28, 2024, 6:11 p.m. UTC | #1
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote:
> The single call to get_memio_eip(), in cpu_report_tpr_access(),
> is protected by a check on tcg_enabled(). Since the call only
> exists when CONFIG_TCG is defined, we can slightly simplify.

Nack, that's not how things work.

By wrapping the whole function in an ifdef, the symbol isn't defined without CONFIG_TCG, 
which means the if (0) { } block cannot compile.


r~
diff mbox series

Patch

diff --git a/target/i386/helper.c b/target/i386/helper.c
index 23ccb23a5b..a3e70a630a 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -512,9 +512,9 @@  void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank,
     }
 }
 
+#ifdef CONFIG_TCG
 static inline target_ulong get_memio_eip(CPUX86State *env)
 {
-#ifdef CONFIG_TCG
     uint64_t data[TARGET_INSN_START_WORDS];
     CPUState *cs = env_cpu(env);
 
@@ -528,10 +528,8 @@  static inline target_ulong get_memio_eip(CPUX86State *env)
     } else {
         return data[0] - env->segs[R_CS].base;
     }
-#else
-    qemu_build_not_reached();
-#endif
 }
+#endif
 
 void cpu_report_tpr_access(CPUX86State *env, TPRAccess access)
 {