summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-23 16:12:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-23 16:12:32 +0000
commit73c9f13809997febbf178be4123a0352ee8b8312 (patch)
tree4a514d179014528fcaa112abb942d619dc1ae9ca
parent3ea8990ba9276efe1c2bbde129074f8dd9b8c992 (diff)
refactor sys/param.h and machine/param.h. A lot of #ifdef _KERNEL is added
to keep definitions our of user space. The MD files now follow a consistant order -- all namespace intrusion is at the tail can be cleaned up independently. locore, bootblocks, and libkvm still see enough visibility to build. Checked on 90% of platforms...
-rw-r--r--sys/arch/alpha/include/param.h64
-rw-r--r--sys/arch/alpha/include/vmparam.h6
-rw-r--r--sys/arch/amd64/include/biosvar.h6
-rw-r--r--sys/arch/amd64/include/param.h75
-rw-r--r--sys/arch/amd64/include/pte.h5
-rw-r--r--sys/arch/arm/include/param.h118
-rw-r--r--sys/arch/armish/include/param.h16
-rw-r--r--sys/arch/aviion/include/param.h19
-rw-r--r--sys/arch/beagle/include/param.h16
-rw-r--r--sys/arch/gumstix/include/param.h16
-rw-r--r--sys/arch/hp300/include/param.h14
-rw-r--r--sys/arch/hppa/include/cpu.h6
-rw-r--r--sys/arch/hppa/include/param.h57
-rw-r--r--sys/arch/hppa/include/pdc.h4
-rw-r--r--sys/arch/hppa64/include/cpu.h4
-rw-r--r--sys/arch/hppa64/include/param.h57
-rw-r--r--sys/arch/i386/include/biosvar.h8
-rw-r--r--sys/arch/i386/include/param.h71
-rw-r--r--sys/arch/i386/include/pmap.h17
-rw-r--r--sys/arch/i386/include/pte.h8
-rw-r--r--sys/arch/i386/include/vmparam.h4
-rw-r--r--sys/arch/ia64/include/param.h8
-rw-r--r--sys/arch/landisk/include/param.h13
-rw-r--r--sys/arch/loongson/include/param.h21
-rw-r--r--sys/arch/luna88k/include/param.h19
-rw-r--r--sys/arch/m68k/include/param.h57
-rw-r--r--sys/arch/m68k/include/vmparam.h6
-rw-r--r--sys/arch/m88k/include/param.h68
-rw-r--r--sys/arch/macppc/include/param.h13
-rw-r--r--sys/arch/mips64/include/param.h53
-rw-r--r--sys/arch/mvme68k/include/cpu.h10
-rw-r--r--sys/arch/mvme68k/include/param.h15
-rw-r--r--sys/arch/mvme88k/include/param.h20
-rw-r--r--sys/arch/octeon/include/param.h18
-rw-r--r--sys/arch/palm/include/param.h12
-rw-r--r--sys/arch/powerpc/include/param.h62
-rw-r--r--sys/arch/powerpc/include/pmap.h15
-rw-r--r--sys/arch/sgi/include/param.h17
-rw-r--r--sys/arch/sh/include/param.h59
-rw-r--r--sys/arch/socppc/include/param.h15
-rw-r--r--sys/arch/solbourne/include/param.h75
-rw-r--r--sys/arch/sparc/include/param.h178
-rw-r--r--sys/arch/sparc/include/pte.h4
-rw-r--r--sys/arch/sparc64/include/param.h103
-rw-r--r--sys/arch/sparc64/include/pmap.h2
-rw-r--r--sys/arch/vax/include/macros.h4
-rw-r--r--sys/arch/vax/include/param.h65
-rw-r--r--sys/arch/vax/include/vmparam.h4
-rw-r--r--sys/arch/zaurus/include/param.h16
-rw-r--r--sys/sys/malloc.h24
-rw-r--r--sys/sys/param.h83
-rw-r--r--sys/uvm/uvm_meter.c11
52 files changed, 669 insertions, 992 deletions
diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h
index 3956c8ff2e2..3a9e0c6d7f8 100644
--- a/sys/arch/alpha/include/param.h
+++ b/sys/arch/alpha/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.36 2012/06/26 01:59:47 deraadt Exp $ */
-/* $NetBSD: param.h,v 1.30 2000/06/09 16:03:04 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.37 2013/03/23 16:12:18 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -33,15 +32,11 @@
* 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: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 8.1 (Berkeley) 6/10/93
*/
-/*
- * Machine dependent constants for the Alpha.
- */
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#define _MACHINE alpha
#define MACHINE "alpha"
#define _MACHINE_ARCH alpha
@@ -56,53 +51,34 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define NBPG (1 << 13) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte off. into pg */
-#define PGSHIFT 13 /* LOG2(NBPG) */
-
-#define PAGE_SHIFT 13
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
+#define PAGE_SHIFT 13
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
#define KERNBASE 0xfffffc0000580000 /* start of kernel virtual */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#ifndef MAXPHYS
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-#endif
+#ifdef _KERNEL
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG) /* total size of u-area */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NBPG PAGE_SIZE /* bytes/page */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE NBPG /* default message buffer size */
-#endif
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (2 * PAGE_SIZE) /* default message buffer size */
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-#ifdef _KERNEL
#ifndef _LOCORE
#include <machine/intr.h>
@@ -120,3 +96,5 @@ paddr_t alpha_XXX_dmamap(vaddr_t);
#endif
#endif /* !_KERNEL */
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/alpha/include/vmparam.h b/sys/arch/alpha/include/vmparam.h
index 3559336ba9e..33c211aa563 100644
--- a/sys/arch/alpha/include/vmparam.h
+++ b/sys/arch/alpha/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.21 2011/05/30 22:25:20 oga Exp $ */
+/* $OpenBSD: vmparam.h,v 1.22 2013/03/23 16:12:18 deraadt Exp $ */
/* $NetBSD: vmparam.h,v 1.18 2000/05/22 17:13:54 thorpej Exp $ */
/*
@@ -57,7 +57,7 @@
* consider doing that at some point, but it might require changes
* to the exec code.
*/
-#define USRTEXT NBPG
+#define USRTEXT PAGE_SIZE
#define USRSTACK ((vaddr_t)0x0000000200000000) /* 8G */
/*
@@ -116,7 +116,7 @@
#define VM_PIE_MAX_ADDR 0x80000000
/* virtual sizes (bytes) for various kernel submaps */
-#define VM_PHYS_SIZE (USRIOSIZE*NBPG)
+#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
/* some Alpha-specific constants */
#define VPTBASE ((vaddr_t)0xfffffffc00000000) /* Virt. pg table */
diff --git a/sys/arch/amd64/include/biosvar.h b/sys/arch/amd64/include/biosvar.h
index 364458bfc95..f3bf6d59ea7 100644
--- a/sys/arch/amd64/include/biosvar.h
+++ b/sys/arch/amd64/include/biosvar.h
@@ -1,5 +1,5 @@
/* XXX - DSR */
-/* $OpenBSD: biosvar.h,v 1.17 2012/10/09 12:58:07 jsing Exp $ */
+/* $OpenBSD: biosvar.h,v 1.18 2013/03/23 16:12:20 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -33,8 +33,8 @@
#define _MACHINE_BIOSVAR_H_
/* some boxes put apm data seg in the 2nd page */
-#define BOOTARG_OFF (NBPG*2)
-#define BOOTARG_LEN (NBPG*1)
+#define BOOTARG_OFF (PAGE_SIZE * 2)
+#define BOOTARG_LEN (PAGE_SIZE * 1)
#define BOOTBIOS_ADDR (0x7c00)
#define BOOTBIOS_MAXSEC ((1 << 28) - 1)
diff --git a/sys/arch/amd64/include/param.h b/sys/arch/amd64/include/param.h
index 49542f1c27e..6b6959d4ce3 100644
--- a/sys/arch/amd64/include/param.h
+++ b/sys/arch/amd64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.19 2013/03/21 15:50:28 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.20 2013/03/23 16:12:20 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -30,10 +30,11 @@
* 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.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
*/
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#ifdef _KERNEL
#ifdef _LOCORE
#include <machine/psl.h>
@@ -46,69 +47,47 @@
#define MACHINE "amd64"
#define _MACHINE_ARCH amd64
#define MACHINE_ARCH "amd64"
-#define MID_MACHINE MID_AMD64
+#define MID_MACHINE MID_AMD64
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
+#define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */
-#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
+#ifdef _KERNEL
-#define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */
-#define KERNTEXTOFF (KERNBASE+0x1000000) /* start of kernel text */
+#define KERNTEXTOFF (KERNBASE+0x1000000) /* start of kernel text */
+#define KERNTEXTOFF_HI 0xffffffff
+#define KERNTEXTOFF_LO 0x81000000
-#define KERNTEXTOFF_HI 0xffffffff
-#define KERNTEXTOFF_LO 0x81000000
+#define KERNBASE_HI 0xffffffff
+#define KERNBASE_LO 0x80000000
-#define KERNBASE_HI 0xffffffff
-#define KERNBASE_LO 0x80000000
+#define NBPG PAGE_SIZE /* bytes/page */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#ifndef MAXPHYS
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-#endif
+#define UPAGES 5 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#define UPAGES 5 /* pages of u-area */
-#define USPACE (UPAGES * NBPG) /* total size of u-area */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NMBCLUSTERS 6144 /* map size, max cluster allocation */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE 16*NBPG /* default message buffer size */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (16 * PAGE_SIZE) /* default message buffer size */
#endif
/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 6144 /* map size, max cluster allocation */
-
-/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define dbtob(x) ((x) << DEV_BSHIFT)
-#define btodb(x) ((x) >> DEV_BSHIFT)
+#endif /* _KERNEL */
-/*
- * Mach derived conversion macros
- */
-#define x86_round_pdr(x) \
- ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
-#define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/amd64/include/pte.h b/sys/arch/amd64/include/pte.h
index 526a695b008..e7bc3671c21 100644
--- a/sys/arch/amd64/include/pte.h
+++ b/sys/arch/amd64/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.8 2011/03/23 16:54:34 pirofti Exp $ */
+/* $OpenBSD: pte.h,v 1.9 2013/03/23 16:12:20 deraadt Exp $ */
/* $NetBSD: pte.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */
/*
@@ -97,6 +97,9 @@ typedef u_int64_t pt_entry_t; /* PTE */
#define L2_FRAME (L3_FRAME|L2_MASK)
#define L1_FRAME (L2_FRAME|L1_MASK)
+#define x86_round_pdr(x) \
+ ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
+
/*
* PDE/PTE bits. These are no different from their i386 counterparts.
*/
diff --git a/sys/arch/arm/include/param.h b/sys/arch/arm/include/param.h
index 164b1a0dc67..d69f63cd4cf 100644
--- a/sys/arch/arm/include/param.h
+++ b/sys/arch/arm/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.17 2011/09/20 22:02:13 miod Exp $ */
-/* $NetBSD: param.h,v 1.9 2002/03/24 03:37:23 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.18 2013/03/23 16:12:20 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,40 +35,43 @@
#ifndef _ARM_PARAM_H_
#define _ARM_PARAM_H_
-#define MACHINE_ARCH "arm"
-#define _MACHINE_ARCH arm
+#define MACHINE_ARCH "arm"
+#define _MACHINE_ARCH arm
+#define MID_MACHINE MID_ARM6
-/*
- * Machine dependent constants for ARM6+ processors
- */
-/* These are defined in the Port File before it includes
- * this file. */
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PAGE_SHIFT 12 /* LOG2(NBPG) */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define PAGE_SIZE (1 << PAGE_SHIFT) /* bytes/page */
-#define NBPG (1 << PAGE_SHIFT) /* bytes/page */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
-#define PGOFSET (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT
+#define PGOFSET PAGE_MASK
+
+#ifdef _KERNEL
+
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NBPG PAGE_SIZE
+
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE PAGE_SIZE /* default message buffer size */
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (1 * PAGE_SIZE) /* default message buffer size */
#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
/* Constants used to divide the USPACE area */
-
/*
* The USPACE area contains :
* 1. the user structure for the process
@@ -94,73 +96,27 @@
* overflows.
*/
-#define FPCONTEXTSIZE (0x100)
-#define USPACE_SVC_STACK_TOP (USPACE)
-#define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000)
+#define FPCONTEXTSIZE (0x100)
+#define USPACE_SVC_STACK_TOP (USPACE)
+#define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000)
#define USPACE_UNDEF_STACK_TOP (USPACE_SVC_STACK_BOTTOM - 0x10)
-#define USPACE_UNDEF_STACK_BOTTOM (sizeof(struct user) + FPCONTEXTSIZE + 10)
+#define USPACE_UNDEF_STACK_BOTTOM (sizeof(struct user) + FPCONTEXTSIZE + 10)
-#ifdef _KERNEL
#ifndef _LOCORE
void delay (unsigned);
-#define DELAY(x) delay(x)
+#define DELAY(x) delay(x)
#endif
-#endif
-
-/*
- * Machine dependent constants for all ARM processors
- */
-
-/*
- * For KERNEL code:
- * MACHINE must be defined by the individual port. This is so that
- * uname returns the correct thing, etc.
- *
- * MACHINE_ARCH may be defined by individual ports as a temporary
- * measure while we're finishing the conversion to ELF.
- *
- * For non-KERNEL code:
- * If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".
- */
-
-
-#define MID_MACHINE MID_ARM6
-
-#define ALIGNBYTES _ALIGNBYTES
-#define ALIGN(p) _ALIGN(p)
-#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-
-/* ARM-specific macro to align a stack pointer (downwards). */
-#define STACKALIGNBYTES (8 - 1)
-#define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES)
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
+#define ovbcopy bcopy
-#ifndef MAXPHYS
-#define MAXPHYS (64 * 1024) /* max I/O transfer size */
+#if !defined(_LOCORE)
+#include <machine/cpu.h>
#endif
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
-
-#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
- ((bytes) >> DEV_BSHIFT)
-#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
- ((db) << DEV_BSHIFT)
-
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-
-#define ovbcopy bcopy
+/* ARM-specific macro to align a stack pointer (downwards). */
+#define STACKALIGNBYTES (8 - 1)
+#define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES)
-#if defined(_KERNEL) && !defined(_LOCORE)
-#include <sys/param.h>
-#include <machine/cpu.h>
-#endif
+#endif /* _KERNEL */
-#endif /* _ARM_PARAM_H_ */
+#endif /* _ARM_PARAM_H_ */
diff --git a/sys/arch/armish/include/param.h b/sys/arch/armish/include/param.h
index fb03842b2df..c8ea882424d 100644
--- a/sys/arch/armish/include/param.h
+++ b/sys/arch/armish/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.2 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:21 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,16 +35,13 @@
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * 1 page should be enough
- */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1*NBPG)
-#endif
-
#include <arm/param.h>
#define _MACHINE armish
#define MACHINE "armish"
-#endif /* _MACHINE_PARAM_H_ */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (1 * PAGE_SIZE)
+#endif
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/aviion/include/param.h b/sys/arch/aviion/include/param.h
index 0e2d70fa60b..03c2dc8b63e 100644
--- a/sys/arch/aviion/include/param.h
+++ b/sys/arch/aviion/include/param.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: param.h,v 1.3 2010/04/24 18:44:27 miod Exp $ */
+/* $OpenBSD: param.h,v 1.4 2013/03/23 16:12:21 deraadt Exp $ */
+
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -32,21 +33,17 @@
* 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: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 7.8 (Berkeley) 6/28/91
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
-#define _MACHINE aviion
-#define MACHINE "aviion"
+#define _MACHINE aviion
+#define MACHINE "aviion"
#include <m88k/param.h>
-#define KERNBASE 0x00000000 /* start of kernel virtual */
+#define KERNBASE 0x00000000 /* start of kernel virtual */
#define KERNTEXTOFF 0x00001000 /* start of kernel text */
-#endif /* !_MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/beagle/include/param.h b/sys/arch/beagle/include/param.h
index 0f2622246c7..c75f2c6cf40 100644
--- a/sys/arch/beagle/include/param.h
+++ b/sys/arch/beagle/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.3 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.4 2013/03/23 16:12:21 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,16 +35,13 @@
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * 1 page should be enough
- */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1*NBPG)
-#endif
-
#include <arm/param.h>
#define _MACHINE beagle
#define MACHINE "beagle"
-#endif /* _MACHINE_PARAM_H_ */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE PAGE_SIZE
+#endif
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/gumstix/include/param.h b/sys/arch/gumstix/include/param.h
index b17cc4736e8..139d0638652 100644
--- a/sys/arch/gumstix/include/param.h
+++ b/sys/arch/gumstix/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.3 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.4 2013/03/23 16:12:21 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,16 +35,13 @@
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * 1 page should be enough
- */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1*NBPG)
-#endif
-
#include <arm/param.h>
#define _MACHINE gumstix
#define MACHINE "gumstix"
-#endif /* _MACHINE_PARAM_H_ */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE PAGE_SIZE
+#endif
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h
index 861bf1dd1e8..4b1ffd21653 100644
--- a/sys/arch/hp300/include/param.h
+++ b/sys/arch/hp300/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.25 2006/06/11 20:48:11 miod Exp $ */
-/* $NetBSD: param.h,v 1.35 1997/07/10 08:22:38 veego Exp $ */
+/* $OpenBSD: param.h,v 1.26 2013/03/23 16:12:22 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -33,18 +32,11 @@
* 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: machparam.h 1.16 92/12/20$
- *
- * @(#)param.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * Machine dependent constants for HP 9000 series 300.
- */
#define _MACHINE hp300
#define MACHINE "hp300"
@@ -54,7 +46,7 @@
#include <m68k/param.h>
-#define MSGBUFSIZE 4096
+#define MSGBUFSIZE 4096
#if defined(_KERNEL) && !defined(_LOCORE)
#define delay(us) _delay((us) << 8)
@@ -63,4 +55,4 @@
void _delay(u_int);
#endif /* _KERNEL && !_LOCORE */
-#endif /* !_MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index 536ae85f1fb..ebc07d46137 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.84 2013/03/12 09:37:16 mpi Exp $ */
+/* $OpenBSD: cpu.h,v 1.85 2013/03/23 16:12:22 deraadt Exp $ */
/*
* Copyright (c) 2000-2004 Michael Shalayeff
@@ -245,8 +245,8 @@ extern void need_resched(struct cpu_info *);
* Boot arguments stuff
*/
-#define BOOTARG_LEN (NBPG)
-#define BOOTARG_OFF (0x10000)
+#define BOOTARG_LEN PAGE_SIZE
+#define BOOTARG_OFF 0x10000
/*
* CTL_MACHDEP definitions.
diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h
index 1009521e5f2..4c77ffcc8d2 100644
--- a/sys/arch/hppa/include/param.h
+++ b/sys/arch/hppa/include/param.h
@@ -1,6 +1,6 @@
-/* $OpenBSD: param.h,v 1.42 2012/06/26 16:18:14 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.43 2013/03/23 16:12:22 deraadt Exp $ */
-/*
+/*
* Copyright (c) 1988-1994, The University of Utah and
* the Computer Systems Laboratory at the University of Utah (CSL).
* All rights reserved.
@@ -19,19 +19,16 @@
*
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
* improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: param.h 1.18 94/12/16$
*/
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#ifdef _KERNEL
#include <machine/cpu.h>
#include <machine/intr.h>
#endif
-/*
- * Machine dependent constants for PA-RISC.
- */
-
#define _MACHINE hppa
#define MACHINE "hppa"
#define _MACHINE_ARCH hppa
@@ -42,47 +39,37 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PAGE_SIZE 4096
-#define PAGE_MASK (PAGE_SIZE-1)
#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
-#define NBPG 4096 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
+#define KERNBASE 0x00000000 /* start of kernel virtual */
-#define KERNBASE 0x00000000 /* start of kernel virtual */
+#ifdef _KERNEL
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#define NBPG PAGE_SIZE /* bytes/page */
-#define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */
+#define UPAGES 4 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#define USPACE (4 * NBPG) /* pages for user struct and kstack */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
#ifndef MSGBUFSIZE
-#define MSGBUFSIZE 2*NBPG /* default message buffer size */
+#define MSGBUFSIZE (2 * PAGE_SIZE) /* default message buffer size */
#endif
/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-
-/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
+#endif /* _KERNEL */
+#define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */
#define __SWAP_BROKEN
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/hppa/include/pdc.h b/sys/arch/hppa/include/pdc.h
index bc9e7f0b5d3..7c878b79325 100644
--- a/sys/arch/hppa/include/pdc.h
+++ b/sys/arch/hppa/include/pdc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.h,v 1.35 2007/07/15 20:03:48 kettenis Exp $ */
+/* $OpenBSD: pdc.h,v 1.36 2013/03/23 16:12:22 deraadt Exp $ */
/*
* Copyright (c) 1990 mt Xinu, Inc. All rights reserved.
@@ -94,7 +94,7 @@
#define IODC_IOSIZ (16 * 1024)
#define PDC_ALIGNMENT __attribute__ ((__aligned__(64)))
-#define PDC_STACKSIZE (4*NBPG)
+#define PDC_STACKSIZE (4 * PAGE_SIZE)
/*
* The PDC Entry Points and their arguments...
diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h
index 193a1bc7588..67d59334080 100644
--- a/sys/arch/hppa64/include/cpu.h
+++ b/sys/arch/hppa64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.31 2013/03/12 09:37:16 mpi Exp $ */
+/* $OpenBSD: cpu.h,v 1.32 2013/03/23 16:12:22 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -253,7 +253,7 @@ void sync_caches(void);
* Boot arguments stuff
*/
-#define BOOTARG_LEN (NBPG)
+#define BOOTARG_LEN (PAGE_SIZE)
#define BOOTARG_OFF (0x10000)
/*
diff --git a/sys/arch/hppa64/include/param.h b/sys/arch/hppa64/include/param.h
index 5e8159d7644..1ac9f9f75f3 100644
--- a/sys/arch/hppa64/include/param.h
+++ b/sys/arch/hppa64/include/param.h
@@ -1,6 +1,6 @@
-/* $OpenBSD: param.h,v 1.17 2012/07/02 18:02:31 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.18 2013/03/23 16:12:22 deraadt Exp $ */
-/*
+/*
* Copyright (c) 1988-1994, The University of Utah and
* the Computer Systems Laboratory at the University of Utah (CSL).
* All rights reserved.
@@ -19,19 +19,16 @@
*
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
* improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: param.h 1.18 94/12/16$
*/
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#ifdef _KERNEL
#include <machine/cpu.h>
#include <machine/intr.h>
#endif
-/*
- * Machine dependent constants for PA-RISC.
- */
-
#define _MACHINE hppa64
#define MACHINE "hppa64"
#define _MACHINE_ARCH hppa64
@@ -42,47 +39,37 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PAGE_SIZE 4096
-#define PAGE_MASK (PAGE_SIZE-1)
#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(NBPG) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
-#define NBPG 4096 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
+#define KERNBASE 0x00000000 /* start of kernel virtual */
-#define KERNBASE 0x00000000 /* start of kernel virtual */
+#ifdef _KERNEL
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#define NBPG PAGE_SIZE /* bytes/page */
-#define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */
+#define UPAGES 5 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#define USPACE (5 * NBPG) /* pages for user struct and kstack */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
#ifndef MSGBUFSIZE
-#define MSGBUFSIZE 2*NBPG /* default message buffer size */
+#define MSGBUFSIZE (2 * PAGE_SIZE) /* default message buffer size */
#endif
/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-
-/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
-
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
+#endif /* _KERNEL */
+#define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */
#define __SWAP_BROKEN
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index 40f640b67d4..37f2efd19e7 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.59 2012/10/09 12:58:07 jsing Exp $ */
+/* $OpenBSD: biosvar.h,v 1.60 2013/03/23 16:12:23 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -30,13 +30,13 @@
#define _MACHINE_BIOSVAR_H_
/* some boxes put apm data seg in the 2nd page */
-#define BOOTARG_OFF (NBPG*2)
-#define BOOTARG_LEN (NBPG*1)
+#define BOOTARG_OFF (PAGE_SIZE * 2)
+#define BOOTARG_LEN (PAGE_SIZE * 1)
#define BOOTBIOS_ADDR (0x7c00)
#define BOOTBIOS_MAXSEC ((1 << 28) - 1)
/* physical page for ptp 0 need for various tramps */
-#define PTP0_PA (NBPG*3)
+#define PTP0_PA (PAGE_SIZE * 3)
/* BIOS configure flags */
#define BIOSF_BIOS32 0x0001
diff --git a/sys/arch/i386/include/param.h b/sys/arch/i386/include/param.h
index 6c6a81e70cc..61144293180 100644
--- a/sys/arch/i386/include/param.h
+++ b/sys/arch/i386/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.44 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.29 1996/03/04 05:04:26 cgd Exp $ */
+/* $OpenBSD: param.h,v 1.45 2013/03/23 16:12:23 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -31,13 +30,10 @@
* 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.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
*/
-/*
- * Machine dependent constants for Intel 386.
- */
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#ifdef _KERNEL
#ifdef _LOCORE
@@ -57,61 +53,36 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
-/*
- * Start of kernel virtual space. Remember to alter the memory and
- * page table layout description in pmap.h when changing this.
- */
#define KERNBASE 0xd0000000
+#ifdef _KERNEL
+
#define KERNTEXTOFF (KERNBASE+0x200000) /* start of kernel text */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#ifndef MAXPHYS
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-#endif
+#define NBPG PAGE_SIZE /* bytes/page */
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG) /* total size of u-area */
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE 4*NBPG /* default message buffer size */
-#endif
+#define NMBCLUSTERS 6144 /* map size, max cluster allocation */
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 6144 /* map size, max cluster allocation */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (4 * PAGE_SIZE) /* default message buffer size */
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define dbtob(x) ((x) << DEV_BSHIFT)
-#define btodb(x) ((x) >> DEV_BSHIFT)
+#endif /* _KERNEL */
-/*
- * Mach derived conversion macros
- */
-#define i386_round_pdr(x) ((((unsigned)(x)) + PDOFSET) & ~PDOFSET)
-#define i386_trunc_pdr(x) ((unsigned)(x) & ~PDOFSET)
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h
index 266987a9ad6..884c8b896dc 100644
--- a/sys/arch/i386/include/pmap.h
+++ b/sys/arch/i386/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.59 2011/06/25 19:20:41 jsg Exp $ */
+/* $OpenBSD: pmap.h,v 1.60 2013/03/23 16:12:23 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */
/*
@@ -87,7 +87,7 @@
* point (slot #831 as show above). When the pmap code wants to find the
* PTE for a virtual address, all it has to do is the following:
*
- * Address of PTE = (831 * 4MB) + (VA / NBPG) * sizeof(pt_entry_t)
+ * Address of PTE = (831 * 4MB) + (VA / PAGE_SIZE) * sizeof(pt_entry_t)
* = 0xcfc00000 + (VA / 4096) * 4
*
* What happens if the pmap layer is asked to perform an operation
@@ -159,8 +159,8 @@
#define PTE_BASE ((pt_entry_t *) (PDSLOT_PTE * NBPD) )
#define APTE_BASE ((pt_entry_t *) (PDSLOT_APTE * NBPD) )
-#define PDP_BASE ((pd_entry_t *)(((char *)PTE_BASE) + (PDSLOT_PTE * NBPG)))
-#define APDP_BASE ((pd_entry_t *)(((char *)APTE_BASE) + (PDSLOT_APTE * NBPG)))
+#define PDP_BASE ((pd_entry_t *)(((char *)PTE_BASE) + (PDSLOT_PTE * PAGE_SIZE)))
+#define APDP_BASE ((pd_entry_t *)(((char *)APTE_BASE) + (PDSLOT_APTE * PAGE_SIZE)))
#define PDP_PDE (PDP_BASE + PDSLOT_PTE)
#define APDP_PDE (PDP_BASE + PDSLOT_APTE)
@@ -211,12 +211,12 @@
* A PTP's offset is the byte-offset in the PTE space that this PTP is at.
* A PTP's VA is the first VA mapped by that PTP.
*
- * Note that NBPG == number of bytes in a PTP (4096 bytes == 1024 entries)
+ * Note that PAGE_SIZE == number of bytes in a PTP (4096 bytes == 1024 entries)
* NBPD == number of bytes a PTP can map (4MB)
*/
-#define ptp_i2o(I) ((I) * NBPG) /* index => offset */
-#define ptp_o2i(O) ((O) / NBPG) /* offset => index */
+#define ptp_i2o(I) ((I) * PAGE_SIZE) /* index => offset */
+#define ptp_o2i(O) ((O) / PAGE_SIZE) /* offset => index */
#define ptp_i2v(I) ((I) * NBPD) /* index => VA */
#define ptp_v2i(V) ((V) / NBPD) /* VA => index (same as pdei) */
@@ -321,10 +321,9 @@ struct pv_page_info {
/*
* number of pv_entries in a pv_page
- * (note: won't work on systems where NPBG isn't a constant)
*/
-#define PVE_PER_PVPAGE ((NBPG - sizeof(struct pv_page_info)) / \
+#define PVE_PER_PVPAGE ((PAGE_SIZE - sizeof(struct pv_page_info)) / \
sizeof(struct pv_entry))
/*
diff --git a/sys/arch/i386/include/pte.h b/sys/arch/i386/include/pte.h
index 1dc9df81457..90b5cd38074 100644
--- a/sys/arch/i386/include/pte.h
+++ b/sys/arch/i386/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.13 2011/03/23 16:54:35 pirofti Exp $ */
+/* $OpenBSD: pte.h,v 1.14 2013/03/23 16:12:23 deraadt Exp $ */
/* $NetBSD: pte.h,v 1.11 1998/02/06 21:58:05 thorpej Exp $ */
/*
@@ -147,13 +147,15 @@ typedef u_int32_t pt_entry_t; /* PTE */
#define NBPD (1 << PDSHIFT) /* # bytes mapped by PD (4MB) */
#define PDOFSET (NBPD-1) /* mask for non-PD part of VA */
#if 0 /* not used? */
-#define NPTEPD (NBPD / NBPG) /* # of PTEs in a PD */
+#define NPTEPD (NBPD / PAGE_SIZE) /* # of PTEs in a PD */
#else
-#define PTES_PER_PTP (NBPD / NBPG) /* # of PTEs in a PTP */
+#define PTES_PER_PTP (NBPD / PAGE_SIZE) /* # of PTEs in a PTP */
#endif
#define PD_MASK 0xffc00000 /* page directory address bits */
#define PT_MASK 0x003ff000 /* page table address bits */
+#define i386_round_pdr(x) ((((unsigned)(x)) + PDOFSET) & ~PDOFSET)
+
/*
* here we define the bits of the PDE/PTE, as described above:
*
diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h
index 224e75d89a7..48823fc2bd7 100644
--- a/sys/arch/i386/include/vmparam.h
+++ b/sys/arch/i386/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.49 2013/01/27 16:12:16 fgsch Exp $ */
+/* $OpenBSD: vmparam.h,v 1.50 2013/03/23 16:12:23 deraadt Exp $ */
/* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */
/*-
@@ -104,7 +104,7 @@
/* user/kernel map constants */
#define VM_MIN_ADDRESS ((vaddr_t)PAGE_SIZE)
-#define VM_MAXUSER_ADDRESS ((vaddr_t)((PDSLOT_PTE<<PDSHIFT) - USPACE))
+#define VM_MAXUSER_ADDRESS ((vaddr_t)((PDSLOT_PTE<<PDSHIFT) - (2 * PAGE_SIZE)))
#define VM_MAX_ADDRESS ((vaddr_t)((PDSLOT_PTE<<PDSHIFT) + \
(PDSLOT_PTE<<PGSHIFT)))
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)KERNBASE)
diff --git a/sys/arch/ia64/include/param.h b/sys/arch/ia64/include/param.h
index b13d6609a53..7d4342ffac2 100644
--- a/sys/arch/ia64/include/param.h
+++ b/sys/arch/ia64/include/param.h
@@ -1,11 +1,11 @@
-/* $OpenBSD: param.h,v 1.2 2011/09/08 03:40:32 guenther Exp $ */
+/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */
/*
* Written by Paul Irofti <pirofti@openbsd.org>. Public Domain.
*/
-#ifndef _IA64_PARAM_H_
-#define _IA64_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#define _MACHINE ia64
#define MACHINE "ia64"
@@ -17,4 +17,4 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#endif /* _IA64_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/landisk/include/param.h b/sys/arch/landisk/include/param.h
index dd9f47db602..1b190166d22 100644
--- a/sys/arch/landisk/include/param.h
+++ b/sys/arch/landisk/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.2 2011/03/23 16:54:35 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
+/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -31,16 +30,10 @@
* 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.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
- */
-
-/*
- * Machine dependent constants for landisk
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#include <sh/param.h>
diff --git a/sys/arch/loongson/include/param.h b/sys/arch/loongson/include/param.h
index 46e9a3190e3..1abefe96fa2 100644
--- a/sys/arch/loongson/include/param.h
+++ b/sys/arch/loongson/include/param.h
@@ -1,18 +1,19 @@
-/* $OpenBSD: param.h,v 1.2 2010/02/03 20:50:57 miod Exp $ */
-/* public domain */
+/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+/* Public Domain */
+
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#define MACHINE "loongson"
#define _MACHINE loongson
-#define MACHINE_ARCH "mips64el"
-#define _MACHINE_ARCH mips64el
-/* not the canonical endianness */
+#define MACHINE_ARCH "mips64el" /* not the canonical endianness */
+#define _MACHINE_ARCH mips64el
#define MACHINE_CPU "mips64"
#define _MACHINE_CPU mips64
+#define MID_MACHINE MID_MIPS64
-#define MID_MACHINE MID_MIPS64
+#ifdef _KERNEL
/*
* The Loongson level 1 cache expects software to prevent virtual
@@ -23,6 +24,8 @@
*/
#define PAGE_SHIFT 14
+#endif /* _KERNEL */
+
#include <mips64/param.h>
-#endif /* _MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/luna88k/include/param.h b/sys/arch/luna88k/include/param.h
index 4898422b952..8e12fe594f7 100644
--- a/sys/arch/luna88k/include/param.h
+++ b/sys/arch/luna88k/include/param.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: param.h,v 1.3 2004/04/26 12:34:05 miod Exp $ */
+/* $OpenBSD: param.h,v 1.4 2013/03/23 16:12:24 deraadt Exp $ */
+
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -32,17 +33,13 @@
* 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: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 7.8 (Berkeley) 6/28/91
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
-#define _MACHINE luna88k
-#define MACHINE "luna88k"
+#define _MACHINE luna88k
+#define MACHINE "luna88k"
#include <m88k/param.h>
@@ -51,7 +48,7 @@
* this space, but the kernel must be linked with a start address past
* these 128KB.
*/
-#define KERNBASE 0x00000000 /* start of kernel virtual */
+#define KERNBASE 0x00000000 /* start of kernel virtual */
#define KERNTEXTOFF 0x00020000 /* start of kernel text */
-#endif /* !_MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h
index e5c5c09c78f..55fd712bd5d 100644
--- a/sys/arch/m68k/include/param.h
+++ b/sys/arch/m68k/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.27 2013/01/01 01:02:19 miod Exp $ */
-/* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */
+/* $OpenBSD: param.h,v 1.28 2013/03/23 16:12:24 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -33,17 +32,11 @@
* 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: machparam.h 1.16 92/12/20$
- *
- * @(#)param.h 8.1 (Berkeley) 6/10/93
*/
-#ifndef _M68K_PARAM_H_
-#define _M68K_PARAM_H_
-/*
- * Machine independent constants for m68k
- */
+#ifndef _M68K_PARAM_H_
+#define _M68K_PARAM_H_
+
#define _MACHINE_ARCH m68k
#define MACHINE_ARCH "m68k"
#define MID_MACHINE MID_M68K
@@ -54,19 +47,16 @@
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
-
#define PGSHIFT PAGE_SHIFT
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
+#define PGOFSET PAGE_MASK
+
+#ifdef _KERNEL
#define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t)))
#define BTOPKERNBASE ((u_long)KERNBASE >> PAGE_SHIFT)
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#define NBPG PAGE_SIZE
#define SEGSHIFT020 (34 - PAGE_SHIFT)
#define SEGSHIFT040 (18)
@@ -84,34 +74,19 @@
#define SEGOFSET (NBSEG - 1)
#endif
-/* mac68k use 3 pages of u-area */
-#ifndef UPAGES
-#define UPAGES 2 /* pages of u-area */
-#endif
-#define USPACE (UPAGES * PAGE_SIZE)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
+
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-/*
* Mach derived conversion macros
*/
#define m68k_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
@@ -120,4 +95,6 @@
#include <machine/cpu.h>
-#endif /* !_M68K_PARAM_H_ */
+#endif /* _KERNEL */
+
+#endif /* _M68K_PARAM_H_ */
diff --git a/sys/arch/m68k/include/vmparam.h b/sys/arch/m68k/include/vmparam.h
index 12a42a3a23f..fe45c8ac00c 100644
--- a/sys/arch/m68k/include/vmparam.h
+++ b/sys/arch/m68k/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.10 2011/05/30 22:25:21 oga Exp $ */
+/* $OpenBSD: vmparam.h,v 1.11 2013/03/23 16:12:24 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -99,9 +99,9 @@
/* user/kernel map constants */
#define VM_MIN_ADDRESS ((vaddr_t)0)
#define VM_MAXUSER_ADDRESS ((vaddr_t)(USRSTACK))
-#define VM_MAX_ADDRESS ((vaddr_t)(0-(UPAGES*NBPG)))
+#define VM_MAX_ADDRESS ((vaddr_t)(0-(UPAGES*PAGE_SIZE)))
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0)
-#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(0-NBPG))
+#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(0-PAGE_SIZE))
/* virtual sizes (bytes) for various kernel submaps */
#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
diff --git a/sys/arch/m88k/include/param.h b/sys/arch/m88k/include/param.h
index a6cc7116365..5cf0d255f9d 100644
--- a/sys/arch/m88k/include/param.h
+++ b/sys/arch/m88k/include/param.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: param.h,v 1.15 2013/01/01 01:02:19 miod Exp $ */
+/* $OpenBSD: param.h,v 1.16 2013/03/23 16:12:24 deraadt Exp $ */
+
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -32,13 +33,10 @@
* 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: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 7.8 (Berkeley) 6/28/91
*/
-#ifndef _M88K_PARAM_H_
-#define _M88K_PARAM_H_
+
+#ifndef _M88K_PARAM_H_
+#define _M88K_PARAM_H_
#ifdef _KERNEL
#ifndef _LOCORE
@@ -46,63 +44,48 @@
#endif /* _LOCORE */
#endif
-#define _MACHINE_ARCH m88k
-#define MACHINE_ARCH "m88k"
-#define MID_MACHINE MID_M88K
+#define _MACHINE_ARCH m88k
+#define MACHINE_ARCH "m88k"
+#define MID_MACHINE MID_M88K
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_SIZE /* byte offset into page */
-#define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t)))
+#define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t)))
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#ifdef _KERNEL
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define NBPG PAGE_SIZE
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
+
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE PAGE_SIZE
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Mmaximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
-#define MSGBUFSIZE PAGE_SIZE
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
/*
* Get interrupt glue.
*/
#include <machine/intr.h>
-#ifdef _KERNEL
-
-#define DELAY(x) delay(x)
+#define DELAY(x) delay(x)
#if !defined(_LOCORE)
extern void delay(int);
@@ -129,4 +112,5 @@ extern int cputyp;
#endif
#endif /* _KERNEL */
-#endif /* !_M88K_PARAM_H_ */
+
+#endif /* _M88K_PARAM_H_ */
diff --git a/sys/arch/macppc/include/param.h b/sys/arch/macppc/include/param.h
index 709e1de4486..47e01dd1307 100644
--- a/sys/arch/macppc/include/param.h
+++ b/sys/arch/macppc/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.4 2005/09/12 23:05:05 miod Exp $ */
-/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
+/* $OpenBSD: param.h,v 1.5 2013/03/23 16:12:24 deraadt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,6 +31,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#ifdef _KERNEL
#ifndef _LOCORE
#include <machine/cpu.h>
@@ -40,12 +42,11 @@
#include <powerpc/param.h>
-/*
- * Machine dependent constants for macppc (32-bit only currently)
- */
#define MACHINE "macppc"
#define _MACHINE macppc
#define KERNBASE 0x100000
-#define MSGBUFSIZE (NBPG*2)
+#define MSGBUFSIZE (2 * PAGE_SIZE)
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/mips64/include/param.h b/sys/arch/mips64/include/param.h
index 3347a9042fe..d22b5415a8b 100644
--- a/sys/arch/mips64/include/param.h
+++ b/sys/arch/mips64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.30 2011/09/08 03:40:32 guenther Exp $ */
+/* $OpenBSD: param.h,v 1.31 2013/03/23 16:12:25 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -32,13 +32,10 @@
* 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: machparam.h 1.11 89/08/14
- * from: @(#)param.h 8.1 (Berkeley) 6/10/93
*/
-#ifndef _MIPS64_PARAM_H_
-#define _MIPS64_PARAM_H_
+#ifndef _MIPS64_PARAM_H_
+#define _MIPS64_PARAM_H_
#ifdef _KERNEL
#include <machine/cpu.h>
@@ -48,60 +45,46 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#define NBPG PAGE_SIZE
-#define PGOFSET PAGE_MASK
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
#define PGSHIFT PAGE_SHIFT
+#define PGOFSET PAGE_MASK
#define KERNBASE 0xffffffff80000000L /* start of kernel virtual */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define USPACE (16384)
#ifdef _KERNEL
+
+#define NBPG PAGE_SIZE
+
+#define USPACE 16384
#define UPAGES (USPACE >> PAGE_SHIFT)
#if PAGE_SHIFT > 12
#define USPACE_ALIGN 0
#else
#define USPACE_ALIGN (2 * PAGE_SIZE) /* align to an even TLB boundary */
#endif
-#endif /* _KERNEL */
-/*
- * Constants related to network buffer management.
- */
#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-#ifdef _KERNEL
+#ifndef MSGBUFSIZE
#if PAGE_SHIFT > 12
#define MSGBUFSIZE PAGE_SIZE
#else
#define MSGBUFSIZE 8192
#endif
+#endif
-/* Default malloc arena size */
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
+/*
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
+ * logical pages.
+ */
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-#endif /* _KERNEL */
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-#ifdef _KERNEL
#ifndef _LOCORE
#define DELAY(n) delay(n)
void delay(int);
#endif
+
#endif /* _KERNEL */
-#endif /* !_MIPS64_PARAM_H_ */
+#endif /* _MIPS64_PARAM_H_ */
diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h
index f072a20bdd4..27b6df9881a 100644
--- a/sys/arch/mvme68k/include/cpu.h
+++ b/sys/arch/mvme68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.35 2011/11/01 21:20:55 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.36 2013/03/23 16:12:25 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -148,22 +148,22 @@ extern int iiomapsize;
/* physical memory sections for mvme141 */
#define INTIOBASE_141 (0xfff50000)
#define INTIOTOP_141 (0xfffc0000)
-#define INTIOSIZE_141 ((INTIOTOP_141-INTIOBASE_141)/NBPG)
+#define INTIOSIZE_141 ((INTIOTOP_141-INTIOBASE_141)/PAGE_SIZE)
/* physical memory sections for mvme147 */
#define INTIOBASE_147 (0xfffe0000)
#define INTIOTOP_147 (0xfffe5000)
-#define INTIOSIZE_147 ((INTIOTOP_147-INTIOBASE_147)/NBPG)
+#define INTIOSIZE_147 ((INTIOTOP_147-INTIOBASE_147)/PAGE_SIZE)
/* physical memory sections for mvme16x */
#define INTIOBASE_162 (0xfff00000)
#define INTIOTOP_162 (0xfffd0000) /* was 0xfff50000 */
-#define INTIOSIZE_162 ((INTIOTOP_162-INTIOBASE_162)/NBPG)
+#define INTIOSIZE_162 ((INTIOTOP_162-INTIOBASE_162)/PAGE_SIZE)
/* physical memory sections for mvme165 */
#define INTIOBASE_165 (0xfff90000)
#define INTIOTOP_165 (0xffff0000)
-#define INTIOSIZE_165 ((INTIOTOP_165-INTIOBASE_165)/NBPG)
+#define INTIOSIZE_165 ((INTIOTOP_165-INTIOBASE_165)/PAGE_SIZE)
/*
* Internal IO space (iiomapsize).
diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h
index cf5cfe38864..d95b7198a0c 100644
--- a/sys/arch/mvme68k/include/param.h
+++ b/sys/arch/mvme68k/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.21 2006/06/11 20:48:13 miod Exp $ */
+/* $OpenBSD: param.h,v 1.22 2013/03/23 16:12:25 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -32,18 +32,11 @@
* 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: machparam.h 1.16 92/12/20$
- *
- * @(#)param.h 8.1 (Berkeley) 6/10/93
*/
-#ifndef _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * Machine dependent constants for mvme68k, based on HP9000 series 300.
- */
#define _MACHINE "mvme68k"
#define MACHINE "mvme68k"
@@ -52,7 +45,7 @@
#define KERNBASE 0x00000000 /* start of kernel virtual */
#define KERNTEXTOFF 0x00010000 /* start of kernel text */
-#define MSGBUFSIZE 4096
+#define MSGBUFSIZE 4096
#include <m68k/param.h>
@@ -61,4 +54,4 @@ extern void delay(int);
#define DELAY(n) delay(n)
#endif /* _KERNEL && !_LOCORE */
-#endif /* _MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/mvme88k/include/param.h b/sys/arch/mvme88k/include/param.h
index bd2cac3cdaf..7cda9b12992 100644
--- a/sys/arch/mvme88k/include/param.h
+++ b/sys/arch/mvme88k/include/param.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: param.h,v 1.40 2008/09/19 20:18:01 miod Exp $ */
+/* $OpenBSD: param.h,v 1.41 2013/03/23 16:12:25 deraadt Exp $ */
+
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -32,17 +33,13 @@
* 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: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 7.8 (Berkeley) 6/28/91
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
-#define _MACHINE mvme88k
-#define MACHINE "mvme88k"
+#define _MACHINE mvme88k
+#define MACHINE "mvme88k"
#include <m88k/param.h>
@@ -50,7 +47,7 @@
* The Bug uses the bottom 64KB. The kernel will allocate PTEs to map this
* space, but the kernel must be linked with a start address past these 64KB.
*/
-#define KERNBASE 0x00000000 /* start of kernel virtual */
+#define KERNBASE 0x00000000 /* start of kernel virtual */
#define KERNTEXTOFF 0x00010000 /* start of kernel text */
#if defined(_KERNEL) || defined(_STANDALONE)
@@ -67,4 +64,5 @@ extern int brdtyp;
#define BRD_8120 0x8120
#endif /* _KERNEL || _STANDALONE */
-#endif /* !_MACHINE_PARAM_H_ */
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/octeon/include/param.h b/sys/arch/octeon/include/param.h
index 8fb5164ec3a..e5cab7ef18b 100644
--- a/sys/arch/octeon/include/param.h
+++ b/sys/arch/octeon/include/param.h
@@ -1,18 +1,18 @@
-/* $OpenBSD: param.h,v 1.3 2011/06/25 19:38:47 miod Exp $ */
-/* public domain */
+/* $OpenBSD: param.h,v 1.4 2013/03/23 16:12:26 deraadt Exp $ */
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+/* Public Domain */
+
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#define MACHINE "octeon"
#define _MACHINE octeon
-#define MACHINE_ARCH "mips64"
-#define _MACHINE_ARCH mips64
-
-#define MID_MACHINE MID_MIPS64
+#define MACHINE_ARCH "mips64"
+#define _MACHINE_ARCH mips64
+#define MID_MACHINE MID_MIPS64
#define PAGE_SHIFT 14
#include <mips64/param.h>
-#endif /* _MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/palm/include/param.h b/sys/arch/palm/include/param.h
index f31b8ad1163..4784d668343 100644
--- a/sys/arch/palm/include/param.h
+++ b/sys/arch/palm/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.2 2011/03/23 16:54:36 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:26 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,11 +35,8 @@
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * 1 page should be enough
- */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1*NBPG)
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE PAGE_SIZE
#endif
#include <arm/param.h>
@@ -48,4 +44,4 @@
#define _MACHINE palm
#define MACHINE "palm"
-#endif /* _MACHINE_PARAM_H_ */
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h
index 6f8337d2bcc..3b8fcd3bf71 100644
--- a/sys/arch/powerpc/include/param.h
+++ b/sys/arch/powerpc/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.32 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
+/* $OpenBSD: param.h,v 1.33 2013/03/23 16:12:26 deraadt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -41,12 +40,8 @@
#endif /* _LOCORE */
#endif
-/*
- * Machine dependent constants for PowerPC (32-bit only currently)
- */
#define MACHINE_ARCH "powerpc"
#define _MACHINE_ARCH powerpc
-
#define MID_MACHINE MID_POWERPC
#define ALIGNBYTES _ALIGNBYTES
@@ -54,50 +49,26 @@
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SHIFT 12
-#define PAGE_SIZE 4096
+#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
#define PGSHIFT PAGE_SHIFT
-#define NBPG PAGE_SIZE
#define PGOFSET PAGE_MASK
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define UPAGES 4
-#define USPACE (UPAGES * NBPG)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
-
-/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
- * logical pages.
- */
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
+#ifdef _KERNEL
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#define NBPG PAGE_SIZE
-/*
- * pages ("clicks") to disk blocks
- */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
+#define UPAGES 4 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-/*
- * bytes to disk blocks
- */
-#define dbtob(x) ((x) << DEV_BSHIFT)
-#define btodb(x) ((x) >> DEV_BSHIFT)
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
/*
- * Segment handling stuff
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
+ * logical pages.
*/
-#define PPC_SEGMENT_LENGTH 0x10000000
-#define PPC_SEGMENT_MASK 0xf0000000
+#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
/*
* Fixed segments
@@ -109,15 +80,10 @@
#define PPC_USER_ADDR ((void *)(PPC_USER_SR << ADDR_SR_SHIFT))
/*
- * Some system constants
- */
-#ifndef NPMAPS
-#define NPMAPS 32768 /* Number of pmaps in system */
-#endif
-
-/*
* Temporary kludge till we do (ov)bcopy in assembler
*/
#define ovbcopy bcopy
-#endif /* _POWERPC_PARAM_H_ */
+#endif /* _KERNEL */
+
+#endif /* _POWERPC_PARAM_H_ */
diff --git a/sys/arch/powerpc/include/pmap.h b/sys/arch/powerpc/include/pmap.h
index ab30385ce46..03ae397f4d7 100644
--- a/sys/arch/powerpc/include/pmap.h
+++ b/sys/arch/powerpc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.48 2012/08/30 18:14:26 mpi Exp $ */
+/* $OpenBSD: pmap.h,v 1.49 2013/03/23 16:12:26 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */
/*-
@@ -94,6 +94,19 @@ struct pmap {
struct pmap_statistics pm_stats; /* pmap statistics */
};
+/*
+ * Segment handling stuff
+ */
+#define PPC_SEGMENT_LENGTH 0x10000000
+#define PPC_SEGMENT_MASK 0xf0000000
+
+/*
+ * Some system constants
+ */
+#ifndef NPMAPS
+#define NPMAPS 32768 /* Number of pmaps in system */
+#endif
+
typedef struct pmap *pmap_t;
extern struct pmap kernel_pmap_;
diff --git a/sys/arch/sgi/include/param.h b/sys/arch/sgi/include/param.h
index fd4951f97f6..900b9f8ed44 100644
--- a/sys/arch/sgi/include/param.h
+++ b/sys/arch/sgi/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.6 2012/03/19 19:11:26 miod Exp $ */
+/* $OpenBSD: param.h,v 1.7 2013/03/23 16:12:26 deraadt Exp $ */
/*
* Copyright (c) 2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -23,21 +23,16 @@
* 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.
- *
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
-/*
- * Machine dependent constants.
- */
#define MACHINE "sgi"
#define _MACHINE sgi
-#define MACHINE_ARCH "mips64"
-#define _MACHINE_ARCH mips64
-
-#define MID_MACHINE MID_MIPS64 /* None but has to be defined */
+#define MACHINE_ARCH "mips64"
+#define _MACHINE_ARCH mips64
+#define MID_MACHINE MID_MIPS64 /* None but has to be defined */
#ifdef _KERNEL
#ifndef PAGE_SHIFT
diff --git a/sys/arch/sh/include/param.h b/sys/arch/sh/include/param.h
index 03f39929a21..0fad8b987df 100644
--- a/sys/arch/sh/include/param.h
+++ b/sys/arch/sh/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.8 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.15 2006/08/28 13:43:35 yamt Exp $ */
+/* $OpenBSD: param.h,v 1.9 2013/03/23 16:12:27 deraadt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -32,15 +31,9 @@
* 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.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
- */
-
-/*
- * SuperH dependent constants.
*/
-#ifndef _SH_PARAM_H_
+#ifndef _SH_PARAM_H_
#define _SH_PARAM_H_
#define _MACHINE_ARCH sh
@@ -54,6 +47,10 @@
#include <sh/cpu.h>
#endif
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
+
/*
* We use 4K pages on the sh3/sh4. Override the PAGE_* definitions
* to be compile-time constants.
@@ -61,26 +58,22 @@
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
-
#define PGSHIFT PAGE_SHIFT
-#define NBPG PAGE_SIZE
#define PGOFSET PAGE_MASK
-#define ALIGNBYTES _ALIGNBYTES
-#define ALIGN(p) _ALIGN(p)
-#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
+#ifdef _KERNEL
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#define NBPG PAGE_SIZE
+
+#endif
/*
* u-space.
*/
-#define UPAGES 3 /* pages of u-area */
-#define USPACE (UPAGES * NBPG) /* total size of u-area */
+#define UPAGES 3 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
#define USPACE_ALIGN (0)
+
#if UPAGES == 1
#error "too small u-area"
#elif UPAGES == 2
@@ -89,28 +82,20 @@
#undef P1_STACK /* kernel stack is P3-area */
#endif
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE NBPG /* default message buffer size */
-#endif
-
-/* pages to disk blocks */
-#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
+#ifdef _KERNEL
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE PAGE_SIZE /* default message buffer size */
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
-#endif /* !_SH_PARAM_H_ */
+#endif /* _KERNEL */
+
+#endif /* _SH_PARAM_H_ */
diff --git a/sys/arch/socppc/include/param.h b/sys/arch/socppc/include/param.h
index 161ce9f6e9c..830d9212430 100644
--- a/sys/arch/socppc/include/param.h
+++ b/sys/arch/socppc/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */
-/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
+/* $OpenBSD: param.h,v 1.2 2013/03/23 16:12:27 deraadt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,6 +31,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
#ifdef _KERNEL
#ifndef _LOCORE
#include <machine/cpu.h>
@@ -40,12 +42,13 @@
#include <powerpc/param.h>
-/*
- * Machine dependent constants for socppc
- */
#define MACHINE "socppc"
#define _MACHINE socppc
#define KERNBASE 0x200000
-#define MSGBUFSIZE (NBPG*2)
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (2 * PAGE_SIZE)
+#endif
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/solbourne/include/param.h b/sys/arch/solbourne/include/param.h
index 5ae0c528f8e..aeb17b1e503 100644
--- a/sys/arch/solbourne/include/param.h
+++ b/sys/arch/solbourne/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.10 2011/09/08 03:40:32 guenther Exp $ */
-/* OpenBSD: param.h,v 1.29 2004/08/06 22:31:31 mickey Exp */
+/* $OpenBSD: param.h,v 1.11 2013/03/23 16:12:27 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -37,18 +36,10 @@
* 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.
- *
- * @(#)param.h 8.1 (Berkeley) 6/11/93
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE solbourne
-#define MACHINE "solbourne"
-#define _MACHINE_ARCH sparc
-#define MACHINE_ARCH "sparc"
-#define MID_MACHINE MID_SPARC
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#ifdef _KERNEL /* XXX */
#ifndef _LOCORE /* XXX */
@@ -56,47 +47,47 @@
#endif /* XXX */
#endif /* XXX */
+#define _MACHINE solbourne
+#define MACHINE "solbourne"
+#define _MACHINE_ARCH sparc
+#define MACHINE_ARCH "sparc"
+#define MID_MACHINE MID_SPARC
+
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define SUN4_PGSHIFT 13 /* for a sun4 machine */
-#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
+#define SUN4_PGSHIFT 13 /* for a sun4 machine */
+#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
+#define PAGE_SHIFT SUN4_PGSHIFT
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
#define KERNBASE 0xfd080000
+
+#ifdef _KERNEL
+
#define KERNTEXTOFF 0xfd084000 /* start of kernel text */
+#define MSGBUF_PA PTW1_TO_PHYS(KERNBASE) /* msgbuf physical address */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024)
+#define NBPG PAGE_SIZE /* bytes/page */
-#define USPACE 8192
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define UPAGES 1
+#define USPACE 8192 /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-/*
- * Constants related to network buffer management.
- */
#define NMBCLUSTERS 2048 /* map size, max cluster allocation */
-#define MSGBUFSIZE PAGE_SIZE /* larger than on sparc! */
-#define MSGBUF_PA PTW1_TO_PHYS(KERNBASE) /* msgbuf physical address */
+#define MSGBUFSIZE (1 * PAGE_SIZE) /* larger than on sparc! */
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
/*
* dvmamap manages a range of DVMA addresses intended to create double
* mappings of physical memory. In a way, `dvmamap' is a submap of the
@@ -107,7 +98,6 @@
* Note that `phys_map' can still be used to allocate memory-backed pages
* in DVMA space.
*/
-#ifdef _KERNEL
#ifndef _LOCORE
extern vaddr_t dvma_base;
extern vaddr_t dvma_end;
@@ -122,13 +112,8 @@ extern void delay(unsigned int);
#define DELAY(n) delay(n)
extern int cputyp;
-#if 0
-extern int cpumod;
-extern int mmumod;
-#endif
#endif /* _LOCORE */
-#endif /* _KERNEL */
/*
* Values for the cputyp variable.
@@ -145,11 +130,7 @@ extern int mmumod;
#define CPU_ISSUN4OR4C (0)
#define CPU_ISSUN4COR4M (0)
#define CPU_ISKAP (1)
-#define NBPG 8192
-#define PGOFSET (NBPG - 1)
-#define PGSHIFT SUN4_PGSHIFT
-#define PAGE_SIZE 8192
-#define PAGE_MASK (PAGE_SIZE - 1)
-#define PAGE_SHIFT SUN4_PGSHIFT
+
+#endif /* _KERNEL */
#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index c06665e4770..6ac866d355f 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.46 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */
+/* $OpenBSD: param.h,v 1.47 2013/03/23 16:12:27 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -37,12 +36,16 @@
* 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.
- *
- * @(#)param.h 8.1 (Berkeley) 6/11/93
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+#ifdef _KERNEL /* XXX */
+#ifndef _LOCORE /* XXX */
+#include <machine/cpu.h> /* XXX */
+#endif /* XXX */
+#endif /* XXX */
/*
* Sun4M support by Aaron Brown, Harvard University.
@@ -55,53 +58,65 @@
#define MACHINE_ARCH "sparc"
#define MID_MACHINE MID_SPARC
-#ifdef _KERNEL /* XXX */
-#ifndef _LOCORE /* XXX */
-#include <machine/cpu.h> /* XXX */
-#endif /* XXX */
-#endif /* XXX */
-
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define SUN4_PGSHIFT 13 /* for a sun4 machine */
-#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
+/*
+ * The original SUN4 machines have 8K page size while the newer ones have a
+ * 4K page size. It is possible to build a kernel for either architecture,
+ * or have the page size be dynamically handled (via uvmexp variables) at
+ * run time.
+ */
+#define SUN4_PGSHIFT 13 /* for a sun4 machine */
+#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
+#if (defined(SUN4) || defined(SUN4E)) && \
+ !(defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
+# define PAGE_SHIFT SUN4_PGSHIFT
+# define PAGE_SIZE (1 << PAGE_SHIFT)
+# define PAGE_MASK (PAGE_SIZE - 1)
+#elif (defined(SUN4C) || defined(SUN4D) || defined(SUN4M)) && \
+ !(defined(SUN4) || defined(SUN4E))
+# define PAGE_SHIFT SUN4CM_PGSHIFT
+# define PAGE_SIZE (1 << PAGE_SHIFT)
+# define PAGE_MASK (PAGE_SIZE - 1)
+#elif defined(STANDALONE) /* boot blocks */
+# define PAGE_SHIFT pgshift
+# define PAGE_SIZE nbpg
+# define PAGE_MASK pgofset
+#else
+# define PAGE_SHIFT uvmexp.pageshift
+# define PAGE_SIZE uvmexp.pagesize
+# define PAGE_MASK uvmexp.pagemask
+#endif
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
-#define KERNBASE 0xf8000000 /* start of kernel virtual space */
-#define KERNTEXTOFF 0xf8004000 /* start of kernel text */
+#define KERNBASE 0xf8000000
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024)
+#ifdef _KERNEL
-#define USPACE 8192
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define KERNTEXTOFF 0xf8004000 /* start of kernel text */
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 2048 /* map size, max cluster allocation */
+#define NBPG PAGE_SIZE /* bytes/page */
+
+/*#define UPAGES depends on machine model */
+#define USPACE 8192 /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#define MSGBUFSIZE 4096 /* cannot be changed without great pain */
+#define NMBCLUSTERS 2048 /* map size, max cluster allocation */
+
+/* cannot be changed without great pain */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE 4096 /* default message buffer size */
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-#ifdef _KERNEL
#ifndef _LOCORE
extern vaddr_t dvma_base;
extern vaddr_t dvma_end;
@@ -116,22 +131,20 @@ extern void delay(unsigned int);
#define DELAY(n) delay(n)
extern int cputyp;
-#if 0
-extern int cpumod;
-extern int mmumod;
-#endif
#endif /* _LOCORE */
+
#endif /* _KERNEL */
/*
* Values for the cputyp variable. Order is important!
+ * needed by locore, and libkvm
*/
-#define CPU_SUN4 0
+#define CPU_SUN4 0
#define CPU_SUN4E 1
-#define CPU_SUN4C 2
-#define CPU_SUN4M 3
-#define CPU_SUN4D 4
+#define CPU_SUN4C 2
+#define CPU_SUN4M 3
+#define CPU_SUN4D 4
/*
* Shorthand CPU-type macros. Enumerate all eight cases.
@@ -146,103 +159,80 @@ extern int mmumod;
* involving variables, the kernel will perform slightly worse due to the
* extra memory references they'll generate.
*/
-#if (defined(SUN4) || defined(SUN4E)) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
-# define PAGE_SIZE 8192
-# define PAGE_MASK (PAGE_SIZE - 1)
-# define PAGE_SHIFT SUN4_PGSHIFT
-#elif (defined(SUN4C) || defined(SUN4D) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4E))
-# define PAGE_SIZE 4096
-# define PAGE_MASK (PAGE_SIZE - 1)
-# define PAGE_SHIFT SUN4CM_PGSHIFT
-#else
-#ifdef STANDALONE /* boot blocks */
-# define PAGE_SIZE nbpg
-# define PAGE_MASK pgofset
-# define PAGE_SHIFT pgshift
-#else
-# define PAGE_SIZE uvmexp.pagesize
-# define PAGE_MASK uvmexp.pagemask
-# define PAGE_SHIFT uvmexp.pageshift
-#endif
-#endif
-# define NBPG PAGE_SIZE
-# define PGOFSET PAGE_MASK
-# define PGSHIFT PAGE_SHIFT
-
#if defined(SUN4) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
-# define CPU_ISSUN4 (1)
+# define CPU_ISSUN4 (1)
#elif defined(SUN4C) && !(defined(SUN4) || defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
-# define CPU_ISSUN4C (1)
+# define CPU_ISSUN4C (1)
#elif defined(SUN4D) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4E) || defined(SUN4M))
-# define CPU_ISSUN4D (1)
+# define CPU_ISSUN4D (1)
#elif defined(SUN4E) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
-# define CPU_ISSUN4E (1)
+# define CPU_ISSUN4E (1)
#elif defined(SUN4M) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4D) || defined(SUN4E))
-# define CPU_ISSUN4M (1)
+# define CPU_ISSUN4M (1)
#elif (defined(SUN4) || defined(SUN4C)) && !(defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
-# define CPU_ISSUN4OR4C (1)
+# define CPU_ISSUN4OR4C (1)
#elif (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && !(defined(SUN4D) || defined(SUN4M))
-# define CPU_ISSUN4OR4COR4E (1)
+# define CPU_ISSUN4OR4COR4E (1)
#elif (defined(SUN4) || defined(SUN4E)) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
-# define CPU_ISSUN4OR4E (1)
+# define CPU_ISSUN4OR4E (1)
#elif (defined(SUN4C) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4D) || defined(SUN4E))
-# define CPU_ISSUN4COR4M (1)
+# define CPU_ISSUN4COR4M (1)
#elif (defined(SUN4D) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4E))
-# define CPU_ISSUN4DOR4M (1)
+# define CPU_ISSUN4DOR4M (1)
#endif
#if !defined(CPU_ISSUN4)
#if defined(SUN4)
-# define CPU_ISSUN4 (cputyp == CPU_SUN4)
+# define CPU_ISSUN4 (cputyp == CPU_SUN4)
#else
-# define CPU_ISSUN4 (0)
+# define CPU_ISSUN4 (0)
#endif
#endif
#if !defined(CPU_ISSUN4C)
#if defined(SUN4C)
-# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
+# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
#else
-# define CPU_ISSUN4C (0)
+# define CPU_ISSUN4C (0)
#endif
#endif
#if !defined(CPU_ISSUN4D)
#if defined(SUN4D)
-# define CPU_ISSUN4D (cputyp == CPU_SUN4D)
+# define CPU_ISSUN4D (cputyp == CPU_SUN4D)
#else
-# define CPU_ISSUN4D (0)
+# define CPU_ISSUN4D (0)
#endif
#endif
#if !defined(CPU_ISSUN4E)
#if defined(SUN4E)
-# define CPU_ISSUN4E (cputyp == CPU_SUN4E)
+# define CPU_ISSUN4E (cputyp == CPU_SUN4E)
#else
-# define CPU_ISSUN4E (0)
+# define CPU_ISSUN4E (0)
#endif
#endif
#if !defined(CPU_ISSUN4M)
#if defined(SUN4M)
-# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
+# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
#else
-# define CPU_ISSUN4M (0)
+# define CPU_ISSUN4M (0)
#endif
#endif
#if !defined(CPU_ISSUN4OR4C)
-# define CPU_ISSUN4OR4C (CPU_ISSUN4 || CPU_ISSUN4C)
+# define CPU_ISSUN4OR4C (CPU_ISSUN4 || CPU_ISSUN4C)
#endif
#if !defined(CPU_ISSUN4OR4E)
-# define CPU_ISSUN4OR4E (cputyp <= CPU_SUN4E)
+# define CPU_ISSUN4OR4E (cputyp <= CPU_SUN4E)
/* (CPU_ISSUN4 || CPU_ISSUN4E) */
#endif
#if !defined(CPU_ISSUN4OR4COR4E)
-# define CPU_ISSUN4OR4COR4E (cputyp <= CPU_SUN4C)
+# define CPU_ISSUN4OR4COR4E (cputyp <= CPU_SUN4C)
/* (CPU_ISSUN4 || CPU_ISSUN4C || CPU_ISSUN4E) */
#endif
#if !defined(CPU_ISSUN4COR4M)
-# define CPU_ISSUN4COR4M (CPU_ISSUN4C || CPU_ISSUN4M)
+# define CPU_ISSUN4COR4M (CPU_ISSUN4C || CPU_ISSUN4M)
#endif
#if !defined(CPU_ISSUN4DOR4M)
-# define CPU_ISSUN4DOR4M (cputyp >= CPU_SUN4M)
+# define CPU_ISSUN4DOR4M (cputyp >= CPU_SUN4M)
/* (CPU_ISSUN4D || CPU_ISSUN4M) */
#endif
diff --git a/sys/arch/sparc/include/pte.h b/sys/arch/sparc/include/pte.h
index cd43462a1d2..f8f72e0b3c4 100644
--- a/sys/arch/sparc/include/pte.h
+++ b/sys/arch/sparc/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.8 2010/07/10 19:32:24 miod Exp $ */
+/* $OpenBSD: pte.h,v 1.9 2013/03/23 16:12:27 deraadt Exp $ */
/* $NetBSD: pte.h,v 1.19 1997/08/05 11:00:10 pk Exp $ */
/*
@@ -195,7 +195,7 @@ typedef u_char smeg_t; /* 8 bits needed per Sun-4 regmap entry */
extern int nptesg;
#define NPTESG nptesg /* (which someone will have to initialize) */
#else
-#define NPTESG (NBPSG / NBPG)
+#define NPTESG (NBPSG / PAGE_SIZE)
#endif
/* virtual address to virtual region number */
diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h
index 3e1b685677c..4e2bd923ed8 100644
--- a/sys/arch/sparc64/include/param.h
+++ b/sys/arch/sparc64/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.36 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */
+/* $OpenBSD: param.h,v 1.37 2013/03/23 16:12:28 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -37,8 +36,6 @@
* 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.
- *
- * @(#)param.h 8.1 (Berkeley) 6/11/93
*/
/*
@@ -49,7 +46,7 @@
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -64,8 +61,8 @@
*
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#define _MACHINE sparc64
#define MACHINE "sparc64"
@@ -77,20 +74,15 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024)
-
-/* We get stack overflows w/8K stacks in 64-bit mode */
-#define UPAGES 2 /* initial stack size in pages */
-#define USPACE (UPAGES*8192)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
-
+#define PAGE_SHIFT 13
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
/*
* Here are all the magic kernel virtual addresses and how they're allocated.
- *
+ *
* First, the PROM is usually a fixed-sized block from 0x00000000f0000000 to
* 0x00000000f0100000. It also uses some space around 0x00000000fff00000 to
* map in device registers. The rest is pretty much ours to play with.
@@ -105,7 +97,7 @@
* 0x0000000000000000: 64K NFO page zero
* 0x0000000000010000: Userland or PROM
* KERNBASE: 4MB kernel text and read only data
- * This is mapped in the ITLB and
+ * This is mapped in the ITLB and
* Read-Only in the DTLB
* KERNBASE+0x400000: 4MB kernel data and BSS -- not in ITLB
* Contains context table, kernel pmap,
@@ -124,9 +116,12 @@
*
*/
#define KERNBASE 0x001000000 /* start of kernel virtual space */
+
+#ifdef _KERNEL
+
#define KERNEND 0x0e0000000 /* end of kernel virtual space */
-#define _MAXNBPG 8192 /* fixed VAs, independent of actual NBPG */
+#define _MAXNBPG 8192 /* fixed VAs, independent of actual NBPG */
#define AUXREG_VA ( KERNEND + _MAXNBPG) /* 1 page REDZONE */
#define TMPMAP_VA ( AUXREG_VA + _MAXNBPG)
@@ -134,33 +129,28 @@
/*
* Here's the location of the interrupt stack and CPU structure.
*/
-#define INTSTACK ( KERNEND + 8*_MAXNBPG)/* 64K after kernel end */
+#define INTSTACK ( KERNEND + 8*_MAXNBPG)/* 64K after kernel end */
#define EINTSTACK ( INTSTACK + 2*USPACE) /* 32KB */
#define CPUINFO_VA ( EINTSTACK)
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+#define NBPG PAGE_SIZE /* bytes/page */
+
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-#define MSGBUFSIZE NBPG
+#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
+
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (1 * PAGE_SIZE)
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-#ifdef _KERNEL
#ifndef _LOCORE
extern void delay(unsigned int);
@@ -169,44 +159,35 @@ extern void delay(unsigned int);
extern int cputyp;
#if defined (SUN4US) || defined (SUN4V)
-#define CPU_ISSUN4U (cputyp == CPU_SUN4U)
-#define CPU_ISSUN4US (cputyp == CPU_SUN4US)
-#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
+#define CPU_ISSUN4U (cputyp == CPU_SUN4U)
+#define CPU_ISSUN4US (cputyp == CPU_SUN4US)
+#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
#else
-#define CPU_ISSUN4U (1)
-#define CPU_ISSUN4US (0)
-#define CPU_ISSUN4V (0)
+#define CPU_ISSUN4U (1)
+#define CPU_ISSUN4US (0)
+#define CPU_ISSUN4V (0)
#endif
#endif /* _LOCORE */
-#endif /* _KERNEL */
/*
* Values for the cputyp variable.
*/
-#define CPU_SUN4 0
-#define CPU_SUN4C 1
-#define CPU_SUN4M 2
-#define CPU_SUN4U 3
-#define CPU_SUN4US 4
-#define CPU_SUN4V 5
+#define CPU_SUN4 0
+#define CPU_SUN4C 1
+#define CPU_SUN4M 2
+#define CPU_SUN4U 3
+#define CPU_SUN4US 4
+#define CPU_SUN4V 5
/*
* On a sun4u machine, the page size is 8192.
*/
-#define NBPG 8192 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 13 /* log2(NBPG) */
-
-#define PAGE_SHIFT 13
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#ifdef _KERNEL
#ifndef _LOCORE
#include <machine/cpu.h>
#endif
-#endif
-#endif /* _MACHINE_PARAM_H_ */
+#endif /* _KERNEL */
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h
index 31d986e8e44..ff566de25a6 100644
--- a/sys/arch/sparc64/include/pmap.h
+++ b/sys/arch/sparc64/include/pmap.h
@@ -72,7 +72,7 @@
#define HOLESHIFT (43)
-#define PTSZ (NBPG/8)
+#define PTSZ (PAGE_SIZE/8)
#define PDSZ (PTSZ)
#define STSZ (PTSZ)
diff --git a/sys/arch/vax/include/macros.h b/sys/arch/vax/include/macros.h
index 05f22ba8551..4ecfcca2af6 100644
--- a/sys/arch/vax/include/macros.h
+++ b/sys/arch/vax/include/macros.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: macros.h,v 1.18 2012/11/25 22:35:19 miod Exp $ */
+/* $OpenBSD: macros.h,v 1.19 2013/03/23 16:12:28 deraadt Exp $ */
/* $NetBSD: macros.h,v 1.20 2000/07/19 01:02:52 matt Exp $ */
/*
@@ -64,6 +64,7 @@ strlen(const char *cp)
return ret;
}
+#if 0
static __inline__ char *
strncat(char *cp, const char *c2, size_t count)
{
@@ -74,6 +75,7 @@ strncat(char *cp, const char *c2, size_t count)
: "r0","r1","r2","r3","r4","r5","memory","cc");
return cp;
}
+#endif
static __inline__ char *
strncpy(char *cp, const char *c2, size_t len)
diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h
index 6373bca8f23..efabbcf393a 100644
--- a/sys/arch/vax/include/param.h
+++ b/sys/arch/vax/include/param.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: param.h,v 1.37 2011/09/08 03:40:32 guenther Exp $ */
-/* $NetBSD: param.h,v 1.39 1999/10/22 21:14:34 ragge Exp $ */
+/* $OpenBSD: param.h,v 1.38 2013/03/23 16:12:28 deraadt Exp $ */
+
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -30,16 +30,10 @@
* 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.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
*/
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-/*
- * Machine dependent constants for VAX.
- */
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
#define _MACHINE vax
#define MACHINE "vax"
@@ -51,13 +45,11 @@
#define ALIGN(p) _ALIGN(p)
#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NBPG (1 << PGSHIFT) /* (1 << PGSHIFT) bytes/page */
-#define PGOFSET (NBPG - 1) /* byte offset into page */
-
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
+#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
+#define PGOFSET PAGE_MASK /* byte offset into page */
#define VAX_PGSHIFT 9
#define VAX_NBPG (1 << VAX_PGSHIFT)
@@ -66,53 +58,32 @@
#define KERNBASE 0x80000000 /* start of kernel virtual */
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
+#ifdef _KERNEL
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-#define MAXBSIZE 0x4000 /* max FS block size - XXX */
+#define NBPG PAGE_SIZE /* bytes/page */
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (NBPG*UPAGES)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
-#define REDZONEADDR (VAX_NBPG*3) /* Must be > sizeof(struct user) */
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE)
+#define USPACE_ALIGN (0) /* u-area alignment 0-none */
+#define REDZONEADDR (VAX_NBPG*3) /* Must be > sizeof(struct user) */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE 8192 /* default message buffer size */
-#endif
+#define NMBCLUSTERS 768 /* map size, max cluster allocation */
-/*
- * Constants related to network buffer management.
- */
-#define NMBCLUSTERS 768 /* map size, max cluster allocation */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (2 * PAGE_SIZE) /* default message buffer size */
+#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
-/*
- * Some macros for units conversion
- */
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
/* MD conversion macros */
#define vax_atop(x) (((unsigned)(x) + VAX_PGOFSET) >> VAX_PGSHIFT)
#define vax_btop(x) (((unsigned)(x)) >> VAX_PGSHIFT)
-#define ovbcopy(x,y,z) bcopy(x, y, z)
-
-#ifdef _KERNEL
+#define ovbcopy(x,y,z) bcopy(x, y, z)
#include <machine/intr.h>
diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h
index 3bcefd8c0b5..6ebc1c02056 100644
--- a/sys/arch/vax/include/vmparam.h
+++ b/sys/arch/vax/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.31 2011/05/30 22:25:23 oga Exp $ */
+/* $OpenBSD: vmparam.h,v 1.32 2013/03/23 16:12:28 deraadt Exp $ */
/* $NetBSD: vmparam.h,v 1.32 2000/03/07 00:05:59 matt Exp $ */
/*-
@@ -49,7 +49,7 @@
* resides kernel.
* */
-#define USRTEXT NBPG
+#define USRTEXT PAGE_SIZE
#define USRSTACK KERNBASE
/*
diff --git a/sys/arch/zaurus/include/param.h b/sys/arch/zaurus/include/param.h
index 11fba7cfedd..e7a26920266 100644
--- a/sys/arch/zaurus/include/param.h
+++ b/sys/arch/zaurus/include/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.5 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.6 2013/03/23 16:12:28 deraadt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -36,16 +35,13 @@
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
-/*
- * 1 page should be enough
- */
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1*NBPG)
-#endif
-
#include <arm/param.h>
#define _MACHINE zaurus
#define MACHINE "zaurus"
-#endif /* _MACHINE_PARAM_H_ */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (1 * PAGE_SIZE)
+#endif
+
+#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index 04144461ad8..7923308e493 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.h,v 1.101 2013/02/07 11:06:42 mikeb Exp $ */
+/* $OpenBSD: malloc.h,v 1.102 2013/03/23 16:12:30 deraadt Exp $ */
/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
/*
@@ -353,15 +353,33 @@ struct kmembuckets {
u_int64_t kb_couldfree; /* over high water mark and could free */
};
+/*
+ * Constants for setting the parameters of the kernel memory allocator.
+ *
+ * 2 ** MINBUCKET is the smallest unit of memory that will be
+ * allocated. It must be at least large enough to hold a pointer.
+ *
+ * Units of memory less or equal to MAXALLOCSAVE will permanently
+ * allocate physical memory; requests for these size pieces of
+ * memory are quite fast. Allocations greater than MAXALLOCSAVE must
+ * always allocate and free physical memory; requests for these
+ * size allocations should be done infrequently as they will be slow.
+ *
+ * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
+ * MAXALLOCSIZE must be a power of two.
+ */
+#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
+
#ifdef _KERNEL
#define MINALLOCSIZE (1 << MINBUCKET)
+#define MAXALLOCSAVE (2 * PAGE_SIZE)
/*
* Turn virtual addresses into kmem map indices
*/
-#define kmemxtob(alloc) (kmembase + (alloc) * NBPG)
-#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG)
+#define kmemxtob(alloc) (kmembase + (alloc) * PAGE_SIZE)
+#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / PAGE_SIZE)
#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> PAGE_SHIFT])
extern struct kmemstats kmemstats[];
diff --git a/sys/sys/param.h b/sys/sys/param.h
index a8862def9bc..9fb05adbac1 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: param.h,v 1.101 2013/01/31 23:30:40 miod Exp $ */
-/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.102 2013/03/23 16:12:30 deraadt Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -33,10 +32,11 @@
* 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.
- *
- * @(#)param.h 8.2 (Berkeley) 1/21/94
*/
+#ifndef _SYS_PARAM_H_
+#define _SYS_PARAM_H_
+
#define BSD 199306 /* System version (year & month). */
#define BSD4_3 1
#define BSD4_4 1
@@ -92,6 +92,7 @@
#include <sys/limits.h>
#include <machine/param.h>
+#ifdef _KERNEL
/*
* Priorities. Note that with 32 run queues, differences less than 4 are
* insignificant.
@@ -101,7 +102,9 @@
#define PINOD 8
#define PRIBIO 16
#define PVFS 20
+#endif /* _KERNEL */
#define PZERO 22 /* No longer magic, shouldn't be here. XXX */
+#ifdef _KERNEL
#define PSOCK 24
#define PWAIT 32
#define PLOCK 36
@@ -113,22 +116,27 @@
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
#define PNORELOCK 0x200 /* OR'd with pri for msleep to not reaquire
the mutex */
+#endif /* _KERNEL */
-#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
#define NODEV (dev_t)(-1) /* non-existent device */
-
+
+#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
+
/*
* Constants related to network buffer management.
- * MCLBYTES must be no larger than NBPG (the software page size), and,
+ * MCLBYTES must be no larger than PAGE_SIZE (the software page size) and,
* on machines that exchange pages of input or output buffers with mbuf
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
* of the hardware page size.
*/
#define MSIZE 256 /* size of an mbuf */
+
+#ifdef _KERNEL
#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
/* 2K cluster can hold Ether frame */
#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
#define MCLOFSET (MCLBYTES - 1)
+#endif /* _KERNEL */
/*
* File system parameters and macros.
@@ -139,11 +147,35 @@
* made larger without any effect on existing file systems; however making
* it smaller makes some file systems unmountable.
*/
-#ifndef MAXBSIZE /* XXX temp until sun3 DMA chaining */
-#define MAXBSIZE MAXPHYS
-#endif
+#ifdef _KERNEL
+#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+#endif /* _KERNEL */
+#define MAXBSIZE (64 * 1024)
#define MAXFRAG 8
+#define _DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1 << _DEV_BSHIFT)
+#ifdef _KERNEL
+#define DEV_BSHIFT _DEV_BSHIFT
+#define BLKDEV_IOSIZE 2048
+#endif /* _KERNEL */
+
+/* pages to disk blocks */
+#ifndef ctod
+#define ctod(x) ((x) << (PAGE_SHIFT - _DEV_BSHIFT))
+#endif
+#ifndef dtoc
+#define dtoc(x) ((x) >> (PAGE_SHIFT - _DEV_BSHIFT))
+#endif
+
+/* bytes to disk blocks */
+#ifndef btodb
+#define btodb(x) ((x) >> _DEV_BSHIFT)
+#endif
+#ifndef dbtob
+#define dbtob(x) ((x) << _DEV_BSHIFT)
+#endif
+
/*
* MAXPATHLEN defines the longest permissible path length after expanding
* symbolic links. It is used to allocate a temporary buffer from the buffer
@@ -161,7 +193,7 @@
#define SET(t, f) ((t) |= (f))
#define CLR(t, f) ((t) &= ~(f))
#define ISSET(t, f) ((t) & (f))
-#endif
+#endif /* _KERNEL */
/* Bit map related macros. */
#define setbit(a,i) ((a)[(i)>>3] |= 1<<((i)&(NBBY-1)))
@@ -188,24 +220,6 @@
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
/*
- * Constants for setting the parameters of the kernel memory allocator.
- *
- * 2 ** MINBUCKET is the smallest unit of memory that will be
- * allocated. It must be at least large enough to hold a pointer.
- *
- * Units of memory less or equal to MAXALLOCSAVE will permanently
- * allocate physical memory; requests for these size pieces of
- * memory are quite fast. Allocations greater than MAXALLOCSAVE must
- * always allocate and free physical memory; requests for these
- * size allocations should be done infrequently as they will be slow.
- *
- * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
- * MAXALLOCSIZE must be a power of two.
- */
-#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
-#define MAXALLOCSAVE (2 * PAGE_SIZE)
-
-/*
* Scale factor for scaled integers used to count %cpu time and load avgs.
*
* The number of CPU `tick's that map to a unique `%age' can be expressed
@@ -219,13 +233,4 @@
#define FSHIFT 11 /* bits to right of fixed binary point */
#define FSCALE (1<<FSHIFT)
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
+#endif /* !_SYS_PARAM_H_ */
diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c
index 3b7a162b149..f592c8277e3 100644
--- a/sys/uvm/uvm_meter.c
+++ b/sys/uvm/uvm_meter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_meter.c,v 1.29 2010/07/22 17:31:39 thib Exp $ */
+/* $OpenBSD: uvm_meter.c,v 1.30 2013/03/23 16:12:31 deraadt Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
@@ -55,8 +55,15 @@
#endif
/*
- * maxslp: ???? XXXCDC
+ * The time for a process to be blocked before being very swappable.
+ * This is a number of seconds which the system takes as being a non-trivial
+ * amount of real time. You probably shouldn't change this;
+ * it is used in subtle ways (fractions and multiples of it are, that is, like
+ * half of a ``long time'', almost a long time, etc.)
+ * It is related to human patience and other factors which don't really
+ * change over time.
*/
+#define MAXSLP 20
int maxslp = MAXSLP; /* patchable ... */
struct loadavg averunnable;