qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 04/12] linux-user: Make ipc syscall's third argu


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 04/12] linux-user: Make ipc syscall's third argument an abi_long
Date: Mon, 4 Aug 2014 18:09:00 +0100

On 4 August 2014 17:45, Tom Musta <address@hidden> wrote:
> For those target ABIs that use the ipc system call (e.g. POWER),
> the third argument is used in the shmat path as a pointer.  It
> therefore must be declared as an abi_long (versus int) so that
> the address bits are not lost in truncation.  The "int-ness" of
> this argument is retained for all other system calls via an
> explicit cast.
>
> Signed-off-by: Tom Musta <address@hidden>
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index fb03e96..bf6dd1e 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -3122,7 +3122,7 @@ static inline abi_long do_shmdt(abi_ulong shmaddr)
>  /* ??? This only works with linear mappings.  */
>  /* do_ipc() must return target values and target errnos. */
>  static abi_long do_ipc(unsigned int call, int first,
> -                       int second, int third,
> +                       int second, abi_long third,
>                         abi_long ptr, abi_long fifth)

Given where and how this is called, I would suggest
that all its arguments (except 'call') hould be abi_long,
because it's just out-of-line handling of one particular case
from do_syscall(), and the arguments there are all abi_long.

>  {
>      int version;
> @@ -3137,7 +3137,7 @@ static abi_long do_ipc(unsigned int call, int first,
>          break;
>
>      case IPCOP_semget:
> -        ret = get_errno(semget(first, second, third));
> +        ret = get_errno(semget(first, second, (int)third));
>          break;

This cast isn't needed because semget()'s third argument is
int type anyway. I suspect most or perhaps even all the other
casts below are also unneeded.

thanks
-- PMM



reply via email to

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