Skip to content

Commit

Permalink
target/nios2: Honour -semihosting-config userspace=on
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
pm215 authored and awojasinski committed Oct 16, 2024
1 parent 157cd1b commit b2a5fad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion target/nios2/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,9 @@ static void gen_break(DisasContext *dc, uint32_t code, uint32_t flags)
{
#ifndef CONFIG_USER_ONLY
/* The semihosting instruction is "break 1". */
bool is_user = dc->base.tb->flags & CR_STATUS_U;
R_TYPE(instr, code);
if (semihosting_enabled() && instr.imm5 == 1) {
if (semihosting_enabled(is_user) && instr.imm5 == 1) {
t_gen_helper_raise_exception(dc, EXCP_SEMIHOST);
return;
}
Expand Down

0 comments on commit b2a5fad

Please sign in to comment.