diff mbox series

[20/37] target/mips: Protect semihosting call with CONFIG_SEMIHOSTING

Message ID 20250313034524.3069690-21-richard.henderson@linaro.org (mailing list archive)
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/mips/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pierrick Bouvier March 13, 2025, 8:51 p.m. UTC | #1
On 3/12/25 20:45, Richard Henderson wrote:
> Semihosting is not enabled for user-only.
> Avoid the test for that case.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/mips/cpu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/mips/cpu.c b/target/mips/cpu.c
> index b207106dd7..1ca182c1a2 100644
> --- a/target/mips/cpu.c
> +++ b/target/mips/cpu.c
> @@ -415,11 +415,12 @@ static void mips_cpu_reset_hold(Object *obj, ResetType type)
>       restore_pamask(env);
>       cs->exception_index = EXCP_NONE;
>   
> +#ifdef CONFIG_SEMIHOSTING
>       if (semihosting_get_argc()) {
>           /* UHI interface can be used to obtain argc and argv */
>           env->active_tc.gpr[4] = -1;
>       }
> -
> +#endif
>   #ifndef CONFIG_USER_ONLY
>       if (kvm_enabled()) {
>           kvm_mips_reset_vcpu(cpu);

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index b207106dd7..1ca182c1a2 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -415,11 +415,12 @@  static void mips_cpu_reset_hold(Object *obj, ResetType type)
     restore_pamask(env);
     cs->exception_index = EXCP_NONE;
 
+#ifdef CONFIG_SEMIHOSTING
     if (semihosting_get_argc()) {
         /* UHI interface can be used to obtain argc and argv */
         env->active_tc.gpr[4] = -1;
     }
-
+#endif
 #ifndef CONFIG_USER_ONLY
     if (kvm_enabled()) {
         kvm_mips_reset_vcpu(cpu);