linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* System Call parameters
@ 2003-04-16 16:58 Richard B. Johnson
  2003-04-16 17:41 ` Bruce Harada
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Richard B. Johnson @ 2003-04-16 16:58 UTC (permalink / raw)
  To: Linux kernel


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


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.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: System Call parameters
@ 2003-04-17  0:39 Perez-Gonzalez, Inaky
  0 siblings, 0 replies; 6+ messages in thread
From: Perez-Gonzalez, Inaky @ 2003-04-17  0:39 UTC (permalink / raw)
  To: 'root@chaos.analogic.com',
	'lkml (linux-kernel@vger.kernel.org)'


> From: Richard B. Johnson [mailto:root@chaos.analogic.com]
>
> 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.

I use %ebp, it seemed to work last time I played with it:

static inline
int st_mmap (void *addr, size_t len, int protection, int flags, int fd,
off_t offset)
{
  int result;
  asm volatile (
    "pushl %%ebp	\n"
    "movl  %6, %%ebp	\n"
    "movl  %7, %%eax	\n"
    "int   $0x80	\n"
    "popl  %%ebp	\n"
    : "=a" (result)
    : "b" (addr), "c" (len), "d" (protection),
      "S" (flags), "D" (fd), "m" ((offset >> PAGE_SHIFT)),
      "i" (__NR_mmap2)
    : "memory");
  return result;
}

I thing I got it from an straight disassemble dump of glibc's
mmap().

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-04-17  0:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-16 16:58 System Call parameters Richard B. Johnson
2003-04-16 17:41 ` Bruce Harada
2003-04-16 17:58   ` Richard B. Johnson
2003-04-16 17:47 ` Bruce Harada
2003-04-16 20:35 ` H. Peter Anvin
2003-04-17  0:39 Perez-Gonzalez, Inaky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).