diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-08-22 15:12:27 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2022-09-13 17:18:21 +0100 |
commit | b35d74015b0262260b7dbb75c80ea85aeebab89b (patch) | |
tree | 2c0e398193a540d3e4db280caded39f71623d5ab /target/mips/tcg/translate.c | |
parent | a52417e1eeb4501993e29145d16faac59e8465ca (diff) | |
download | qemu-b35d74015b0262260b7dbb75c80ea85aeebab89b.zip qemu-b35d74015b0262260b7dbb75c80ea85aeebab89b.tar.gz qemu-b35d74015b0262260b7dbb75c80ea85aeebab89b.tar.bz2 |
target/mips: Honour -semihosting-config userspace=on
Honour the commandline -semihosting-config userspace=on option,
instead of always permitting userspace semihosting calls in system
emulation mode, by passing the correct value to the is_userspace
argument of semihosting_enabled().
Note that this is a behaviour change: if the user wants to
do semihosting calls from userspace they must now specifically
enable them on the command line.
MIPS semihosting is not implemented for linux-user builds.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220822141230.3658237-5-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/mips/tcg/translate.c')
-rw-r--r-- | target/mips/tcg/translate.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 0d936e2..c3f92ea 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -12082,12 +12082,13 @@ static void gen_cache_operation(DisasContext *ctx, uint32_t op, int base, tcg_temp_free_i32(t0); } -static inline bool is_uhi(int sdbbp_code) +static inline bool is_uhi(DisasContext *ctx, int sdbbp_code) { #ifdef CONFIG_USER_ONLY return false; #else - return semihosting_enabled() && sdbbp_code == 1; + bool is_user = (ctx->hflags & MIPS_HFLAG_KSU) == MIPS_HFLAG_UM; + return semihosting_enabled(is_user) && sdbbp_code == 1; #endif } @@ -13898,7 +13899,7 @@ static void decode_opc_special_r6(CPUMIPSState *env, DisasContext *ctx) } break; case R6_OPC_SDBBP: - if (is_uhi(extract32(ctx->opcode, 6, 20))) { + if (is_uhi(ctx, extract32(ctx->opcode, 6, 20))) { ctx->base.is_jmp = DISAS_SEMIHOST; } else { if (ctx->hflags & MIPS_HFLAG_SBRI) { @@ -14310,7 +14311,7 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx) gen_cl(ctx, op1, rd, rs); break; case OPC_SDBBP: - if (is_uhi(extract32(ctx->opcode, 6, 20))) { + if (is_uhi(ctx, extract32(ctx->opcode, 6, 20))) { ctx->base.is_jmp = DISAS_SEMIHOST; } else { /* |