summaryrefslogtreecommitdiff
path: root/sys/arch/hp300/include
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
commitd6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch)
treeece253b876159b39c620e62b6c9b1174642e070e /sys/arch/hp300/include
initial import of NetBSD tree
Diffstat (limited to 'sys/arch/hp300/include')
-rw-r--r--sys/arch/hp300/include/ansi.h4
-rw-r--r--sys/arch/hp300/include/asm.h3
-rw-r--r--sys/arch/hp300/include/cdefs.h8
-rw-r--r--sys/arch/hp300/include/cpu.h304
-rw-r--r--sys/arch/hp300/include/db_machdep.h4
-rw-r--r--sys/arch/hp300/include/disklabel.h46
-rw-r--r--sys/arch/hp300/include/endian.h4
-rw-r--r--sys/arch/hp300/include/exec.h78
-rw-r--r--sys/arch/hp300/include/float.h8
-rw-r--r--sys/arch/hp300/include/frame.h3
-rw-r--r--sys/arch/hp300/include/ieeefp.h4
-rw-r--r--sys/arch/hp300/include/limits.h4
-rw-r--r--sys/arch/hp300/include/mtpr.h56
-rw-r--r--sys/arch/hp300/include/param.h198
-rw-r--r--sys/arch/hp300/include/pcb.h67
-rw-r--r--sys/arch/hp300/include/pmap.h161
-rw-r--r--sys/arch/hp300/include/proc.h50
-rw-r--r--sys/arch/hp300/include/profile.h3
-rw-r--r--sys/arch/hp300/include/psl.h3
-rw-r--r--sys/arch/hp300/include/pte.h152
-rw-r--r--sys/arch/hp300/include/ptrace.h4
-rw-r--r--sys/arch/hp300/include/reg.h8
-rw-r--r--sys/arch/hp300/include/setjmp.h3
-rw-r--r--sys/arch/hp300/include/signal.h4
-rw-r--r--sys/arch/hp300/include/stdarg.h4
-rw-r--r--sys/arch/hp300/include/trap.h3
-rw-r--r--sys/arch/hp300/include/types.h10
-rw-r--r--sys/arch/hp300/include/varargs.h4
-rw-r--r--sys/arch/hp300/include/vmparam.h249
29 files changed, 1449 insertions, 0 deletions
diff --git a/sys/arch/hp300/include/ansi.h b/sys/arch/hp300/include/ansi.h
new file mode 100644
index 00000000000..7a35c82f58e
--- /dev/null
+++ b/sys/arch/hp300/include/ansi.h
@@ -0,0 +1,4 @@
+/* $NetBSD: ansi.h,v 1.4 1994/10/26 07:26:16 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/ansi.h>
diff --git a/sys/arch/hp300/include/asm.h b/sys/arch/hp300/include/asm.h
new file mode 100644
index 00000000000..a933e25f844
--- /dev/null
+++ b/sys/arch/hp300/include/asm.h
@@ -0,0 +1,3 @@
+/* $NetBSD: asm.h,v 1.2 1994/10/26 07:26:18 cgd Exp $ */
+
+#include <m68k/asm.h>
diff --git a/sys/arch/hp300/include/cdefs.h b/sys/arch/hp300/include/cdefs.h
new file mode 100644
index 00000000000..3b2ffb44b55
--- /dev/null
+++ b/sys/arch/hp300/include/cdefs.h
@@ -0,0 +1,8 @@
+/* $NetBSD: cdefs.h,v 1.1 1995/01/19 01:41:56 jtc Exp $ */
+
+#ifndef _MACHINE_CDEFS_H_
+#define _MACHINE_CDEFS_H_
+
+#include <m68k/cdefs.h>
+
+#endif
diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h
new file mode 100644
index 00000000000..5412512f98b
--- /dev/null
+++ b/sys/arch/hp300/include/cpu.h
@@ -0,0 +1,304 @@
+/* $NetBSD: cpu.h,v 1.14 1995/06/28 02:55:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: cpu.h 1.16 91/03/25$
+ *
+ * @(#)cpu.h 8.4 (Berkeley) 1/5/94
+ */
+
+/*
+ * Exported definitions unique to hp300/68k cpu support.
+ */
+
+/*
+ * definitions of cpu-dependent requirements
+ * referenced in generic code
+ */
+#define cpu_swapin(p) /* nothing */
+#define cpu_wait(p) /* nothing */
+#define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap
+#define cpu_swapout(p) /* nothing */
+
+/*
+ * Arguments to hardclock and gatherstats encapsulate the previous
+ * machine state in an opaque clockframe. One the hp300, we use
+ * what the hardware pushes on an interrupt (frame format 0).
+ */
+struct clockframe {
+ u_short sr; /* sr at time of interrupt */
+ u_long pc; /* pc at time of interrupt */
+ u_short vo; /* vector offset (4-word frame) */
+};
+
+#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
+#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0)
+#define CLKF_PC(framep) ((framep)->pc)
+#if 0
+/* We would like to do it this way... */
+#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
+#else
+/* but until we start using PSL_M, we have to do this instead */
+#define CLKF_INTR(framep) (0) /* XXX */
+#endif
+
+
+/*
+ * Preempt the current process if in interrupt from user mode,
+ * or after the current trap/syscall if in system mode.
+ */
+#define need_resched() { want_resched++; aston(); }
+
+/*
+ * Give a profiling tick to the current process when the user profiling
+ * buffer pages are invalid. On the hp300, request an ast to send us
+ * through trap, marking the proc as needing a profiling tick.
+ */
+#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
+
+/*
+ * Notify the current process (p) that it has a signal pending,
+ * process as soon as possible.
+ */
+#define signotify(p) aston()
+
+#define aston() (astpending++)
+
+int astpending; /* need to trap before returning to user mode */
+int want_resched; /* resched() was called */
+
+
+/*
+ * simulated software interrupt register
+ */
+extern unsigned char ssir;
+
+#define SIR_NET 0x1
+#define SIR_CLOCK 0x2
+
+#define siroff(x) ssir &= ~(x)
+#define setsoftnet() ssir |= SIR_NET
+#define setsoftclock() ssir |= SIR_CLOCK
+
+/*
+ * CTL_MACHDEP definitions.
+ */
+#define CPU_CONSDEV 1 /* dev_t: console terminal device */
+#define CPU_MAXID 2 /* number of valid machdep ids */
+
+#define CTL_MACHDEP_NAMES { \
+ { 0, 0 }, \
+ { "console_device", CTLTYPE_STRUCT }, \
+}
+
+/*
+ * The rest of this should probably be moved to ../hp300/hp300cpu.h,
+ * although some of it could probably be put into generic 68k headers.
+ */
+
+/* values for machineid */
+#define HP_320 0 /* 16Mhz 68020+HP MMU+16K external cache */
+#define HP_330 1 /* 16Mhz 68020+68851 MMU */
+#define HP_350 2 /* 25Mhz 68020+HP MMU+32K external cache */
+#define HP_360 3 /* 25Mhz 68030 */
+#define HP_370 4 /* 33Mhz 68030+64K external cache */
+#define HP_340 5 /* 16Mhz 68030 */
+#define HP_375 6 /* 50Mhz 68030+32K external cache */
+#define HP_380 7 /* 25Mhz 68040 */
+#define HP_433 8 /* 33Mhz 68040 */
+
+/* values for mmutype (assigned for quick testing) */
+#define MMU_68040 -2 /* 68040 on-chip MMU */
+#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
+#define MMU_HP 0 /* HP proprietary */
+#define MMU_68851 1 /* Motorola 68851 */
+
+/* values for ectype */
+#define EC_PHYS -1 /* external physical address cache */
+#define EC_NONE 0 /* no external cache */
+#define EC_VIRT 1 /* external virtual address cache */
+
+/* values for cpuspeed (not really related to clock speed due to caches) */
+#define MHZ_8 1
+#define MHZ_16 2
+#define MHZ_25 3
+#define MHZ_33 4
+#define MHZ_50 6
+
+#ifdef _KERNEL
+extern int machineid, mmutype, ectype;
+extern char *intiobase, *intiolimit;
+
+/* what is this supposed to do? i.e. how is it different than startrtclock? */
+#define enablertclock()
+
+#endif
+
+/* physical memory sections */
+#define ROMBASE (0x00000000)
+#define INTIOBASE (0x00400000)
+#define INTIOTOP (0x00600000)
+#define EXTIOBASE (0x00600000)
+#define EXTIOTOP (0x20000000)
+#define MAXADDR (0xFFFFF000)
+
+/*
+ * Internal IO space:
+ *
+ * Ranges from 0x400000 to 0x600000 (IIOMAPSIZE).
+ *
+ * Internal IO space is mapped in the kernel from ``intiobase'' to
+ * ``intiolimit'' (defined in locore.s). Since it is always mapped,
+ * conversion between physical and kernel virtual addresses is easy.
+ */
+#define ISIIOVA(va) \
+ ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
+#define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase)
+#define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE)
+#define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
+#define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 2mb */
+
+/*
+ * External IO space:
+ *
+ * DIO ranges from select codes 0-63 at physical addresses given by:
+ * 0x600000 + (sc - 32) * 0x10000
+ * DIO cards are addressed in the range 0-31 [0x600000-0x800000) for
+ * their control space and the remaining areas, [0x200000-0x400000) and
+ * [0x800000-0x1000000), are for additional space required by a card;
+ * e.g. a display framebuffer.
+ *
+ * DIO-II ranges from select codes 132-255 at physical addresses given by:
+ * 0x1000000 + (sc - 132) * 0x400000
+ * The address range of DIO-II space is thus [0x1000000-0x20000000).
+ *
+ * DIO/DIO-II space is too large to map in its entirety, instead devices
+ * are mapped into kernel virtual address space allocated from a range
+ * of EIOMAPSIZE pages (vmparam.h) starting at ``extiobase''.
+ */
+#define DIOBASE (0x600000)
+#define DIOTOP (0x1000000)
+#define DIOCSIZE (0x10000)
+#define DIOIIBASE (0x01000000)
+#define DIOIITOP (0x20000000)
+#define DIOIICSIZE (0x00400000)
+
+/*
+ * HP MMU
+ */
+#define MMUBASE IIOPOFF(0x5F4000)
+#define MMUSSTP 0x0
+#define MMUUSTP 0x4
+#define MMUTBINVAL 0x8
+#define MMUSTAT 0xC
+#define MMUCMD MMUSTAT
+
+#define MMU_UMEN 0x0001 /* enable user mapping */
+#define MMU_SMEN 0x0002 /* enable supervisor mapping */
+#define MMU_CEN 0x0004 /* enable data cache */
+#define MMU_BERR 0x0008 /* bus error */
+#define MMU_IEN 0x0020 /* enable instruction cache */
+#define MMU_FPE 0x0040 /* enable 68881 FP coprocessor */
+#define MMU_WPF 0x2000 /* write protect fault */
+#define MMU_PF 0x4000 /* page fault */
+#define MMU_PTF 0x8000 /* page table fault */
+
+#define MMU_FAULT (MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
+#define MMU_ENAB (MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
+
+/*
+ * 68851 and 68030 MMU
+ */
+#define PMMU_LVLMASK 0x0007
+#define PMMU_INV 0x0400
+#define PMMU_WP 0x0800
+#define PMMU_ALV 0x1000
+#define PMMU_SO 0x2000
+#define PMMU_LV 0x4000
+#define PMMU_BE 0x8000
+#define PMMU_FAULT (PMMU_WP|PMMU_INV)
+
+/*
+ * 68040 MMU
+ */
+#define MMU4_RES 0x001
+#define MMU4_TTR 0x002
+#define MMU4_WP 0x004
+#define MMU4_MOD 0x010
+#define MMU4_CMMASK 0x060
+#define MMU4_SUP 0x080
+#define MMU4_U0 0x100
+#define MMU4_U1 0x200
+#define MMU4_GLB 0x400
+#define MMU4_BE 0x800
+
+/* 680X0 function codes */
+#define FC_USERD 1 /* user data space */
+#define FC_USERP 2 /* user program space */
+#define FC_PURGE 3 /* HPMMU: clear TLB entries */
+#define FC_SUPERD 5 /* supervisor data space */
+#define FC_SUPERP 6 /* supervisor program space */
+#define FC_CPU 7 /* CPU space */
+
+/* fields in the 68020 cache control register */
+#define IC_ENABLE 0x0001 /* enable instruction cache */
+#define IC_FREEZE 0x0002 /* freeze instruction cache */
+#define IC_CE 0x0004 /* clear instruction cache entry */
+#define IC_CLR 0x0008 /* clear entire instruction cache */
+
+/* additional fields in the 68030 cache control register */
+#define IC_BE 0x0010 /* instruction burst enable */
+#define DC_ENABLE 0x0100 /* data cache enable */
+#define DC_FREEZE 0x0200 /* data cache freeze */
+#define DC_CE 0x0400 /* clear data cache entry */
+#define DC_CLR 0x0800 /* clear entire data cache */
+#define DC_BE 0x1000 /* data burst enable */
+#define DC_WA 0x2000 /* write allocate */
+
+#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
+#define CACHE_OFF (DC_CLR|IC_CLR)
+#define CACHE_CLR (CACHE_ON)
+#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
+#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
+
+/* 68040 cache control register */
+#define IC4_ENABLE 0x8000 /* instruction cache enable bit */
+#define DC4_ENABLE 0x80000000 /* data cache enable bit */
+
+#define CACHE4_ON (IC4_ENABLE|DC4_ENABLE)
+#define CACHE4_OFF (0)
diff --git a/sys/arch/hp300/include/db_machdep.h b/sys/arch/hp300/include/db_machdep.h
new file mode 100644
index 00000000000..856c91dd32b
--- /dev/null
+++ b/sys/arch/hp300/include/db_machdep.h
@@ -0,0 +1,4 @@
+/* $NetBSD: db_machdep.h,v 1.2 1994/10/26 07:26:21 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/db_machdep.h>
diff --git a/sys/arch/hp300/include/disklabel.h b/sys/arch/hp300/include/disklabel.h
new file mode 100644
index 00000000000..8e008d95c3e
--- /dev/null
+++ b/sys/arch/hp300/include/disklabel.h
@@ -0,0 +1,46 @@
+/* $NetBSD: disklabel.h,v 1.1 1994/10/14 18:26:39 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * 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 ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _MACHINE_DISKLABEL_H_
+#define _MACHINE_DISKLABEL_H_
+
+#define LABELSECTOR (1024 / DEV_BSIZE) /* sector containing label */
+#define LABELOFFSET 0 /* offset of label in sector */
+#define MAXPARTITIONS 8 /* number of partitions */
+#define RAW_PART 2 /* raw partition: xx?c */
+
+/* Just a dummy */
+struct cpu_disklabel {
+ int cd_dummy; /* must have one element. */
+};
+
+#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/hp300/include/endian.h b/sys/arch/hp300/include/endian.h
new file mode 100644
index 00000000000..3e9a6036445
--- /dev/null
+++ b/sys/arch/hp300/include/endian.h
@@ -0,0 +1,4 @@
+/* $NetBSD: endian.h,v 1.6 1994/10/26 07:26:22 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/endian.h>
diff --git a/sys/arch/hp300/include/exec.h b/sys/arch/hp300/include/exec.h
new file mode 100644
index 00000000000..9559df95c95
--- /dev/null
+++ b/sys/arch/hp300/include/exec.h
@@ -0,0 +1,78 @@
+/* $NetBSD: exec.h,v 1.9 1995/03/28 18:16:33 jtc Exp $ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * 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 ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _HP300_EXEC_H_
+#define _HP300_EXEC_H_
+
+#ifdef _KERNEL
+
+#ifdef COMPAT_HPUX
+#include "user.h" /* for pcb */
+#include "hp300/hpux/hpux_exec.h"
+#endif
+
+/*
+ * the following, if defined, prepares a set of vmspace commands for
+ * a given exectable package defined by epp.
+ * The standard executable formats are taken care of automatically;
+ * machine-specific ones can be defined using this function.
+ */
+int cpu_exec_makecmds __P((struct proc *p, struct exec_package *epp));
+
+/*
+ * the following function/macro checks to see if a given machine
+ * type (a_mid) field is valid for this architecture
+ * a non-zero return value indicates that the machine type is correct.
+ */
+#ifdef COMPAT_HPUX
+#define cpu_exec_checkmid(mid) ((mid == MID_HP200) || (mid == MID_HP300) || \
+ (mid == MID_HPUX))
+#else
+#define cpu_exec_checkmid(mid) ((mid == MID_HP200) || (mid == MID_HP300)))
+#endif
+
+#endif /* _KERNEL */
+
+#define __LDPGSZ 4096
+
+/* Relocation format. */
+struct relocation_info_hp300 {
+ int r_address; /* offset in text or data segment */
+ unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
+ r_pcrel : 1, /* 1 if value should be pc-relative */
+ r_length : 2, /* log base 2 of value's width */
+ r_extern : 1, /* 1 if need to add symbol to value */
+ r_baserel : 1, /* linkage table relative */
+ r_jmptable : 1, /* relocate to jump table */
+ r_relative : 1, /* load address relative */
+ r_copy : 1; /* run time copy */
+};
+#define relocation_info relocation_info_hp300
+
+#endif /* _HP300_EXEC_H_ */
diff --git a/sys/arch/hp300/include/float.h b/sys/arch/hp300/include/float.h
new file mode 100644
index 00000000000..c9f45e98615
--- /dev/null
+++ b/sys/arch/hp300/include/float.h
@@ -0,0 +1,8 @@
+/* $NetBSD: float.h,v 1.7 1995/06/20 20:45:34 jtc Exp $ */
+
+#ifndef _MACHINE_FLOAT_H_
+#define _MACHINE_FLOAT_H_
+
+#include <m68k/float.h>
+
+#endif
diff --git a/sys/arch/hp300/include/frame.h b/sys/arch/hp300/include/frame.h
new file mode 100644
index 00000000000..cc15f6df635
--- /dev/null
+++ b/sys/arch/hp300/include/frame.h
@@ -0,0 +1,3 @@
+/* $NetBSD: frame.h,v 1.6 1994/10/26 07:26:26 cgd Exp $ */
+
+#include <m68k/frame.h>
diff --git a/sys/arch/hp300/include/ieeefp.h b/sys/arch/hp300/include/ieeefp.h
new file mode 100644
index 00000000000..8d6941e81b5
--- /dev/null
+++ b/sys/arch/hp300/include/ieeefp.h
@@ -0,0 +1,4 @@
+/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:08 jtc Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/ieeefp.h>
diff --git a/sys/arch/hp300/include/limits.h b/sys/arch/hp300/include/limits.h
new file mode 100644
index 00000000000..b05789b6024
--- /dev/null
+++ b/sys/arch/hp300/include/limits.h
@@ -0,0 +1,4 @@
+/* $NetBSD: limits.h,v 1.7 1994/10/26 07:26:27 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/limits.h>
diff --git a/sys/arch/hp300/include/mtpr.h b/sys/arch/hp300/include/mtpr.h
new file mode 100644
index 00000000000..b18f2a508a6
--- /dev/null
+++ b/sys/arch/hp300/include/mtpr.h
@@ -0,0 +1,56 @@
+/* $NetBSD: mtpr.h,v 1.4 1994/10/26 07:26:29 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah Hdr: mtpr.h 1.1 90/07/09
+ *
+ * @(#)mtpr.h 7.2 (Berkeley) 11/3/90
+ */
+
+/*
+ * simulated software interrupt register
+ */
+
+extern unsigned char ssir;
+
+#define SIR_NET 0x1
+#define SIR_CLOCK 0x2
+
+#define siroff(x) ssir &= ~(x)
+#define setsoftnet() ssir |= SIR_NET
+#define setsoftclock() ssir |= SIR_CLOCK
diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h
new file mode 100644
index 00000000000..7106a3408b1
--- /dev/null
+++ b/sys/arch/hp300/include/param.h
@@ -0,0 +1,198 @@
+/* $NetBSD: param.h,v 1.23 1995/08/13 00:22:40 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: machparam.h 1.16 92/12/20$
+ *
+ * @(#)param.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Machine dependent constants for HP9000 series 300.
+ */
+#define MACHINE "hp300"
+#define MACHINE_ARCH "m68k"
+#define MID_MACHINE MID_M68K4K
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value for all
+ * data types (int, long, ...). The result is u_int and must be cast to
+ * any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
+#define PGSHIFT 12 /* LOG2(NBPG) */
+#define NBPG (1 << PGSHIFT) /* bytes/page */
+#define PGOFSET (NBPG-1) /* byte offset into page */
+#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
+
+#define SEGSHIFT 22 /* LOG2(NBSEG) */
+#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
+#define SEGOFSET (NBSEG-1) /* byte offset into segment */
+
+#define KERNBASE 0x00000000 /* start of kernel virtual */
+#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
+
+#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 CLSIZELOG2 0
+#define CLSIZE (1 << CLSIZELOG2)
+
+/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
+#define SSIZE 1 /* initial stack size/NBPG */
+#define SINCR 1 /* increment of stack/NBPG */
+#define UPAGES 2 /* pages of u-area */
+#define USPACE (UPAGES * NBPG) /* total size of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (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 128 /* size of an mbuf */
+#define MCLSHIFT 11
+#define MCLBYTES (1 << MCLSHIFT) /* large enough for ether MTU */
+#define MCLOFSET (MCLBYTES - 1)
+
+#ifndef NMBCLUSTERS
+#ifdef GATEWAY
+#define NMBCLUSTERS 512 /* map size, max cluster allocation */
+#else
+#define NMBCLUSTERS 256 /* map size, max cluster allocation */
+#endif
+#endif
+
+/*
+ * Size of kernel malloc arena in CLBYTES-sized logical pages
+ */
+#ifndef NKMEMCLUSTERS
+#define NKMEMCLUSTERS (2048 * 1024 / CLBYTES)
+#endif
+
+/* pages ("clicks") to disk blocks */
+#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
+#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
+
+/* pages to bytes */
+#define ctob(x) ((x) << PGSHIFT)
+#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
+
+/* bytes to disk blocks */
+#define dbtob(x) ((x) << DEV_BSHIFT)
+#define btodb(x) ((x) >> DEV_BSHIFT)
+
+/*
+ * Map a ``block device block'' to a file system block.
+ * This should be device dependent, and should use the bsize
+ * field from the disk label.
+ * For now though just use DEV_BSIZE.
+ */
+#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
+
+/*
+ * Mach derived conversion macros
+ */
+#define hp300_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
+#define hp300_trunc_page(x) ((unsigned)(x) & ~PGOFSET)
+#define hp300_btop(x) ((unsigned)(x) >> PGSHIFT)
+#define hp300_ptob(x) ((unsigned)(x) << PGSHIFT)
+
+/*
+ * spl functions; all but spl0 are done in-line
+ */
+#include <machine/psl.h>
+
+#define _spl(s) \
+({ \
+ register int _spl_r; \
+\
+ __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
+ "&=d" (_spl_r) : "di" (s)); \
+ _spl_r; \
+})
+
+/* spl0 requires checking for software interrupts */
+#define spl1() _spl(PSL_S|PSL_IPL1)
+#define spl2() _spl(PSL_S|PSL_IPL2)
+#define spl3() _spl(PSL_S|PSL_IPL3)
+#define spl4() _spl(PSL_S|PSL_IPL4)
+#define spl5() _spl(PSL_S|PSL_IPL5)
+#define spl6() _spl(PSL_S|PSL_IPL6)
+#define spl7() _spl(PSL_S|PSL_IPL7)
+
+#define splsoftclock() spl1()
+#define splsoftnet() spl1()
+#define splbio() spl5()
+#define splnet() spl5()
+#define spltty() spl5()
+#define splimp() spl5()
+#define splclock() spl6()
+#define splstatclock() spl6()
+#define splvm() spl6()
+#define splhigh() spl7()
+#define splsched() spl7()
+
+/* watch out for side effects */
+#define splx(s) (s & PSL_IPL ? _spl(s) : spl0())
+
+#ifdef _KERNEL
+#ifndef LOCORE
+int cpuspeed;
+#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
+#endif
+#endif
+
+#ifdef COMPAT_HPUX
+/*
+ * Constants/macros for HPUX multiple mapping of user address space.
+ * Pages in the first 256Mb are mapped in at every 256Mb segment.
+ */
+#define HPMMMASK 0xF0000000
+#define ISHPMMADDR(v) \
+ ((curproc->p_md.md_flags & MDP_HPUXMMAP) && \
+ ((unsigned)(v) & HPMMMASK) && \
+ ((unsigned)(v) & HPMMMASK) != HPMMMASK)
+#define HPMMBASEADDR(v) \
+ ((unsigned)(v) & ~HPMMMASK)
+#endif
diff --git a/sys/arch/hp300/include/pcb.h b/sys/arch/hp300/include/pcb.h
new file mode 100644
index 00000000000..796cca53790
--- /dev/null
+++ b/sys/arch/hp300/include/pcb.h
@@ -0,0 +1,67 @@
+/* $NetBSD: pcb.h,v 1.8 1995/05/12 12:55:17 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: pcb.h 1.14 91/03/25$
+ *
+ * @(#)pcb.h 8.1 (Berkeley) 6/10/93
+ */
+
+#include <machine/frame.h>
+
+/*
+ * HP300 process control block
+ */
+struct pcb {
+ short pcb_flags; /* misc. process flags */
+ short pcb_ps; /* processor status word */
+ int pcb_ustp; /* user segment table pointer */
+ int pcb_usp; /* user stack pointer */
+ int pcb_regs[12]; /* D2-D7, A2-A7 */
+ caddr_t pcb_onfault; /* for copyin/out faults */
+ struct fpframe pcb_fpregs; /* 68881/2 context save area */
+};
+
+/*
+ * The pcb is augmented with machine-dependent additional data for
+ * core dumps. For the hp300, this includes an HP-UX exec header
+ * which is dumped for HP-UX processes.
+ */
+struct md_coredump {
+ int md_exec[16]; /* exec structure for HP-UX core dumps */
+};
diff --git a/sys/arch/hp300/include/pmap.h b/sys/arch/hp300/include/pmap.h
new file mode 100644
index 00000000000..073d68743bb
--- /dev/null
+++ b/sys/arch/hp300/include/pmap.h
@@ -0,0 +1,161 @@
+/* $NetBSD: pmap.h,v 1.9 1995/05/11 16:53:03 jtc Exp $ */
+
+/*
+ * Copyright (c) 1987 Carnegie-Mellon University
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)pmap.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _HP300_PMAP_H_
+#define _HP300_PMAP_H_
+
+#include <machine/pte.h>
+
+#if defined(HP380)
+#define HP_SEG_SIZE (mmutype == MMU_68040 ? 0x40000 : NBSEG)
+#else
+#define HP_SEG_SIZE NBSEG
+#endif
+
+#define hp300_trunc_seg(x) (((unsigned)(x)) & ~(HP_SEG_SIZE-1))
+#define hp300_round_seg(x) hp300_trunc_seg((unsigned)(x) + HP_SEG_SIZE-1)
+
+/*
+ * Pmap stuff
+ */
+struct pmap {
+ pt_entry_t *pm_ptab; /* KVA of page table */
+ st_entry_t *pm_stab; /* KVA of segment table */
+ int pm_stchanged; /* ST changed */
+ int pm_stfree; /* 040: free lev2 blocks */
+ st_entry_t *pm_stpa; /* 040: ST phys addr */
+ short pm_sref; /* segment table ref count */
+ short pm_count; /* pmap reference count */
+ simple_lock_data_t pm_lock; /* lock on pmap */
+ struct pmap_statistics pm_stats; /* pmap statistics */
+ long pm_ptpages; /* more stats: PT pages */
+};
+
+typedef struct pmap *pmap_t;
+
+/*
+ * On the 040 we keep track of which level 2 blocks are already in use
+ * with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB
+ * (block 31). For convenience, the level 1 table is considered to be
+ * block 0.
+ *
+ * MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed.
+ * for the kernel and users. 8 implies only the initial "segment table"
+ * page is used. WARNING: don't change MAXUL2SIZE unless you can allocate
+ * physically contiguous pages for the ST in pmap.c!
+ */
+#define MAXKL2SIZE 32
+#define MAXUL2SIZE 8
+#define l2tobm(n) (1 << (n))
+#define bmtol2(n) (ffs(n) - 1)
+
+/*
+ * Macros for speed
+ */
+#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
+ if ((pmapp)->pm_stchanged) { \
+ (pcbp)->pcb_ustp = hp300_btop((vm_offset_t)(pmapp)->pm_stpa); \
+ if (iscurproc) \
+ loadustp((pcbp)->pcb_ustp); \
+ (pmapp)->pm_stchanged = FALSE; \
+ }
+#define PMAP_DEACTIVATE(pmapp, pcbp)
+
+/*
+ * For each vm_page_t, there is a list of all currently valid virtual
+ * mappings of that page. An entry is a pv_entry, the list is pv_table.
+ */
+struct pv_entry {
+ struct pv_entry *pv_next; /* next pv_entry */
+ struct pmap *pv_pmap; /* pmap where mapping lies */
+ vm_offset_t pv_va; /* virtual address for mapping */
+ st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */
+ struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
+ int pv_flags; /* flags */
+};
+
+#define PV_CI 0x01 /* header: all entries are cache inhibited */
+#define PV_PTPAGE 0x02 /* header: entry maps a page table page */
+
+struct pv_page;
+
+struct pv_page_info {
+ TAILQ_ENTRY(pv_page) pgi_list;
+ struct pv_entry *pgi_freelist;
+ int pgi_nfree;
+};
+
+/*
+ * This is basically:
+ * ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
+ */
+#define NPVPPG 170
+
+struct pv_page {
+ struct pv_page_info pvp_pgi;
+ struct pv_entry pvp_pv[NPVPPG];
+};
+
+#ifdef _KERNEL
+#if defined(HP320) || defined(HP350)
+#define HAVEVAC /* include cheezy VAC support */
+#endif
+
+extern struct pmap kernel_pmap_store;
+
+#define pmap_kernel() (&kernel_pmap_store)
+#define active_pmap(pm) \
+ ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
+
+extern struct pv_entry *pv_table; /* array of entries, one per page */
+
+#define pmap_page_index(pa) atop(pa - vm_first_phys)
+#define pa_to_pvh(pa) (&pv_table[pmap_page_index(pa)])
+
+#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
+#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
+
+extern pt_entry_t *Sysmap;
+extern char *vmmap; /* map for mem, dumps, etc. */
+#endif /* _KERNEL */
+
+#endif /* !_HP300_PMAP_H_ */
diff --git a/sys/arch/hp300/include/proc.h b/sys/arch/hp300/include/proc.h
new file mode 100644
index 00000000000..5eb1cad8d9c
--- /dev/null
+++ b/sys/arch/hp300/include/proc.h
@@ -0,0 +1,50 @@
+/* $NetBSD: proc.h,v 1.6 1994/10/26 07:26:35 cgd Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)proc.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Machine-dependent part of the proc structure for hp300.
+ */
+struct mdproc {
+ int *md_regs; /* registers on current frame */
+ int md_flags; /* machine-dependent flags */
+};
+
+/* md_flags */
+#define MDP_HPUXTRACE 0x0004 /* being traced by HP-UX process */
+#define MDP_HPUXMMAP 0x0008 /* VA space is multiply mapped */
+#define MDP_CCBDATA 0x0010 /* copyback caching of data (68040) */
+#define MDP_CCBSTACK 0x0020 /* copyback caching of stack (68040) */
diff --git a/sys/arch/hp300/include/profile.h b/sys/arch/hp300/include/profile.h
new file mode 100644
index 00000000000..82294239a1b
--- /dev/null
+++ b/sys/arch/hp300/include/profile.h
@@ -0,0 +1,3 @@
+/* $NetBSD: profile.h,v 1.2 1994/10/26 07:26:38 cgd Exp $ */
+
+#include <m68k/profile.h>
diff --git a/sys/arch/hp300/include/psl.h b/sys/arch/hp300/include/psl.h
new file mode 100644
index 00000000000..970687c2315
--- /dev/null
+++ b/sys/arch/hp300/include/psl.h
@@ -0,0 +1,3 @@
+/* $NetBSD: psl.h,v 1.5 1994/10/26 07:26:39 cgd Exp $ */
+
+#include <m68k/psl.h>
diff --git a/sys/arch/hp300/include/pte.h b/sys/arch/hp300/include/pte.h
new file mode 100644
index 00000000000..65c526ce5af
--- /dev/null
+++ b/sys/arch/hp300/include/pte.h
@@ -0,0 +1,152 @@
+/* $NetBSD: pte.h,v 1.4 1994/10/26 07:26:40 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: pte.h 1.13 92/01/20$
+ *
+ * @(#)pte.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _HP300_PTE_H_
+#define _HP300_PTE_H_
+
+/*
+ * HP300 hardware segment/page table entries
+ */
+
+#if 0
+struct ste {
+ unsigned int sg_pfnum:20; /* page table frame number */
+ unsigned int :8; /* reserved at 0 */
+ unsigned int :1; /* reserved at 1 */
+ unsigned int sg_prot:1; /* write protect bit */
+ unsigned int sg_v:2; /* valid bits */
+};
+
+struct ste40 {
+ unsigned int sg_ptaddr:24; /* page table page addr */
+ unsigned int :4; /* reserved at 0 */
+ unsigned int sg_u; /* hardware modified (dirty) bit */
+ unsigned int sg_prot:1; /* write protect bit */
+ unsigned int sg_v:2; /* valid bits */
+};
+
+struct pte {
+ unsigned int pg_pfnum:20; /* page frame number or 0 */
+ unsigned int :3;
+ unsigned int pg_w:1; /* is wired */
+ unsigned int :1; /* reserved at zero */
+ unsigned int pg_ci:1; /* cache inhibit bit */
+ unsigned int :1; /* reserved at zero */
+ unsigned int pg_m:1; /* hardware modified (dirty) bit */
+ unsigned int pg_u:1; /* hardware used (reference) bit */
+ unsigned int pg_prot:1; /* write protect bit */
+ unsigned int pg_v:2; /* valid bit */
+};
+#endif
+
+typedef int st_entry_t; /* segment table entry */
+typedef int pt_entry_t; /* Mach page table entry */
+
+#define PT_ENTRY_NULL ((pt_entry_t *) 0)
+#define ST_ENTRY_NULL ((st_entry_t *) 0)
+
+#define SG_V 0x00000002 /* segment is valid */
+#define SG_NV 0x00000000
+#define SG_PROT 0x00000004 /* access protection mask */
+#define SG_RO 0x00000004
+#define SG_RW 0x00000000
+#define SG_U 0x00000008 /* modified bit (68040) */
+#define SG_FRAME 0xfffff000
+#define SG_IMASK 0xffc00000
+#define SG_ISHIFT 22
+#define SG_PMASK 0x003ff000
+#define SG_PSHIFT 12
+
+/* 68040 additions */
+#define SG4_MASK1 0xfe000000
+#define SG4_SHIFT1 25
+#define SG4_MASK2 0x01fc0000
+#define SG4_SHIFT2 18
+#define SG4_MASK3 0x0003f000
+#define SG4_SHIFT3 12
+#define SG4_ADDR1 0xfffffe00
+#define SG4_ADDR2 0xffffff00
+#define SG4_LEV1SIZE 128
+#define SG4_LEV2SIZE 128
+#define SG4_LEV3SIZE 64
+
+#define PG_V 0x00000001
+#define PG_NV 0x00000000
+#define PG_PROT 0x00000004
+#define PG_U 0x00000008
+#define PG_M 0x00000010
+#define PG_W 0x00000100
+#define PG_RO 0x00000004
+#define PG_RW 0x00000000
+#define PG_FRAME 0xfffff000
+#define PG_CI 0x00000040
+#define PG_SHIFT 12
+#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT)
+
+/* 68040 additions */
+#define PG_CMASK 0x00000060 /* cache mode mask */
+#define PG_CWT 0x00000000 /* writethrough caching */
+#define PG_CCB 0x00000020 /* copyback caching */
+#define PG_CIS 0x00000040 /* cache inhibited serialized */
+#define PG_CIN 0x00000060 /* cache inhibited nonserialized */
+#define PG_SO 0x00000080 /* supervisor only */
+
+#define HP_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t))
+ /* user process segment table size */
+#define HP_MAX_PTSIZE 0x400000 /* max size of UPT */
+#define HP_MAX_KPTSIZE 0x100000 /* max memory to allocate to KPT */
+#define HP_PTBASE 0x10000000 /* UPT map base address */
+#define HP_PTMAXSIZE 0x70000000 /* UPT map maximum size */
+
+/*
+ * Kernel virtual address to page table entry and to physical address.
+ */
+#define kvtopte(va) \
+ (&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT])
+#define ptetokv(pt) \
+ ((((pt_entry_t *)(pt) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
+#define kvtophys(va) \
+ ((kvtopte(va)->pg_pfnum << PGSHIFT) | ((int)(va) & PGOFSET))
+
+#endif /* !_HP300_PTE_H_ */
diff --git a/sys/arch/hp300/include/ptrace.h b/sys/arch/hp300/include/ptrace.h
new file mode 100644
index 00000000000..76f781843e3
--- /dev/null
+++ b/sys/arch/hp300/include/ptrace.h
@@ -0,0 +1,4 @@
+/* $NetBSD: ptrace.h,v 1.2 1994/10/26 07:26:42 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/ptrace.h>
diff --git a/sys/arch/hp300/include/reg.h b/sys/arch/hp300/include/reg.h
new file mode 100644
index 00000000000..492b059d862
--- /dev/null
+++ b/sys/arch/hp300/include/reg.h
@@ -0,0 +1,8 @@
+/* $NetBSD: reg.h,v 1.9 1994/10/26 07:26:43 cgd Exp $ */
+
+#ifndef _MACHINE_REG_H_
+#define _MACHINE_REG_H_
+
+#include <m68k/reg.h>
+
+#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/hp300/include/setjmp.h b/sys/arch/hp300/include/setjmp.h
new file mode 100644
index 00000000000..0e4a4b56978
--- /dev/null
+++ b/sys/arch/hp300/include/setjmp.h
@@ -0,0 +1,3 @@
+/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:38 cgd Exp $ */
+
+#include <m68k/setjmp.h>
diff --git a/sys/arch/hp300/include/signal.h b/sys/arch/hp300/include/signal.h
new file mode 100644
index 00000000000..5787071f7aa
--- /dev/null
+++ b/sys/arch/hp300/include/signal.h
@@ -0,0 +1,4 @@
+/* $NetBSD: signal.h,v 1.3 1994/10/26 07:26:44 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/signal.h>
diff --git a/sys/arch/hp300/include/stdarg.h b/sys/arch/hp300/include/stdarg.h
new file mode 100644
index 00000000000..07f10c65ee5
--- /dev/null
+++ b/sys/arch/hp300/include/stdarg.h
@@ -0,0 +1,4 @@
+/* $NetBSD: stdarg.h,v 1.4 1994/10/26 07:26:45 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/stdarg.h>
diff --git a/sys/arch/hp300/include/trap.h b/sys/arch/hp300/include/trap.h
new file mode 100644
index 00000000000..071e33d0575
--- /dev/null
+++ b/sys/arch/hp300/include/trap.h
@@ -0,0 +1,3 @@
+/* $NetBSD: trap.h,v 1.6 1994/10/26 07:26:47 cgd Exp $ */
+
+#include <m68k/trap.h>
diff --git a/sys/arch/hp300/include/types.h b/sys/arch/hp300/include/types.h
new file mode 100644
index 00000000000..6f78747c1a6
--- /dev/null
+++ b/sys/arch/hp300/include/types.h
@@ -0,0 +1,10 @@
+/* $NetBSD: types.h,v 1.5 1995/06/26 05:13:46 cgd Exp $ */
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <m68k/types.h>
+
+#define __BDEVSW_DUMP_OLD_TYPE
+
+#endif
diff --git a/sys/arch/hp300/include/varargs.h b/sys/arch/hp300/include/varargs.h
new file mode 100644
index 00000000000..1ed0916752d
--- /dev/null
+++ b/sys/arch/hp300/include/varargs.h
@@ -0,0 +1,4 @@
+/* $NetBSD: varargs.h,v 1.2 1994/10/26 07:26:50 cgd Exp $ */
+
+/* Just use the common m68k definition */
+#include <m68k/varargs.h>
diff --git a/sys/arch/hp300/include/vmparam.h b/sys/arch/hp300/include/vmparam.h
new file mode 100644
index 00000000000..85f9bf25311
--- /dev/null
+++ b/sys/arch/hp300/include/vmparam.h
@@ -0,0 +1,249 @@
+/* $NetBSD: vmparam.h,v 1.7 1994/10/26 07:26:52 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
+ *
+ * @(#)vmparam.h 8.2 (Berkeley) 4/19/94
+ */
+
+/*
+ * Machine dependent constants for HP300
+ */
+/*
+ * USRTEXT is the start of the user text/data space, while USRSTACK
+ * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are
+ * the number of pages from the beginning of the P0 region to the
+ * beginning of the text and from the beginning of the P1 region to the
+ * beginning of the stack respectively.
+ *
+ * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
+ * is for HPUX compatibility. Why?? Because HPUX's debuggers
+ * have the user's stack hard-wired at FFF00000 for post-mortems,
+ * and we must be compatible...
+ */
+#define USRTEXT NBPG
+#define USRSTACK (-HIGHPAGES*NBPG) /* Start of user stack */
+#define BTOPUSRSTACK (0x100000-HIGHPAGES) /* btop(USRSTACK) */
+#define P1PAGES 0x100000
+#define LOWPAGES 0
+#define HIGHPAGES (0x100000/NBPG)
+
+/*
+ * Virtual memory related constants, all in bytes
+ */
+#ifndef MAXTSIZ
+#define MAXTSIZ (8*1024*1024) /* max text size */
+#endif
+#ifndef DFLDSIZ
+#define DFLDSIZ (16*1024*1024) /* initial data size limit */
+#endif
+#ifndef MAXDSIZ
+#define MAXDSIZ (64*1024*1024) /* max data size */
+#endif
+#ifndef DFLSSIZ
+#define DFLSSIZ (512*1024) /* initial stack size limit */
+#endif
+#ifndef MAXSSIZ
+#define MAXSSIZ MAXDSIZ /* max stack size */
+#endif
+
+/*
+ * Default sizes of swap allocation chunks (see dmap.h).
+ * The actual values may be changed in vminit() based on MAXDSIZ.
+ * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
+ * DMMIN should be at least ctod(1) so that vtod() works.
+ * vminit() insures this.
+ */
+#define DMMIN 32 /* smallest swap allocation */
+#define DMMAX 4096 /* largest potential swap allocation */
+
+/*
+ * Sizes of the system and user portions of the system page table.
+ */
+/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
+#define SYSPTSIZE (2 * NPTEPG) /* 8mb */
+#define USRPTSIZE (1 * NPTEPG) /* 4mb */
+
+/*
+ * PTEs for mapping user space into the kernel for phyio operations.
+ * One page is enough to handle 4Mb of simultaneous raw IO operations.
+ */
+#ifndef USRIOSIZE
+#define USRIOSIZE (1 * NPTEPG) /* 4mb */
+#endif
+
+/*
+ * PTEs for system V style shared memory.
+ * This is basically slop for kmempt which we actually allocate (malloc) from.
+ */
+#ifndef SHMMAXPGS
+#define SHMMAXPGS 1024 /* 4mb */
+#endif
+
+/*
+ * External IO space map size.
+ * By default we make it large enough to map up to 3 DIO-II devices and
+ * the complete DIO space. For a 320-only configuration (which has no
+ * DIO-II) you could define a considerably smaller region.
+ */
+#ifndef EIOMAPSIZE
+#define EIOMAPSIZE 3584 /* 14mb */
+#endif
+
+/*
+ * Boundary at which to place first MAPMEM segment if not explicitly
+ * specified. Should be a power of two. This allows some slop for
+ * the data segment to grow underneath the first mapped segment.
+ */
+#define MMSEG 0x200000
+
+/*
+ * The size of the clock loop.
+ */
+#define LOOPPAGES (maxfree - firstfree)
+
+/*
+ * 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
+
+/*
+ * A swapped in process is given a small amount of core without being bothered
+ * by the page replacement algorithm. Basically this says that if you are
+ * swapped in you deserve some resources. We protect the last SAFERSS
+ * pages against paging and will just swap you out rather than paging you.
+ * Note that each process has at least UPAGES+CLSIZE pages which are not
+ * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
+ * number just means a swapped in process is given around 25k bytes.
+ * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
+ * so we loan each swapped in process memory worth 100$, or just admit
+ * that we don't consider it worthwhile and swap it out to disk which costs
+ * $30/mb or about $0.75.
+ */
+#define SAFERSS 4 /* nominal ``small'' resident set size
+ protected against replacement */
+
+/*
+ * DISKRPM is used to estimate the number of paging i/o operations
+ * which one can expect from a single disk controller.
+ */
+#define DISKRPM 60
+
+/*
+ * Klustering constants. Klustering is the gathering
+ * of pages together for pagein/pageout, while clustering
+ * is the treatment of hardware page size as though it were
+ * larger than it really is.
+ *
+ * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
+ * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
+ * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
+ * unless you like "big push" panics.
+ */
+
+#define KLMAX (4/CLSIZE)
+#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
+#define KLIN (4/CLSIZE) /* default data/stack in klust */
+#define KLTXT (4/CLSIZE) /* default text in klust */
+#define KLOUT (4/CLSIZE)
+
+/*
+ * KLSDIST is the advance or retard of the fifo reclaim for sequential
+ * processes data space.
+ */
+#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
+
+/*
+ * Paging thresholds (see vm_sched.c).
+ * Strategy of 1/19/85:
+ * lotsfree is 512k bytes, but at most 1/4 of memory
+ * desfree is 200k bytes, but at most 1/8 of memory
+ */
+#define LOTSFREE (512 * 1024)
+#define LOTSFREEFRACT 4
+#define DESFREE (200 * 1024)
+#define DESFREEFRACT 8
+
+/*
+ * There are two clock hands, initially separated by HANDSPREAD bytes
+ * (but at most all of user memory). The amount of time to reclaim
+ * a page once the pageout process examines it increases with this
+ * distance and decreases as the scan rate rises.
+ */
+#define HANDSPREAD (2 * 1024 * 1024)
+
+/*
+ * The number of times per second to recompute the desired paging rate
+ * and poke the pagedaemon.
+ */
+#define RATETOSCHEDPAGING 4
+
+/*
+ * Believed threshold (in megabytes) for which interleaved
+ * swapping area is desirable.
+ */
+#define LOTSOFMEM 2
+
+/*
+ * Mach derived constants
+ */
+
+/* user/kernel map constants */
+#define VM_MIN_ADDRESS ((vm_offset_t)0)
+#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFFF00000)
+#define VM_MAX_ADDRESS ((vm_offset_t)0xFFF00000)
+#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0)
+#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFF000)
+
+/* virtual sizes (bytes) for various kernel submaps */
+#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
+#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
+#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
+
+/* # of kernel PT pages (initial only, can grow dynamically) */
+#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */
+
+/* pcb base */
+#define pcbb(p) ((u_int)(p)->p_addr)