target/riscv: Honour -semihosting-config userspace=on and enable=on
commit7d7fb11615809839ff858328134c6a0abad27ea4
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 22 Aug 2022 14:12:30 +0000 (22 15:12 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 13 Sep 2022 16:18:21 +0000 (13 17:18 +0100)
treeccf4d72fe3c93f6cb8fe012a1063c6eb451efa96
parent870ab98bee4312caf0ced42999e295f741aba853
target/riscv: Honour -semihosting-config userspace=on and enable=on

The riscv target incorrectly enabled semihosting always, whether the
user asked for it or not.  Call semihosting_enabled() passing the
correct value to the is_userspace argument, which fixes this and also
handles the userspace=on argument.  Because we do this at translate
time, we no longer need to check the privilege level in
riscv_cpu_do_interrupt().

Note that this is a behaviour change: we used to default to
semihosting being enabled, and now the user must pass
"-semihosting-config enable=on" if they want it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20220822141230.3658237-8-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/riscv/cpu_helper.c
target/riscv/insn_trans/trans_privileged.c.inc
target/riscv/translate.c