Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 15 Mar 2019 03:52:26 +0000
From: "wangjianjian (C)" <wangjianjian3@...wei.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: do we need different definition of  __SYSCALL_LL_E for different
 endian? 

This is arm definition of macro __SYSCALL_LL_E:
#define __SYSCALL_LL_E(x) \
  2 ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
  3 ((union { long long ll; long l[2]; }){ .ll = x }).l[1]

But do we need to deferent definitions for different endian?
>From Linux man page,

For  example,  on the ARM architecture Embedded ABI (EABI), a 64-bit value (e.g., long long) must be aligned to an even register pair.  Thus, using
       syscall() instead of the wrapper provided by glibc, the readahead() system call would be invoked as follows on the ARM architecture with the EABI:

           syscall(SYS_readahead, fd, 0,
                   (unsigned int) (offset >> 32),
                   (unsigned int) (offset & 0xFFFFFFFF),
                   count);
Seems the third argument is the high 32 bit and the fourth argument is the low 32 bit. So do we need below fix?
#ifdef __ARM_BIG_ENDIAN
#define __SYSCALL_LL_E(x) \
  2 ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
  3 ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#else
#define __SYSCALL_LL_E(x) \
  2 ((union { long long ll; long l[2]; }){ .ll = x }).l[1], \
  3 ((union { long long ll; long l[2]; }){ .ll = x }).l[0]
#endif

Thanks.

BR,
Wang Jianjian

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.