Hi
(I am sorry if this question has been asked and answered before)
How do you increase the number of system call parameters, and how many
can you at most have?
Would up to 12 parameters be possible, and how?
I have looked at asm-i386/unistd, but it does not seem as intuitive as for
some other processors (and I am still soon going to learn x86...).
Are changes other places needed?
--
-Roar Thron?s
On Mon, Oct 22, 2001 at 01:48:26PM +0200, Roar Thron?s wrote:
> Hi
>
> How do you increase the number of system call parameters, and how many
> can you at most have?
> Would up to 12 parameters be possible, and how?
Why ? Would it not make sense to have 2-3 params, one of them
being a pointer to a structure passing complicated dataset ?
(And first of the structure elements being version number so you
can version the syscall, e.g. add more things/differently structured
things latter -- and remember to supply specific errno which is
telling that particular version is not understood by the kernel.)
For example the kernel does not have mmap64(), but it has mmap2()
which passes the large number of parameters in a structure, and the
libc has a wrapper function implementing mmap64() call API.
At register-rich systems that is not absolutely necessary, but at
register-starved things, like i386, you have no real other way.
> --
> -Roar Thron?s
/Matti Aarnio
In article <[email protected]>,
=?iso-8859-1?Q?Roar_Thron=E6s?= <[email protected]> writes:
> Hi
> (I am sorry if this question has been asked and answered before)
> How do you increase the number of system call parameters, and how many
> can you at most have?
You can have upto 6 argument on i386. Each argument needs an register
to pass and the i386 has only 8 and two are used for the stack pointer
and the syscall number. This leaves you 6.
Other architectures may not have that limitation.
> Would up to 12 parameters be possible, and how?
Yes. Just pass a pointer to an auxillary structure as the first argument
and do a copy_from_user on that structure at the entry point. Put the
arguments in that structure. In user space you can hide the structure in a
stub.
Some system calls (mmap, old_select, socketcall) are in fact implemented
like this because they were designed before the entry point supported
6 arguments.
A note on design: if you have a function call that needs 12 arguments you
probably forgot some[1] (in short it is a strong cue for a broken design,
you should probably split it in smaller calls)
-Andi
[1] unknown author
Andi Kleen <[email protected]> writes:
> A note on design: if you have a function call that needs 12 arguments you
> probably forgot some[1] (in short it is a strong cue for a broken design,
> you should probably split it in smaller calls)
> [1] unknown author
If you have a procedure with 10 parameters, you probably missed some.
-- Alan Perlis, SIGPLAN Notices Vol. 17, No. 9
<URL:http://www-pu.informatik.uni-tuebingen.de/users/klaeren/epigrams.html>
-dan
--
http://ww.telent.net/cliki/ - Link farm for free CL-on-Unix resources