Re: [PATCH] compat: add compat functions for *at syscalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Stephen Rothwell <[email protected]>
Date: Tue, 7 Feb 2006 11:27:13 +1100

> *If* we do get is_compat_task(), what would be you reaction to something
> like this:
...
> +	if (is_compat_task())
> +		dfd = compat_sign_extend(dfd);

A load and a test is more expensive than the assembler
stubs where we _know_ we are compat.

The alternative suggestions get less and less efficient :-) My whole
desire is to optimize this as much as possible, without the overhead
of an extra stack frame or "is_compat_task()" kinds of runtime tests.

Really, the way to do this is to have a description header file, that
does stuff like:

SIGN1(STUB_NAME, REAL_SYSCALL, ARG1_TO_EXTEND)
SIGN2(STUB_NAME, REAL_SYSCALL, ARG1_TO_EXTEND, ARG2_TO_EXTEND)

etc. etc. for each syscall that only needs sign extension compat
handling, and the platform provides definitions of these macros which
expand the above as appropriate.  Use arch/sparc64/kernel/sys32.S as a
guide.

So for sys_exit_group you'd list something like:

SIGN1(sys32_exit_group, sys_exit_group, ARG0)

"ARG0" would get defined to whatever register mnemonic the
first argument to a function gets passed into, ARG1 to the
second, etc.  So on Sparc64 that would be:

#define ARG0	%o0
#define ARG1	%o1
#define ARG2	%o2
#define ARG3	%o3
#define ARG4	%o4
#define ARG5	%o5

and you'd use "sys32_exit_group" in the compat syscall table.  The
SIGN1 definition on sparc64 would be exactly what it is right now
in that sys32.S file.

Such a header can be use to generate stubs on every platform.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux