Skip to content

Commit 06740e6

Browse files
pm215stephanosio
authored andcommitted
target/nios2: 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. nios2 semihosting is not implemented for linux-user builds. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]> (cherry picked from commit cab9f19)
1 parent f0ae989 commit 06740e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

target/nios2/translate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,9 @@ static void gen_break(DisasContext *dc, uint32_t code, uint32_t flags)
649649
{
650650
#ifndef CONFIG_USER_ONLY
651651
/* The semihosting instruction is "break 1". */
652+
bool is_user = dc->base.tb->flags & CR_STATUS_U;
652653
R_TYPE(instr, code);
653-
if (semihosting_enabled() && instr.imm5 == 1) {
654+
if (semihosting_enabled(is_user) && instr.imm5 == 1) {
654655
t_gen_helper_raise_exception(dc, EXCP_SEMIHOST);
655656
return;
656657
}

0 commit comments

Comments
 (0)