NASM Forum > Other Discussion

mmap linux syscall

(1/1)

cheery:
I wonder how can I call mmap system call. I found only the old_mmap from system call tables.

Where's the sys_mmap2?

Keith Kanios:
http://www.lxhp.in-berlin.de/lhpsysc4.html#mmap2

Frank Kotler:
Yeah, or just "man 2 mmap2".... Looks to be pretty near the same thing...

Best,
Frank

Frank Kotler:

--- Quote from: Frank Kotler on September 19, 2010, 12:09:29 AM ---Looks to be pretty near the same thing...

--- End quote ---

Mmmm... that's only semi-true... It is fairly typical that "old" sys_calls which take six parameters put 'em in a structure, with the address of the structure in ebx. The "new" versions use ebp, and put all parameters in registers. That's the case here - besides the fact that the last parameter, "offset", is in bytes for mmap, and "pgoffset", in pages for mmap2. (I mostly want zero, in either case...)

Best,
Frank

cheery:
Yuck. Usage of ebp as a sixth register seems a bit nasty to me.

x86_64 doesn't seem to have mmap2 which is quite weird too. Maybe I'll end up using the 'old' mmap. It's not getting away anytime soon I guess. :)

Navigation

[0] Message Index

Go to full version