Subject: Re: UPAGES on sparc? [was: pkg/8728: lavaps broken on sparc (fwd)]
To: Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-kern
Date: 11/02/1999 10:36:04
[ two msgs in one. ]
Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de> writes:
> On 2 Nov 1999, Chris G. Demetriou wrote:
> > That identity should tell you all you need to know to fix the code.
> > (UPAGES = USPACE / NBPG, but note that the latter's not a constant on
> > the sparc and you've therefore gotta get it from the kernel. 8-)
>
> IC, thanks... just to make sure: is what pagesize(1) and "sysctl
> hw.pagesize" return the same as NBPG?
on ports which define page size, I believe it is, yes. not all ports
can define page size because it's not a constant on some ports.
> The only nit is that NBPG is #defined as "nbpg" on sparc (in
> <machine/param.h), and "nbpg" is only visible to the kernel - bummer. I'm
> using sysconf(_SC_PAGESIZE) instead now, but maybe <machine/param.h>
> should be changed WRT NBPG.
machine/param.h shouldn't be changed. On the sparc, the page size is
_not_ a constant. If you wanted to make NBPG be anything for userland
on sparc, the only thing you could sanely make it is a wrapper around
sysconf/getpagesize, and that's wasteful. (people expect a constant
and the optimizations that go with it instead it generates a function
call! also, there are the issues around it being used in CPP
expressions, global array sizing, etc.)
cgd
--
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.