I think there is no need to special case some archs, just get the thing during runtime on all archs. Index: include/sys/mman.h ==================================================================--- include/sys/mman.h (revision 1010) +++ include/sys/mman.h (working copy) @@ -8,7 +8,6 @@ #include <klibc/extern.h> #include <sys/types.h> #include <asm/mman.h> -#include <asm/page.h> /* For PAGE_SIZE */ #define MAP_FAILED ((void *)-1) Index: klibc/mmap.c ==================================================================--- klibc/mmap.c (revision 1010) +++ klibc/mmap.c (working copy) @@ -7,15 +7,8 @@ #include <sys/syscall.h> #include <sys/mman.h> #include <unistd.h> -#include <asm/page.h> /* For PAGE_SHIFT */ -#if defined(__sparc__) -# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ -#elif defined(__mips__) || defined(__powerpc__) # define MMAP2_SHIFT __getpageshift() /* Variable */ -#else -# define MMAP2_SHIFT PAGE_SHIFT -#endif /* * Set in SYSCALLS whether or not we should use an unadorned mmap() system
On Mon, Feb 14, Olaf Hering wrote:> > I think there is no need to special case some archs, just get the thing > during runtime on all archs.Another user of asm/page.h is linux/resource.h, #define MLOCK_LIMIT (8 * PAGE_SIZE) I think klibc should use its own defines in include/sys/resource.h and provide a include/arch/*/klibc/archresource.h with defines for a few archs which define __ARCH_RLIMIT_ORDER. What do you think?
Olaf Hering wrote:> I think there is no need to special case some archs, just get the thing > during runtime on all archs.The problem is that MMAP2_SHIFT != __getpageshift() on sparc32, that is at least my understanding. -hpa> ==================================================================> --- klibc/mmap.c (revision 1010) > +++ klibc/mmap.c (working copy) > @@ -7,15 +7,8 @@ > #include <sys/syscall.h> > #include <sys/mman.h> > #include <unistd.h> > -#include <asm/page.h> /* For PAGE_SHIFT */ > > -#if defined(__sparc__) > -# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ > -#elif defined(__mips__) || defined(__powerpc__) > # define MMAP2_SHIFT __getpageshift() /* Variable */ > -#else > -# define MMAP2_SHIFT PAGE_SHIFT > -#endif >
On Mon, Feb 21, H. Peter Anvin wrote:> Olaf Hering wrote: > >I think there is no need to special case some archs, just get the thing > >during runtime on all archs. > > The problem is that MMAP2_SHIFT != __getpageshift() on sparc32, that is > at least my understanding.uclibc and glibc have this comment, and they force the size to 12: This is always 12, even on architectures where PAGE_SHIFT != 12