[uClibc]mmap() syscall

Michael Shmulevich michaels at jungo.com
Thu May 3 09:45:04 UTC 2001


Hi all,

While working on MIPS port I have met a weird "feature" of mmap() 
realization in uClibc: parameters are stored in an array of int[6], and
then only the address of the array is passed as a single parameter to a 
syscall.

I suppose author thought that parameters to a syscall are transferred 
via stack, in which case kernel will indeed find the rest of parameters 
later on in a stack (since an array is a local variable).

This is totally broken on MIPS: there parameters are NOT passed via 
stack always, but partly via registers and partly via stack. Obviously 
the implementation is not correct. I simply replaced the whole story 
with _syscall6() macro and it worked perfectly instead.

On second thought I don't see why we need to do this "conervion" on any 
other platform at all... we don't save nothing, since we have all the 
parameters on stack already, so why we need to reorder them?

Sincerely yours,
Michael Shmulevich
______________________________________
Software Developer
Jungo - R&D
email: michaels at jungo.com
web: http://www.jungo.com
Phone: 1-877-514-0537(USA)  +972-9-8859365(Worldwide) ext. 233
Fax:   1-877-514-0538(USA)  +972-9-8859366(Worldwide)






More information about the uClibc mailing list