RE: System Call parameters

From: Perez-Gonzalez, Inaky (
Date: Wed Apr 16 2003 - 19:39:36 EST

> From: Richard B. Johnson []
> 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

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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