Subject: NBPG
To: None <tech-kern@NetBSD.ORG, port-sparc@NetBSD.ORG>
From: msaitoh <msaitoh@spa.is.uec.ac.jp>
List: tech-kern
Date: 07/23/1998 15:57:22
[I mailed to both tech-kern and port-sparc.]
Some userland programs uses NBPG.
I found a problem in sparc/include/params.h:
> #if defined(SUN4M) && defined(SUN4C) && defined(SUN4)
> # define CPU_ISSUN4M (cputyp == CPU_SUN4M)
> # define CPU_ISSUN4C (cputyp == CPU_SUN4C)
> # define CPU_ISSUN4 (cputyp == CPU_SUN4)
> # define CPU_ISSUN4OR4C (cputyp == CPU_SUN4 || cputyp == CPU_SUN4C)
> # define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M)
> # define NBPG nbpg
> # define PGOFSET pgofset
> # define PGSHIFT pgshift
"nbpg" is a global variable in kernel!
I found this problem while using shm* function because
/usr/include/sys/shm.h says:
> #define SHMLBA CLBYTES /* Segment low boundry address multiple XXX */
and
> #define CLBYTES (CLSIZE*NBPG)
This is not enclosed #ifdef _KERNEL
Perhaps we should be replace by this:
#ifdef _KERNEL
#define CLBYTES (CLSIZE*NBPG)
#else
#define CLBYTES (CLSIZE * sysconf(_SC_PAGESIZE))
#endif
Perhaps many .h file is referring NBPG directly.
----------------------------------------------------------
SAITOH Masanobu (msaitoh@spa.is.uec.ac.jp,
msaitoh@netbsd.org)
University of Electro-Communications