qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 33/34] linux-user: Support for restarting system


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 33/34] linux-user: Support for restarting system calls for CRIS targets
Date: Thu, 10 Sep 2015 20:12:21 +0100

On 6 September 2015 at 00:57, Timothy E Baldwin
<address@hidden> wrote:
> Signed-off-by: Timothy Edward Baldwin <address@hidden>
> ---
>
> WARNING - NOT TESTED
>
>  linux-user/cris/syscall.h | 2 ++
>  linux-user/main.c         | 6 +++++-
>  linux-user/signal.c       | 2 +-
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/cris/syscall.h b/linux-user/cris/syscall.h
> index 2957b0d..29218e2 100644
> --- a/linux-user/cris/syscall.h
> +++ b/linux-user/cris/syscall.h
> @@ -44,3 +44,5 @@ struct target_pt_regs {
>  #define TARGET_MLOCKALL_MCL_FUTURE  2
>
>  #endif
> +
> +#define TARGET_USE_ERESTARTSYS 1
> diff --git a/linux-user/main.c b/linux-user/main.c
> index a59907e..a9eb15c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -2878,7 +2878,11 @@ void cpu_loop(CPUCRISState *env)
>                               env->pregs[7],
>                               env->pregs[11],
>                               0, 0);
> -            env->regs[10] = ret;
> +            if (ret == -TARGET_ERESTARTSYS) {
> +                env->pc -= 2;
> +            } else if (ret != -TARGET_QEMU_ESIGRETURN) {
> +                env->regs[10] = ret;
> +            }
>              break;
>          case EXCP_DEBUG:
>              {
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index e17514e..3741517 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -3761,7 +3761,7 @@ long do_sigreturn(CPUCRISState *env)
>
>      restore_sigcontext(&frame->sc, env);
>      unlock_user_struct(frame, frame_addr, 0);
> -    return env->regs[10];
> +    return -TARGET_QEMU_ESIGRETURN;
>  badframe:
>      force_sig(TARGET_SIGSEGV);
>  }

Looks OK, but this one I'm not sure enough about the CRIS instruction
set and the surrounding code doesn't clarify. Edgar -- is the CRIS
instruction for "take linux system call" always exactly 2 bytes long?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]