target/nios2: Pass semihosting arg to exit

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 c11d5bdae7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Keith Packard 2023-08-01 08:22:45 -07:00 committed by Michael Tokarev
parent 5c6b1b20da
commit 4d92f848f1

View File

@ -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);