xref: /netbsd-src/sys/arch/sun2/include/vmparam.h (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1 /*	$NetBSD: vmparam.h,v 1.12 2008/04/28 20:23:37 martin Exp $	*/
2 
3 /*-
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Machine dependent constants for Sun2
31  *
32  * The Sun2 has limited total kernel virtual space (14MB) and
33  * can not use main memory for page tables.  (All active PTEs
34  * must be installed in special translation RAM in the MMU).
35  * Therefore, parameters that would normally configure the
36  * size of various page tables are irrelevant.  Only things
37  * that consume portions of kernel virtual (KV) space matter,
38  * and those things should be chosen to conserve KV space.
39  */
40 
41 /*
42  * The Sun2 has 2K pages.  Override PAGE_* to be compile-time constants.
43  */
44 #define	PAGE_SHIFT	11
45 #define	PAGE_SIZE	(1 << PAGE_SHIFT)
46 #define	PAGE_MASK	(PAGE_SIZE - 1)
47 
48 /*
49  * We definitely need a small pager map.
50  */
51 #define	PAGER_MAP_DEFAULT_SIZE (1 * 1024 * 1024)
52 
53 /*
54  * USRSTACK is the top (end) of the user stack.
55  */
56 #define	USRSTACK	0x1000000	/* High end of user stack */
57 
58 /*
59  * Virtual memory related constants, all in bytes.
60  * The Sun2 has only 16 MB of user-virtual space,
61  * so we need to be conservative with these limits.
62  */
63 #ifndef MAXTSIZ
64 #define	MAXTSIZ		(5*1024*1024)		/* max text size */
65 #endif
66 #ifndef DFLDSIZ
67 #define	DFLDSIZ		(4*1024*1024)		/* initial data size limit */
68 #endif
69 #ifndef MAXDSIZ
70 #define	MAXDSIZ		(6*1024*1024)		/* max data size */
71 #endif
72 #ifndef	DFLSSIZ
73 #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
74 #endif
75 #ifndef	MAXSSIZ
76 #define	MAXSSIZ		(4*1024*1024)		/* max stack size */
77 #endif
78 
79 /*
80  * PTEs for mapping user space into the kernel for phyio operations.
81  * The actual limitation for physio requests will be the DVMA space,
82  * and that is fixed by hardware design at 256K.  We could make the
83  * physio map larger than that, but it would not buy us much.
84  */
85 #ifndef USRIOSIZE
86 #define USRIOSIZE	128		/* 256K */
87 #endif
88 
89 /*
90  * PTEs for system V style shared memory.
91  * This is basically slop for kmempt which we actually allocate (malloc) from.
92  */
93 #ifndef SHMMAXPGS
94 #define SHMMAXPGS	512 	/* 4 MB */
95 #endif
96 
97 /*
98  * Mach-derived constants:
99  */
100 
101 /* user/kernel map constants */
102 #define VM_MIN_ADDRESS		((vaddr_t)0)
103 #define VM_MAX_ADDRESS		((vaddr_t)USRSTACK)
104 #define VM_MAXUSER_ADDRESS	((vaddr_t)USRSTACK)
105 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)KERNBASE)
106 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t)KERN_END)
107 
108 /* virtual sizes (bytes) for various kernel submaps */
109 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
110 
111 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
112 #define VM_PHYSSEG_NOADD	/* can't add RAM after vm_mem_init */
113 
114 #define	VM_NFREELIST		1
115 #define	VM_FREELIST_DEFAULT	0
116 
117 #ifdef	_LKM
118 #undef	KERNBASE
119 extern	char KERNBASE[];
120 #endif	/* _LKM */
121 
122 /* This is needed by some LKMs. */
123 #define VM_PHYSSEG_MAX		4
124