thorpej@ wrote: > > PGSHIFT is defined in <machine/param.h> and > > PAGE_SHIFT and PAGE_SIZE is in <machine/vmparam.h>, > > but there is no common <m68k/vmparam.h>. > > Make a common <m68k/vmparam.h> that all of the platforms can #include, and > just put these common definitions in it (for now)?
How about the attached diff? (untested, just for review) - Only sun3 use immediate "13" (not PGSHIFT) for PG_SHIFT, but sun3/include/param.h also has "#define PGSHIFT 13". - For now I'll leave evbcf as is. (I doubt its MACHINE_ARCH is m68k) --- /dev/null 2020-01-12 15:11:38.258153018 +0900 +++ m68k/include/vmparam.h 2020-01-12 15:29:21.866107854 +0900 @@ -0,0 +1,65 @@ +/* $NetBSD$ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ + * + * @(#)vmparam.h 8.2 (Berkeley) 4/19/94 + */ + +#ifndef _M68K_VMPARAM_H_ +#define _M68K_VMPARAM_H_ + +/* + * Common constants for m68k ports + */ + +/* + * hp300 pmap derived m68k ports can use 4K or 8K pages. + * (except HPMMU machines) + * sun3 and sun3x use 8K pages. + * The page size is specified by PGSHIFT in <machine/param.h>. + * Override the PAGE_* definitions to be compile-time constants. + */ +#define PAGE_SHIFT PGSHIFT +#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_MASK (PAGE_SIZE - 1) + +/* Some implemantations like jemalloc(3) require physical page size details. */ +#define MIN_PAGE_SHIFT 12 +#define MAX_PAGE_SHIFT 13 +#define MIN_PAGE_SIZE (1 << MIN_PAGE_SHIFT) +#define MAX_PAGE_SIZE (1 << MAX_PAGE_SHIFT) + +#endif /* _M68K_VMPARAM_H_ */ Index: amiga/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/amiga/include/vmparam.h,v retrieving revision 1.47 diff -u -p -d -r1.47 vmparam.h --- amiga/include/vmparam.h 27 Mar 2019 17:15:29 -0000 1.47 +++ amiga/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,12 +46,9 @@ */ /* - * We use 8K pages on the Amiga. Override the PAGE_* definitions - * to be compie-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: atari/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/atari/include/vmparam.h,v retrieving revision 1.33 diff -u -p -d -r1.33 vmparam.h --- atari/include/vmparam.h 27 Mar 2019 17:15:29 -0000 1.33 +++ atari/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,12 +46,9 @@ */ /* - * We use 8K pages on the Atari. Override the PAGE_* definitions - * to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: cesfic/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/cesfic/include/vmparam.h,v retrieving revision 1.18 diff -u -p -d -r1.18 vmparam.h --- cesfic/include/vmparam.h 28 Jun 2019 15:17:43 -0000 1.18 +++ cesfic/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,13 +46,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: hp300/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/hp300/include/vmparam.h,v retrieving revision 1.40 diff -u -p -d -r1.40 vmparam.h --- hp300/include/vmparam.h 28 Jun 2019 15:17:43 -0000 1.40 +++ hp300/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,14 +46,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * (except HPMMU machines) - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: luna68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/luna68k/include/vmparam.h,v retrieving revision 1.22 diff -u -p -d -r1.22 vmparam.h --- luna68k/include/vmparam.h 28 Jun 2019 15:17:43 -0000 1.22 +++ luna68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -42,13 +42,9 @@ #define _MACHINE_VMPARAM_H_ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: mac68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/mac68k/include/vmparam.h,v retrieving revision 1.45 diff -u -p -d -r1.45 vmparam.h --- mac68k/include/vmparam.h 28 Jun 2019 15:17:43 -0000 1.45 +++ mac68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -81,13 +81,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: mvme68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/mvme68k/include/vmparam.h,v retrieving revision 1.37 diff -u -p -d -r1.37 vmparam.h --- mvme68k/include/vmparam.h 28 Jun 2019 15:17:44 -0000 1.37 +++ mvme68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,13 +46,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: news68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/news68k/include/vmparam.h,v retrieving revision 1.22 diff -u -p -d -r1.22 vmparam.h --- news68k/include/vmparam.h 28 Jun 2019 15:17:44 -0000 1.22 +++ news68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,13 +46,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: next68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/next68k/include/vmparam.h,v retrieving revision 1.26 diff -u -p -d -r1.26 vmparam.h --- next68k/include/vmparam.h 28 Jun 2019 15:17:44 -0000 1.26 +++ next68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -53,13 +53,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: sun3/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/sun3/include/vmparam.h,v retrieving revision 1.37 diff -u -p -d -r1.37 vmparam.h --- sun3/include/vmparam.h 7 Jan 2013 16:58:09 -0000 1.37 +++ sun3/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -32,12 +32,9 @@ #define __USE_TOPDOWN_VM /* - * We use 8K pages on both the sun3 and sun3x. Override PAGE_* - * to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT 13 -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> #define USRSTACK kernbase /* for modules */ #define USRSTACK3 KERNBASE3 /* for asm not in modules */ Index: x68k/include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/x68k/include/vmparam.h,v retrieving revision 1.39 diff -u -p -d -r1.39 vmparam.h --- x68k/include/vmparam.h 28 Jun 2019 15:17:44 -0000 1.39 +++ x68k/include/vmparam.h 12 Jan 2020 06:29:56 -0000 @@ -46,13 +46,9 @@ */ /* - * hp300 pmap derived m68k ports can use 4K or 8K pages. - * The page size is specified by PGSHIFT in <machine/param.h>. - * Override the PAGE_* definitions to be compile-time constants. + * Use common m68k definitions to define PAGE_SIZE and related constants. */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. --- Izumi Tsutsui