Re: System Call parameters

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Apr 16 2003 - 12:58:41 EST


On Thu, 17 Apr 2003, Bruce Harada wrote:

> On Wed, 16 Apr 2003 12:58:15 -0400 (EDT)
> "Richard B. Johnson" <root@chaos.analogic.com> wrote:
>
> >
> > How does the kernel get more than five parameters?
> >
> > Currently...
> > eax = function code
> > ebx = first parameter
> > ecx = second parameter
> > edx = third parameter
> > esi = fourth parameter
> > edi = fifth parameter
> >
> > Some functions like mmap() take 6 parameters!
> > Does anybody know how these parameters get passed?
> > I have an "ultra-light" 'C' runtime library I have
> > been working on and, so-far, I've got everything up
> > to mmap() (in syscall.h) (89 functions) working.
> > I thought, maybe ebp was being used, but it doesn't
> > seem to be the case.
> >
> > Maybe after 5 functions, there is a parameter list
> > passed by pointer???? I don't have a clue and I
> > can figure out the code, it's really obscure...
>
> >From http://www.google.co.jp/search?q=cache:7GJP4whNQEkC:webster.cs.ucr.edu/Page_Linux/LinuxSysCalls.pdf+Linux+mmap+parameters+ebp&hl=ja&ie=UTF-8 :
>
> Certain Linux 2.4 calls pass a sixth parameter in EBP. Calls compatible with earlier versions of the kernel pass six or
> more parameters in a parameter block and pass the address of the parameter block in EBX (this change was probably
> made in kernel 2.4 because someone noticed that an extra copy between kernel and user space was slowing down
> those functions with exactly six parameters; who knows the real reason, though).
>
> Relevant? No idea.
>

Yes. Absolutely relevant. FYI, I experimentaly I found out that
the 6th parameter is passed in EBP if I use __NR_mmap2 as the
function call instead of __NR_mmap. Thanks -- and I now have that
working...

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
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/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:19 EST