]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/nios2: Pass semihosting arg to exit
authorKeith Packard <keithp@keithp.com>
Tue, 1 Aug 2023 15:22:45 +0000 (08:22 -0700)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 3 Aug 2023 05:26:26 +0000 (08:26 +0300)
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 c11d5bdae79a8edaf00dfcb2e49c064a50c67671)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/nios2/nios2-semi.c

index f76e8588c5be03191e1762611c05196763e33e84..29ac27035e3cdbdef2a3a621152e5ca8e9ffd741 100644 (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);