diff mbox series

[1/3] target/m68k: Pass semihosting arg to exit

Message ID 20230802161914.395443-2-keithp@keithp.com (mailing list archive)
State New, archived
Headers show
Series target/m68k: Fix a few semihosting bugs | expand

Commit Message

Keith Packard Aug. 2, 2023, 4:19 p.m. UTC
Instead of using d0 (the semihost function number), use d1 (the
provide exit status).

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 target/m68k/m68k-semi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell Aug. 3, 2023, 10:07 a.m. UTC | #1
On Wed, 2 Aug 2023 at 17:20, Keith Packard via <qemu-devel@nongnu.org> wrote:
>
> Instead of using d0 (the semihost function number), use d1 (the
> provide exit status).
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  target/m68k/m68k-semi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c
> index 88ad9ba814..12235759c7 100644
> --- a/target/m68k/m68k-semi.c
> +++ b/target/m68k/m68k-semi.c
> @@ -130,8 +130,8 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
>      args = env->dregs[1];
>      switch (nr) {
>      case HOSTED_EXIT:
> -        gdb_exit(env->dregs[0]);
> -        exit(env->dregs[0]);
> +        gdb_exit(env->dregs[1]);
> +        exit(env->dregs[1]);

I looked at this code but didn't spot the bug, because I
got confused by the 'args = env->dregs[1]' line above somehow.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox series

Patch

diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c
index 88ad9ba814..12235759c7 100644
--- a/target/m68k/m68k-semi.c
+++ b/target/m68k/m68k-semi.c
@@ -130,8 +130,8 @@  void do_m68k_semihosting(CPUM68KState *env, int nr)
     args = env->dregs[1];
     switch (nr) {
     case HOSTED_EXIT:
-        gdb_exit(env->dregs[0]);
-        exit(env->dregs[0]);
+        gdb_exit(env->dregs[1]);
+        exit(env->dregs[1]);
 
     case HOSTED_OPEN:
         GET_ARG(0);