diff mbox series

[2/2] target/m68k: Fix bug in semihosted exit handling

Message ID 20190821142151.19995-3-sandra@codesourcery.com (mailing list archive)
State New, archived
Headers show
Series Fix bug in nios2 and m68k semihosting | expand

Commit Message

Sandra Loosemore Aug. 21, 2019, 2:21 p.m. UTC
This patch fixes a bug that caused semihosted exit to always return
status 0; it was incorrectly using the value of D0 (which
contains the HOSTED_EXIT request number) instead of D1.

Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
---
 target/m68k/m68k-semi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Aug. 21, 2019, 2:31 p.m. UTC | #1
On 8/21/19 4:21 PM, Sandra Loosemore wrote:
> This patch fixes a bug that caused semihosted exit to always return
> status 0; it was incorrectly using the value of D0 (which
> contains the HOSTED_EXIT request number) instead of D1.
> 

Fixes: a87295e8df0 and 0e1c9c54afb

> Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.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 8e5fbfc..f189c92 100644
> --- a/target/m68k/m68k-semi.c
> +++ b/target/m68k/m68k-semi.c
> @@ -194,8 +194,8 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
>      args = env->dregs[1];
>      switch (nr) {
>      case HOSTED_EXIT:
> -        gdb_exit(env, env->dregs[0]);
> -        exit(env->dregs[0]);
> +        gdb_exit(env, env->dregs[1]);
> +        exit(env->dregs[1]);
>      case HOSTED_OPEN:
>          GET_ARG(0);
>          GET_ARG(1);
>
Laurent Vivier Aug. 21, 2019, 3:41 p.m. UTC | #2
Le 21/08/2019 à 16:21, Sandra Loosemore a écrit :
> This patch fixes a bug that caused semihosted exit to always return
> status 0; it was incorrectly using the value of D0 (which
> contains the HOSTED_EXIT request number) instead of D1.
> 
> Signed-off-by: Sandra Loosemore <sandra@codesourcery.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 8e5fbfc..f189c92 100644
> --- a/target/m68k/m68k-semi.c
> +++ b/target/m68k/m68k-semi.c
> @@ -194,8 +194,8 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
>      args = env->dregs[1];
>      switch (nr) {
>      case HOSTED_EXIT:
> -        gdb_exit(env, env->dregs[0]);
> -        exit(env->dregs[0]);
> +        gdb_exit(env, env->dregs[1]);
> +        exit(env->dregs[1]);
>      case HOSTED_OPEN:
>          GET_ARG(0);
>          GET_ARG(1);
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

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