Re: increase the number of system call parameters

Andi Kleen (ak@muc.de)
22 Oct 2001 14:03:35 +0200


In article <Pine.LNX.4.33.0110221334200.1121-100000@hagbart.nvg.ntnu.no>,
Roar Thronęs <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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/