xref: /original-bsd/sys/luna68k/include/vmparam.h (revision 5d76345d)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1992 OMRON Corporation.
4  * Copyright (c) 1982, 1986, 1990, 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * the Systems Programming Group of the University of Utah Computer
9  * Science Department.
10  *
11  * %sccs.include.redist.c%
12  *
13  * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
14  * from: hp300/include/vmparam.h	8.1 (Berkeley) 6/10/93
15  *
16  *	@(#)vmparam.h	8.3 (Berkeley) 04/22/94
17  */
18 
19 /*
20  * Machine dependent constants for HP300
21  */
22 /*
23  * USRTEXT is the start of the user text/data space, while USRSTACK
24  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
25  * the number of pages from the beginning of the P0 region to the
26  * beginning of the text and from the beginning of the P1 region to the
27  * beginning of the stack respectively.
28  *
29  * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
30  * is for HPUX compatibility.  Why??  Because HPUX's debuggers
31  * have the user's stack hard-wired at FFF00000 for post-mortems,
32  * and we must be compatible...
33  */
34 #define	USRTEXT		0
35 #define	USRSTACK	(-HIGHPAGES*NBPG)	/* Start of user stack */
36 #define	BTOPUSRSTACK	(0x100000-HIGHPAGES)	/* btop(USRSTACK) */
37 #define P1PAGES		0x100000
38 #define	LOWPAGES	0
39 #define HIGHPAGES	(0x100000/NBPG)
40 
41 /*
42  * In kernel address space, user stack and user structure is mapped at
43  * KERNELSTACK(LUNA only). Because LUNA has only 0x80000000 kernel
44  * address space and last 1G(0x40000000-0x7FFFFFFF) is IO mapping space.
45  * See below VM_MAX_KERNEL_ADDRESS define.
46  */
47 #define	KERNELSTACK	0x3FF00000
48 
49 /*
50  * Virtual memory related constants, all in bytes
51  */
52 #ifndef MAXTSIZ
53 #define	MAXTSIZ		(8*1024*1024)		/* max text size */
54 #endif
55 #ifndef DFLDSIZ
56 #define	DFLDSIZ		(16*1024*1024)		/* initial data size limit */
57 #endif
58 #ifndef MAXDSIZ
59 #define	MAXDSIZ		(64*1024*1024)		/* max data size */
60 #endif
61 #ifndef	DFLSSIZ
62 #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
63 #endif
64 #ifndef	MAXSSIZ
65 #define	MAXSSIZ		MAXDSIZ			/* max stack size */
66 #endif
67 
68 /*
69  * Default sizes of swap allocation chunks (see dmap.h).
70  * The actual values may be changed in vminit() based on MAXDSIZ.
71  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
72  * DMMIN should be at least ctod(1) so that vtod() works.
73  * vminit() insures this.
74  */
75 #define	DMMIN	32			/* smallest swap allocation */
76 #define	DMMAX	4096			/* largest potential swap allocation */
77 
78 /*
79  * Sizes of the system and user portions of the system page table.
80  */
81 /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
82 #define	SYSPTSIZE	(2 * NPTEPG)	/* 8mb */
83 #define	USRPTSIZE 	(1 * NPTEPG)	/* 4mb */
84 
85 /*
86  * PTEs for mapping user space into the kernel for phyio operations.
87  * One page is enough to handle 4Mb of simultaneous raw IO operations.
88  */
89 #ifndef USRIOSIZE
90 #define USRIOSIZE	(1 * NPTEPG)	/* 4mb */
91 #endif
92 
93 /*
94  * PTEs for system V style shared memory.
95  * This is basically slop for kmempt which we actually allocate (malloc) from.
96  */
97 #ifndef SHMMAXPGS
98 #define SHMMAXPGS	1024		/* 4mb */
99 #endif
100 
101 /*
102  * Boundary at which to place first MAPMEM segment if not explicitly
103  * specified.  Should be a power of two.  This allows some slop for
104  * the data segment to grow underneath the first mapped segment.
105  */
106 #define MMSEG		0x200000
107 
108 /*
109  * The size of the clock loop.
110  */
111 #define	LOOPPAGES	(maxfree - firstfree)
112 
113 /*
114  * The time for a process to be blocked before being very swappable.
115  * This is a number of seconds which the system takes as being a non-trivial
116  * amount of real time.  You probably shouldn't change this;
117  * it is used in subtle ways (fractions and multiples of it are, that is, like
118  * half of a ``long time'', almost a long time, etc.)
119  * It is related to human patience and other factors which don't really
120  * change over time.
121  */
122 #define	MAXSLP 		20
123 
124 /*
125  * A swapped in process is given a small amount of core without being bothered
126  * by the page replacement algorithm.  Basically this says that if you are
127  * swapped in you deserve some resources.  We protect the last SAFERSS
128  * pages against paging and will just swap you out rather than paging you.
129  * Note that each process has at least UPAGES+CLSIZE pages which are not
130  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
131  * number just means a swapped in process is given around 25k bytes.
132  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
133  * so we loan each swapped in process memory worth 100$, or just admit
134  * that we don't consider it worthwhile and swap it out to disk which costs
135  * $30/mb or about $0.75.
136  */
137 #define	SAFERSS		4		/* nominal ``small'' resident set size
138 					   protected against replacement */
139 
140 /*
141  * DISKRPM is used to estimate the number of paging i/o operations
142  * which one can expect from a single disk controller.
143  */
144 #define	DISKRPM		60
145 
146 /*
147  * Klustering constants.  Klustering is the gathering
148  * of pages together for pagein/pageout, while clustering
149  * is the treatment of hardware page size as though it were
150  * larger than it really is.
151  *
152  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
153  * units.  Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
154  * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
155  * unless you like "big push" panics.
156  */
157 
158 #define	KLMAX	(4/CLSIZE)
159 #define	KLSEQL	(2/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
160 #define	KLIN	(4/CLSIZE)		/* default data/stack in klust */
161 #define	KLTXT	(4/CLSIZE)		/* default text in klust */
162 #define	KLOUT	(4/CLSIZE)
163 
164 /*
165  * KLSDIST is the advance or retard of the fifo reclaim for sequential
166  * processes data space.
167  */
168 #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
169 
170 /*
171  * Paging thresholds (see vm_sched.c).
172  * Strategy of 1/19/85:
173  *	lotsfree is 512k bytes, but at most 1/4 of memory
174  *	desfree is 200k bytes, but at most 1/8 of memory
175  */
176 #define	LOTSFREE	(512 * 1024)
177 #define	LOTSFREEFRACT	4
178 #define	DESFREE		(200 * 1024)
179 #define	DESFREEFRACT	8
180 
181 /*
182  * There are two clock hands, initially separated by HANDSPREAD bytes
183  * (but at most all of user memory).  The amount of time to reclaim
184  * a page once the pageout process examines it increases with this
185  * distance and decreases as the scan rate rises.
186  */
187 #define	HANDSPREAD	(2 * 1024 * 1024)
188 
189 /*
190  * The number of times per second to recompute the desired paging rate
191  * and poke the pagedaemon.
192  */
193 #define	RATETOSCHEDPAGING	4
194 
195 /*
196  * Believed threshold (in megabytes) for which interleaved
197  * swapping area is desirable.
198  */
199 #define	LOTSOFMEM	2
200 
201 /*
202  * Mach derived constants
203  */
204 
205 /* user/kernel map constants */
206 #define VM_MIN_ADDRESS		((vm_offset_t)0)
207 #define VM_MAXUSER_ADDRESS	((vm_offset_t)0xFFF00000)
208 #define VM_MAX_ADDRESS		((vm_offset_t)0xFFF00000)
209 #define VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0)
210 #define VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0x7FFFF000)
211 
212 /* virtual sizes (bytes) for various kernel submaps */
213 #define VM_MBUF_SIZE		(NMBCLUSTERS*MCLBYTES)
214 #define VM_KMEM_SIZE		(NKMEMCLUSTERS*CLBYTES)
215 #define VM_PHYS_SIZE		(USRIOSIZE*CLBYTES)
216 
217 /* # of kernel PT pages (initial only, can grow dynamically) */
218 #define VM_KERNEL_PT_PAGES	((vm_size_t)2)		/* XXX: SYSPTSIZE */
219 
220 /* pcb base */
221 #define	pcbb(p)		((u_int)(p)->p_addr)
222