2004-11-17 23:17:10

by Sharma Sushant

[permalink] [raw]
Subject: max agruments in system_calls

Hi All
Can some one tell me, if I want to implement a system call with more than
6 arguments in it, how should I do it? I am using kernel 2.6.3.
I know I can use struct and stuff arguments inside it, but I want to
use more than 6 different arguments.

Thanks
-Sushant

ps: please cc the reply to me

Sushant Sharma Computer Science @ UNM
http://cs.unm.edu/~sushant


2004-11-17 23:57:42

by linux-os

[permalink] [raw]
Subject: Re: max agruments in system_calls

On Wed, 17 Nov 2004, Sharma Sushant wrote:

> Hi All
> Can some one tell me, if I want to implement a system call with more than 6
> arguments in it, how should I do it? I am using kernel 2.6.3.
> I know I can use struct and stuff arguments inside it, but I want to use more
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__________ yes
> than 6 different arguments.

Huh? You KNOW that you don't have more than 7 registers available
on ix86 so you KNOW that you either need a pointer to a struct (one
parameter) or it won't work.

FYI:
eax = function code
ebx = first parameter
ecx = second parameter
edx = third parameter
esi = fourth parameter
edi = fifth parameter
ebp = sixth parameter

You need esp for the call and you need eip for the code. There
are no other registers except segment registers.

>
> Thanks
> -Sushant



Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.

2004-11-18 10:48:11

by Jan Engelhardt

[permalink] [raw]
Subject: Re: max agruments in system_calls

>Huh? You KNOW that you don't have more than 7 registers available
>on ix86 so you KNOW that you either need a pointer to a struct (one
>parameter) or it won't work.
>
>FYI:
> eax = function code
> ebx = first parameter
> ecx = second parameter
> edx = third parameter
> esi = fourth parameter
> edi = fifth parameter
> ebp = sixth parameter

And if you use varargs?



Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, http://www.gwdg.de

2004-11-18 12:18:51

by linux-os

[permalink] [raw]
Subject: Re: max agruments in system_calls

On Thu, 18 Nov 2004, Jan Engelhardt wrote:

>> Huh? You KNOW that you don't have more than 7 registers available
>> on ix86 so you KNOW that you either need a pointer to a struct (one
>> parameter) or it won't work.
>>
>> FYI:
>> eax = function code
>> ebx = first parameter
>> ecx = second parameter
>> edx = third parameter
>> esi = fourth parameter
>> edi = fifth parameter
>> ebp = sixth parameter
>
> And if you use varargs?
>
>
>
Not relevant. You can't pass your arguments on the stack with
any efficiency (you become Windows) because the user-stack is
just data in the kernel. One would have to copy from the user
stack which is about as inefficient as possible.

> Jan Engelhardt
> --
> Gesellschaft f??r Wissenschaftliche Datenverarbeitung
> Am Fassberg, 37077 G??ttingen, http://www.gwdg.de
>

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.