Skip to content

Commit

Permalink
target/nios2: Pass semihosting arg to exit
Browse files Browse the repository at this point in the history
Instead of using R_ARG0 (the semihost function number), use R_ARG1
(the provided exit status).

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20230801152245.332749-1-keithp@keithp.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit c11d5bd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
keith-packard authored and Michael Tokarev committed Aug 3, 2023
1 parent 5c6b1b2 commit 4d92f84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/nios2/nios2-semi.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ void do_nios2_semihosting(CPUNios2State *env)
args = env->regs[R_ARG1];
switch (nr) {
case HOSTED_EXIT:
gdb_exit(env->regs[R_ARG0]);
exit(env->regs[R_ARG0]);
gdb_exit(env->regs[R_ARG1]);
exit(env->regs[R_ARG1]);

case HOSTED_OPEN:
GET_ARG(0);
Expand Down

0 comments on commit 4d92f84

Please sign in to comment.