[lkml]   [2016]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [tip:x86/asm] x86/syscalls: Remove __SYSCALL_COMMON and __SYSCALL_X32
On Sat, Jan 30, 2016 at 1:31 AM, Ingo Molnar <> wrote:
> * Andy Lutomirski <> wrote:
>> >>>+ if [ "$abi" == "COMMON" -o "$abi" == "64" ]; then
>> >>>+ # COMMON is the same as 64, except that we don't expect X32
>> >>>+ # programs to use it. Our expectation has nothing to do with
>> >>>+ # any generated code, so treat them the same.
>> >>>+ emit 64 "$nr" "$entry" "$compat"
>> >>>+ elif [ "$abi" == "X32" ]; then
>> >>>+ # X32 is equivalent to 64 on an X32-compatible kernel.
>> >>>+ echo "#ifdef CONFIG_X86_X32_ABI"
>> >>>+ emit 64 "$nr" "$entry" "$compat"
>> >>>+ echo "#endif"
>> >>>+ elif [ "$abi" == "I386" ]; then
>> >>>+ emit "$abi" "$nr" "$entry" "$compat"
>> >>>+ else
>> >>>+ echo "Unknown abi $abi" >&2
>> >>>+ exit 1
>> >>>+ fi
>> No combinatorial explosion, please. We could use __SYSCALL(nr, sym,
>> abi, qual), though.
> Mind fixing it, so that we get back the arch-neutral property?

I need some guidance as to the goal to do a good job.

In the version in -tip, I have this thing:

if [ "$abi" == "64" -a -n "$compat" ]; then
echo "a compat entry for a 64-bit syscall makes no sense" >&2
exit 1

Moving that outside the script will either be impossible or an
exercise in really awful C preprocessor hacks. We could keep that
under the theory that it's arch-neutral.

It might be nice to add a similar warning that a compat entry for an
x32 syscall makes so sense. That's a little less arch-neutral,
although it wouldn't be actively harmful on any architecture, since
"x32" wouldn't occur in the first place.

Other than that, I could add a little header called
syscall_abi_mapping.h containing something like:


#ifdef CONFIG_X86_32

/* Only I386 entries should ever be compiled into 32-bit kernels. */
#define __SYSCALL_ABI_I386(nr, entry, qual, compat, compat_qual)
__SYSCALL_I386(nr, entry, qual)


/* I386 entries on 64-bit kernels use the compat entry point. */
#define __SYSCALL_ABI_I386(nr, entry, qual, compat, compat_qual)
__SYSCALL_I386(nr, compat, compat_qual)

#define __SYSCALL_ABI_common(nr, entry, compat, qual)
#define __SYSCALL_ABI_64(nr, entry, qual, compat, compat_qual)
__SYSCALL_64(nr, entry, qual)
#ifdef CONFIG_X86_X32
#define __SYSCALL_ABI_x32(nr, entry, qual, compat, compat_qual)
__SYSCALL_64(nr, entry, qual)
#define __SYSCALL_ABI_x32(nr, entry, qual, compat, compat_qual)
__SYSCALL_64(nr, entry, qual)



and teach to emit #include <asm/syscall_abi_mapping.h>
at the beginning of syscalls_32.h and syscalls_64.h and to reference
those macros.

hpa, would that meet your requirements?

IMO this is quite a bit messier than the code in -tip, and I'm
honestly not convinced it's an improvement.


 \ /
  Last update: 2016-01-30 19:01    [W:0.075 / U:2.952 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site