From: Keith Packard Date: Tue, 1 Aug 2023 15:22:45 +0000 (-0700) Subject: target/nios2: Pass semihosting arg to exit X-Git-Tag: qemu-xen-4.18.0-rc5~24 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=adef4fe35002e1098570a22d6beb86cd4c431471;p=qemu-xen.git 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 Reviewed-by: Peter Maydell Message-Id: <20230801152245.332749-1-keithp@keithp.com> Signed-off-by: Philippe Mathieu-Daudé (cherry picked from commit c11d5bdae79a8edaf00dfcb2e49c064a50c67671) Signed-off-by: Michael Tokarev --- diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index 3738774976..f3b7aee4f1 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -133,8 +133,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);