Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1427471 > unrolled thread

Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.

Started byAndreas Schwab <schwab@suse.de>
First post2016-06-21 10:50 +0200
Last post2016-06-21 14:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values. Andreas Schwab <schwab@suse.de> - 2016-06-21 10:50 +0200
    Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via  64bit values. "Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com> - 2016-06-21 13:50 +0200
      Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via  64bit values. "Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com> - 2016-06-21 14:00 +0200
      Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values. Andreas Schwab <schwab@suse.de> - 2016-06-21 14:20 +0200

#1427471 — Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.

FromAndreas Schwab <schwab@suse.de>
Date2016-06-21 10:50 +0200
SubjectRe: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
Message-ID<rMpxE-3qk-21@gated-at.bofh.it>
Yury Norov <ynorov@caviumnetworks.com> writes:

> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index 1ffabc2..42f89c8 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -161,11 +161,11 @@
>     call.  */
>  # undef INLINE_SYSCALL
>  # define INLINE_SYSCALL(name, nr, args...)				\
> -  ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
> +  ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
>       if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
>         {								\
>  	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
> -	 _sys_result = (unsigned long) -1;				\
> +	 _sys_result = (unsigned long long) -1;				\
>         }								\
>       (long) _sys_result; })

The cast should be (long long).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

[toc] | [next] | [standalone]


#1427645 — Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.

From"Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com>
Date2016-06-21 13:50 +0200
SubjectRe: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
Message-ID<rMslQ-5hj-13@gated-at.bofh.it>
In reply to#1427471
Hi,

On 2016/6/21 15:56, Andreas Schwab wrote:
> Yury Norov <ynorov@caviumnetworks.com> writes:
>
>> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>> index 1ffabc2..42f89c8 100644
>> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>> @@ -161,11 +161,11 @@
>>      call.  */
>>   # undef INLINE_SYSCALL
>>   # define INLINE_SYSCALL(name, nr, args...)				\
>> -  ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
>> +  ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
>>        if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
>>          {								\
>>   	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
>> -	 _sys_result = (unsigned long) -1;				\
>> +	 _sys_result = (unsigned long long) -1;				\
>>          }								\
>>        (long) _sys_result; })
>
> The cast should be (long long).
My understanding that we need more conversion, reference the follow patch:

 From a0780d286277bf70bacfc0b20fe909a46b990f6e Mon Sep 17 00:00:00 2001
From: gaoyongliang <gaoyongliang@huawei.com>
Date: Thu, 19 May 2016 18:19:05 +0800
Subject: [PATCH] ilp32 fix syscall return value to use long long

Signed-off-by: Yongliang Gao <gaoyongliang@huawei.com>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>

---
  sysdeps/unix/sysdep.h                    | 2 +-
  sysdeps/unix/sysv/linux/aarch64/sysdep.h | 8 ++++----
  2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index 71db7f8..09b6e75 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -31,7 +31,7 @@

  #define SYSCALL_CANCEL(name, ...) \
    ({                                                                         \
-    long int sc_ret;                                                         \
+    long long sc_ret;                                                         \
      if (SINGLE_THREAD_P)                                                     \
        sc_ret = INLINE_SYSCALL (name, __SYSCALL_NARGS(__VA_ARGS__),           \
                                 __VA_ARGS__);                                 \
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index fbf76c1..a696cc2 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -173,7 +173,7 @@
        {									      \
        iserr:								      \
          __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
-        sc_ret = -1L;							      \
+        sc_ret = -1LL;							      \
        }									      \
    out:									      \
      sc_ret;								      \
@@ -216,7 +216,7 @@
  		  : "=r" (_x0)					\
  		  : "r" (funcptr) ASM_ARGS_##nr			\
  		  : "x30", "memory");				\
-    (long) _x0;							\
+    (long long) _x0;							\
    })


@@ -230,7 +230,7 @@
  	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
  	 _sys_result = (unsigned long long) -1;				\
         }								\
-     (long) _sys_result; })
+     (long long) _sys_result; })

  # undef INTERNAL_SYSCALL_DECL
  # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
@@ -257,7 +257,7 @@

  # undef INTERNAL_SYSCALL_ERROR_P
  # define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  ((unsigned long) (val) >= (unsigned long) -4095)
+  ((unsigned long long) (val) >= (unsigned long long) -4095)

  # undef INTERNAL_SYSCALL_ERRNO
  # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-- 
1.8.4.5


> Andreas.
>

[toc] | [prev] | [next] | [standalone]


#1427676 — Re: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.

From"Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com>
Date2016-06-21 14:00 +0200
SubjectRe: [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
Message-ID<rMsvw-5kN-25@gated-at.bofh.it>
In reply to#1427645
Hi,

On 2016/6/21 19:42, Zhangjian (Bamvor) wrote:
> Hi,
>
> On 2016/6/21 15:56, Andreas Schwab wrote:
>> Yury Norov <ynorov@caviumnetworks.com> writes:
>>
>>> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> index 1ffabc2..42f89c8 100644
>>> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> @@ -161,11 +161,11 @@
>>>      call.  */
>>>   # undef INLINE_SYSCALL
>>>   # define INLINE_SYSCALL(name, nr, args...)                \
>>> -  ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);    \
>>> +  ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args);    \
>>>        if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
>>>          {                                \
>>>        __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));        \
>>> -     _sys_result = (unsigned long) -1;                \
>>> +     _sys_result = (unsigned long long) -1;                \
>>>          }                                \
>>>        (long) _sys_result; })
>>
>> The cast should be (long long).
> My understanding that we need more conversion, reference the follow patch:
Sorry, I used the wrong version of patch, here is the version could apply on yury'.
For vdso part, maybe we should fix in this patch instead of "[PATCH 19/27]
[AARCH64] Add typesizes.h for ILP32".

 From 8c5f27c19407ba3ba8c400f0645cb51f91a5b379 Mon Sep 17 00:00:00 2001
From: gaoyongliang <gaoyongliang@huawei.com>
Date: Thu, 19 May 2016 18:19:05 +0800
Subject: [PATCH] ilp32 fix syscall return value to use long long

Signed-off-by: Yongliang Gao <gaoyongliang@huawei.com>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
---
  sysdeps/unix/sysdep.h                    | 2 +-
  sysdeps/unix/sysv/linux/aarch64/sysdep.h | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index 94a2ce0..a12456b 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -53,7 +53,7 @@

  #define SYSCALL_CANCEL(...) \
    ({									     \
-    long int sc_ret;							     \
+    long long sc_ret;							     \
      if (SINGLE_THREAD_P) 						     \
        sc_ret = __SYSCALL_CALL (__VA_ARGS__);   				     \
      else								     \
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 42f89c8..82de012 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -167,7 +167,7 @@
  	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
  	 _sys_result = (unsigned long long) -1;				\
         }								\
-     (long) _sys_result; })
+     (long long) _sys_result; })

  # undef INTERNAL_SYSCALL_DECL
  # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
@@ -194,7 +194,7 @@

  # undef INTERNAL_SYSCALL_ERROR_P
  # define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  ((unsigned long) (val) >= (unsigned long) -4095)
+  ((unsigned long long) (val) >= (unsigned long long) -4095)

  # undef INTERNAL_SYSCALL_ERRNO
  # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-- 
1.8.4.5


>  From a0780d286277bf70bacfc0b20fe909a46b990f6e Mon Sep 17 00:00:00 2001
> From: gaoyongliang <gaoyongliang@huawei.com>
> Date: Thu, 19 May 2016 18:19:05 +0800
> Subject: [PATCH] ilp32 fix syscall return value to use long long
>
> Signed-off-by: Yongliang Gao <gaoyongliang@huawei.com>
> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
>
> ---
>   sysdeps/unix/sysdep.h                    | 2 +-
>   sysdeps/unix/sysv/linux/aarch64/sysdep.h | 8 ++++----
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
> index 71db7f8..09b6e75 100644
> --- a/sysdeps/unix/sysdep.h
> +++ b/sysdeps/unix/sysdep.h
> @@ -31,7 +31,7 @@
>
>   #define SYSCALL_CANCEL(name, ...) \
>     ({                                                                         \
> -    long int sc_ret;                                                         \
> +    long long sc_ret;                                                         \
>       if (SINGLE_THREAD_P)                                                     \
>         sc_ret = INLINE_SYSCALL (name, __SYSCALL_NARGS(__VA_ARGS__),           \
>                                  __VA_ARGS__);                                 \
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index fbf76c1..a696cc2 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -173,7 +173,7 @@
>         {                                          \
>         iserr:                                      \
>           __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));              \
> -        sc_ret = -1L;                                  \
> +        sc_ret = -1LL;                                  \
>         }                                          \
>     out:                                          \
>       sc_ret;                                      \
> @@ -216,7 +216,7 @@
>             : "=r" (_x0)                    \
>             : "r" (funcptr) ASM_ARGS_##nr            \
>             : "x30", "memory");                \
> -    (long) _x0;                            \
> +    (long long) _x0;                            \
>     })
>
>
> @@ -230,7 +230,7 @@
>        __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));        \
>        _sys_result = (unsigned long long) -1;                \
>          }                                \
> -     (long) _sys_result; })
> +     (long long) _sys_result; })
>
>   # undef INTERNAL_SYSCALL_DECL
>   # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
> @@ -257,7 +257,7 @@
>
>   # undef INTERNAL_SYSCALL_ERROR_P
>   # define INTERNAL_SYSCALL_ERROR_P(val, err) \
> -  ((unsigned long) (val) >= (unsigned long) -4095)
> +  ((unsigned long long) (val) >= (unsigned long long) -4095)
>
>   # undef INTERNAL_SYSCALL_ERRNO
>   # define INTERNAL_SYSCALL_ERRNO(val, err)    (-(val))

[toc] | [prev] | [next] | [standalone]


#1427688

FromAndreas Schwab <schwab@suse.de>
Date2016-06-21 14:20 +0200
Message-ID<rMsOR-5ID-3@gated-at.bofh.it>
In reply to#1427645
"Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com> writes:

> Hi,
>
> On 2016/6/21 15:56, Andreas Schwab wrote:
>> Yury Norov <ynorov@caviumnetworks.com> writes:
>>
>>> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> index 1ffabc2..42f89c8 100644
>>> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
>>> @@ -161,11 +161,11 @@
>>>      call.  */
>>>   # undef INLINE_SYSCALL
>>>   # define INLINE_SYSCALL(name, nr, args...)				\
>>> -  ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
>>> +  ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
>>>        if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
>>>          {								\
>>>   	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
>>> -	 _sys_result = (unsigned long) -1;				\
>>> +	 _sys_result = (unsigned long long) -1;				\
>>>          }								\
>>>        (long) _sys_result; })
>>
>> The cast should be (long long).
> My understanding that we need more conversion, reference the follow patch:

And this:

diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.c b/sysdeps/unix/sysv/linux/aarch64/sysdep.c
index f2d5480..1bec443 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.c
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.c
@@ -19,13 +19,13 @@
 #include <sysdep.h>
 #include <errno.h>
 
-long __syscall_error (long err);
+long long __syscall_error (long long err);
 hidden_proto (__syscall_error)
 
 /* This routine is jumped to by all the syscall handlers, to stash
    an error number into errno.  */
-long
-__syscall_error (long err)
+long long
+__syscall_error (long long err)
 {
   __set_errno (- err);
   return -1;

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web