[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] target/nios2: Fix bug in semihosted exit ha
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] target/nios2: Fix bug in semihosted exit handling |
Date: |
Wed, 21 Aug 2019 16:41:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
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 register R_ARG0 (which
> contains the HOSTED_EXIT request number) instead of register R_ARG1.
>
> Signed-off-by: Sandra Loosemore <address@hidden>
> ---
> target/nios2/nios2-semi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
> index d7a80dd..06c0861 100644
> --- a/target/nios2/nios2-semi.c
> +++ b/target/nios2/nios2-semi.c
> @@ -215,8 +215,8 @@ void do_nios2_semihosting(CPUNios2State *env)
> args = env->regs[R_ARG1];
> switch (nr) {
> case HOSTED_EXIT:
> - gdb_exit(env, env->regs[R_ARG0]);
> - exit(env->regs[R_ARG0]);
> + gdb_exit(env, env->regs[R_ARG1]);
> + exit(env->regs[R_ARG1]);
It's weird: in line 215, env->regs[R_ARG1] is args.
Are you sure it's not something like:
GET_ARG(0)
gdb_exit(env, arg0);
exit(arg0);
same for m68k.
Did you check the kernel code?
Thanks,
Laurent