[klibc] Re: sys_mmap2 on different architectures

Benjamin LaHaise bcrl at kvack.org
Wed Feb 22 16:14:11 PST 2006

On Wed, Feb 22, 2006 at 01:45:46PM -0800, H. Peter Anvin wrote:
> I've looked through the code for sys_mmap2 on several architectures, and 
> it looks like some architectures plays by the "shift is always 12" rule, 
>  e.g. SPARC, and some expect userspace to actually obtain the page 
> size, e.g. PowerPC and MIPS.  On some architectures, e.g. x86 and ARM, 
> the point is moot since PAGE_SIZE is always 2^12.

The sys_mmap2() ABI is that the page shift is always fixed to whatever 
page size is reasonable for the architecture, typically 2^12.  The syscall 
should never be exposed as mmap2(), only as the large file size version 
of mmap() (aka mmap64()).  The other consideration is that it should not 
be implemented in 64 bit ABIs, as those machines should be using a 64 bit 
native mmap().  Does that clear things up a bit?  Cheers,

"Ladies and gentlemen, I'm sorry to interrupt, but the police are here 
and they've asked us to stop the party."  Don't Email: <dont at kvack.org>.

More information about the klibc mailing list