From: Paul Mackerras <paulus@samba.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: klibc@zytor.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: sys_mmap2 on different architectures
Date: Thu, 23 Feb 2006 13:56:38 +1100 [thread overview]
Message-ID: <17405.9318.991684.872546@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <43FCDB8A.5060100@zytor.com>
H. Peter Anvin writes:
> 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.
>
> a. Is this correct, or have I misunderstood the code?
PowerPC always uses 12, even if PAGE_SHIFT is 16 (i.e. for 64k
pages).
> b. If so, is this right, or is this a bug? Right now both klibc and
> µClibc consider the latter a bug.
Glibc seems to expect it to always be 12, according to this excerpt
from sysdeps/unix/sysv/linux/mmap64.c:
/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
# ifndef MMAP2_PAGE_SHIFT
# define MMAP2_PAGE_SHIFT 12
# endif
I would be very reluctant to change the shift to be PAGE_SHIFT, since
that would be a change in the user/kernel ABI. Of course, userspace
is still expected to make sure addresses and offsets are multiples of
the page size (and thus the offset argument to mmap2 has to be a
multiple of 16 if the page size is 64k).
Regards,
Paul.
next prev parent reply other threads:[~2006-02-23 2:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-22 21:45 sys_mmap2 on different architectures H. Peter Anvin
2006-02-22 21:54 ` David S. Miller
2006-02-22 22:00 ` H. Peter Anvin
2006-02-23 0:05 ` H. Peter Anvin
2006-02-23 0:40 ` David S. Miller
2006-02-23 0:41 ` David S. Miller
2006-02-23 0:14 ` Benjamin LaHaise
2006-02-23 0:22 ` H. Peter Anvin
2006-02-23 0:43 ` David S. Miller
2006-02-23 0:59 ` H. Peter Anvin
2006-02-23 1:03 ` David S. Miller
2006-02-23 1:06 ` H. Peter Anvin
2006-02-23 17:39 ` Benjamin LaHaise
2006-02-23 17:47 ` H. Peter Anvin
2006-02-23 2:56 ` Paul Mackerras [this message]
2006-02-23 3:35 ` H. Peter Anvin
2006-02-23 17:32 ` Ralf Baechle
2006-02-23 17:43 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17405.9318.991684.872546@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=hpa@zytor.com \
--cc=klibc@zytor.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).