xref: /openbsd-src/sys/arch/mips64/include/vmparam.h (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1 /*	$OpenBSD: vmparam.h,v 1.16 2008/08/22 10:41:37 kurt Exp $	*/
2 /*	$NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1988 University of Utah.
6  * Copyright (c) 1992, 1993
7  *	The Regents of the University of California.  All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * the Systems Programming Group of the University of Utah Computer
11  * Science Department and Ralph Campbell.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *	from: Utah Hdr: vmparam.h 1.16 91/01/18
38  *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
39  */
40 
41 #ifndef _MIPS_VMPARAM_H_
42 #define _MIPS_VMPARAM_H_
43 
44 /*
45  * Machine dependent constants mips processors.
46  */
47 /*
48  * USRTEXT is the start of the user text/data space, while USRSTACK
49  * is the top (end) of the user stack.
50  */
51 #define	USRTEXT		0x0000000000400000L
52 #define	USRSTACK	0x0000000080000000L	/* Start of user stack */
53 
54 /*
55  * Virtual memory related constants, all in bytes
56  */
57 #ifndef MAXTSIZ
58 #define	MAXTSIZ		(64*1024*1024)		/* max text size */
59 #endif
60 #ifndef DFLDSIZ
61 #define	DFLDSIZ		(128*1024*1024)		/* initial data size limit */
62 #endif
63 #ifndef MAXDSIZ
64 #define	MAXDSIZ		(1*1024*1024*1024)	/* max data size */
65 #endif
66 #ifndef	DFLSSIZ
67 #define	DFLSSIZ		(2*1024*1024)		/* initial stack size limit */
68 #endif
69 #ifndef	MAXSSIZ
70 #define	MAXSSIZ		(32*1024*1024)		/* max stack size */
71 #endif
72 
73 #define STACKGAP_RANDOM	256*1024
74 
75 /*
76  * PTEs for mapping user space into the kernel for physio operations.
77  * 16 pte's are enough to cover 8 disks * MAXBSIZE.
78  */
79 #ifndef USRIOSIZE
80 #define USRIOSIZE	32
81 #endif
82 
83 /*
84  * PTEs for system V style shared memory.
85  * This is basically slop for kmempt which we actually allocate (malloc) from.
86  */
87 #ifndef SHMMAXPGS
88 #define SHMMAXPGS	8192		/* 8mb */
89 #endif
90 
91 #ifndef	VM_PHYSSEG_MAX
92 #define	VM_PHYSSEG_MAX	8	/* Max number of physical memory segments */
93 #endif
94 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
95 #define VM_PHYSSEG_NOADD
96 
97 /* user/kernel map constants */
98 #define VM_MIN_ADDRESS		((vaddr_t)0x0000000000000000L)
99 #define VM_MAXUSER_ADDRESS	((vaddr_t)0x0000000080000000L)
100 #define VM_MAX_ADDRESS		((vaddr_t)0x0000000080000000L)
101 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xffffffffc0000000L)
102 #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xfffffffffffff000L)
103 
104 /* map PIE below 256MB (non-pie link address) to avoid mmap pressure */
105 #define VM_PIE_MIN_ADDR		PAGE_SIZE
106 #define VM_PIE_MAX_ADDR		0x10000000UL
107 
108 #ifndef VM_NFREELIST
109 #define	VM_NFREELIST		1
110 #endif
111 #define	VM_FREELIST_DEFAULT	0
112 
113 /* virtual sizes (bytes) for various kernel submaps */
114 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
115 
116 #if defined(_KERNEL) && !defined(_LOCORE)
117 /*
118  * pmap-specific data
119  */
120 
121 /* XXX - belongs in pmap.h, but put here because of ordering issues */
122 typedef struct pv_entry {
123 	struct pv_entry	*pv_next;	/* next pv_entry */
124 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
125 	vaddr_t		pv_va;		/* virtual address for mapping */
126 } *pv_entry_t;
127 
128 #define __HAVE_VM_PAGE_MD
129 struct vm_page_md {
130 	struct pv_entry pv_ent;		/* pv list of this seg */
131 };
132 
133 #define	VM_MDPAGE_INIT(pg) \
134 	do { \
135 		(pg)->mdpage.pv_ent.pv_next = NULL; \
136 		(pg)->mdpage.pv_ent.pv_pmap = NULL; \
137 		(pg)->mdpage.pv_ent.pv_va = 0; \
138 	} while (0)
139 
140 #endif	/* _KERNEL && !_LOCORE */
141 
142 #endif /* !_MIPS_VMPARAM_H_ */
143