[PATCH v4 00/24] ILP32 for ARM64

Arnd Bergmann arnd at arndb.de
Tue May 5 06:11:08 PDT 2015


On Monday 04 May 2015 12:29:52 Arnd Bergmann wrote:
> 
> For 'struct stat', I ended up introducing a new structure on arm32 that
> matches the layout of arm64 (and I did the same for all other 32-bit
> architectures that have a 64-bit counterpart). This means we can share
> the same system calls between arm64-lp64, arm64-ilp32 and arm32 with
> 64-bit time_t and arm64-aarch32 emulation for 32-bit time_t, while
> using the existing compat handling for the original 'struct stat'
> emulation in both arm32 and arm64-aarch32.
> 
> However, for ipc, the situation is different: I found a way to use
> extra padding fields in semid64_ds/shmid64_ds/msqid64_ds, so the
> ipc system calls will still use normal 32-bit data structures
> on arm32 and arm64-aarch64, but you cannot use them arm64-ilp32,
> and will have to #ifdef the three header files there to choose between
> the two implementations.

I realized that this may need some more clarification. What I meant is
that we can extend the current 32-bit version of struct semid64_ds
and the others on arm32, and in the same way extend compat_semid64_ds
on arm64, but you cannot use that on arm64-ilp32 for other reasons.


The solution here is to redefine the normal arm64 semid64_ds so ilp32
see a structure with the same layout as lp64, and then use sys_semctl()
for arm64-ilp32 but use compat_sys_semctl() for aarch32-compat.

The definition would be something like

#ifdef __LP64__
#include <asm-generic/sembuf.h>
#else
struct semid64_ds {
        struct ipc64_perm sem_perm;     /* permissions .. see ipc.h */
        __kernel_time_t sem_otime;      /* last semop time */
        __kernel_time_t sem_ctime;      /* last change time */
        __u64		sem_nsems;      /* no. of semaphores in array */
        __u64 		__unused3;
        __u64		__unused4;
};
#endif

Alternatively, we could use the same definition for both lp64 and ilp32,
which would change the type mangling but not the binary structure.

	Arnd



More information about the linux-arm-kernel mailing list