Patchwork [11/27,AARCH64] Syscalls for ILP32 are passed always via 64bit values.

login
register
mail settings
Submitter Zhang Jian(Bamvor)
Date June 21, 2016, 11:57 a.m.
Message ID <57692BA5.5050002@huawei.com>
Download mbox | patch
Permalink /patch/13280/
State New
Headers show

Comments

Zhang Jian(Bamvor) - June 21, 2016, 11:57 a.m.
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(-)

Patch

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))