lkml.org 
[lkml]   [2003]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: System Call parameters
Date

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

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.026 / U:3.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site