* increase the number of system call parameters
@ 2001-10-22 11:48 Roar Thronæs
2001-10-22 11:57 ` Matti Aarnio
2001-10-22 12:03 ` Andi Kleen
0 siblings, 2 replies; 4+ messages in thread
From: Roar Thronæs @ 2001-10-22 11:48 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: increase the number of system call parameters
2001-10-22 11:48 increase the number of system call parameters Roar Thronæs
@ 2001-10-22 11:57 ` Matti Aarnio
2001-10-22 12:03 ` Andi Kleen
1 sibling, 0 replies; 4+ messages in thread
From: Matti Aarnio @ 2001-10-22 11:57 UTC (permalink / raw)
To: Roar Thronæs; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: increase the number of system call parameters
2001-10-22 11:48 increase the number of system call parameters Roar Thronæs
2001-10-22 11:57 ` Matti Aarnio
@ 2001-10-22 12:03 ` Andi Kleen
2001-10-22 21:37 ` Daniel Barlow
1 sibling, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2001-10-22 12:03 UTC (permalink / raw)
To: Roar Thronæs; +Cc: linux-kernel
In article <Pine.LNX.4.33.0110221334200.1121-100000@hagbart.nvg.ntnu.no>,
=?iso-8859-1?Q?Roar_Thron=E6s?= <roart@nvg.ntnu.no> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: increase the number of system call parameters
2001-10-22 12:03 ` Andi Kleen
@ 2001-10-22 21:37 ` Daniel Barlow
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Barlow @ 2001-10-22 21:37 UTC (permalink / raw)
To: linux-kernel
Andi Kleen <ak@muc.de> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-10-22 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-22 11:48 increase the number of system call parameters Roar Thronæs
2001-10-22 11:57 ` Matti Aarnio
2001-10-22 12:03 ` Andi Kleen
2001-10-22 21:37 ` Daniel Barlow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox