xref: /openbsd-src/sys/arch/sparc64/include/vmparam.h (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1 /*	$OpenBSD: vmparam.h,v 1.23 2011/05/30 22:25:22 oga Exp $	*/
2 /*	$NetBSD: vmparam.h,v 1.18 2001/05/01 02:19:19 thorpej Exp $ */
3 
4 /*
5  * Copyright (c) 1992, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This software was developed by the Computer Systems Engineering group
9  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10  * contributed to Berkeley.
11  *
12  * All advertising materials mentioning features or use of this software
13  * must display the following acknowledgement:
14  *	This product includes software developed by the University of
15  *	California, Lawrence Berkeley Laboratory.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions
19  * are met:
20  * 1. Redistributions of source code must retain the above copyright
21  *    notice, this list of conditions and the following disclaimer.
22  * 2. Redistributions in binary form must reproduce the above copyright
23  *    notice, this list of conditions and the following disclaimer in the
24  *    documentation and/or other materials provided with the distribution.
25  * 3. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *	@(#)vmparam.h	8.1 (Berkeley) 6/11/93
42  */
43 
44 /*
45  * Machine dependent constants for sun4u and sun4v UltraSPARC
46  */
47 
48 #ifndef VMPARAM_H
49 #define VMPARAM_H
50 
51 /*
52  * USRTEXT is the start of the user text/data space, while USRSTACK
53  * is the top (end) of the user stack.
54  */
55 #define	USRTEXT		0x2000			/* Start of user text */
56 #define USRSTACK	0xffffffffffffe000L
57 
58 /*
59  * Virtual memory related constants, all in bytes
60  */
61 /*
62  * Since the compiler generates `call' instructions we can't
63  * have more than 4GB in a single text segment.
64  *
65  * And since we only have a 40-bit address space, allow half
66  * of that for data and the other half for stack.
67  */
68 #ifndef MAXTSIZ
69 #define	MAXTSIZ		(1L*1024*1024*1024)	/* max text size */
70 #endif
71 #ifndef DFLDSIZ
72 #define	DFLDSIZ		(128L*1024*1024)	/* initial data size limit */
73 #endif
74 #ifndef MAXDSIZ
75 #define	MAXDSIZ		(8L*1024*1024*1024)	/* max data size */
76 #endif
77 #ifndef BRKSIZ
78 #define	BRKSIZ		MAXDSIZ			/* heap gap size */
79 #endif
80 #ifndef	DFLSSIZ
81 #define	DFLSSIZ		(2L*1024*1024)		/* initial stack size limit */
82 #endif
83 #ifndef	MAXSSIZ
84 #define	MAXSSIZ		(32L*1024*1024)		/* max stack size */
85 #endif
86 
87 #define STACKGAP_RANDOM	256*1024
88 
89 /*
90  * Size of shared memory map
91  */
92 #ifndef SHMMAXPGS
93 #define SHMMAXPGS	4096			/* 32mb */
94 #endif
95 
96 /*
97  * Mach derived constants
98  */
99 
100 /*
101  * User/kernel map constants.
102  */
103 #define VM_MIN_ADDRESS		((vaddr_t)0)
104 #define VM_MAX_ADDRESS		((vaddr_t)-1)
105 #define VM_MAXUSER_ADDRESS	((vaddr_t)-1)
106 
107 /* map PIE into the first quarter of the address space before hole */
108 #define VM_PIE_MIN_ADDR		PAGE_SIZE
109 #define VM_PIE_MAX_ADDR		0x10000000000
110 
111 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)KERNBASE)
112 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t)0x000007ffffffffffL)
113 
114 #define VM_PHYSSEG_MAX          32       /* up to 32 segments */
115 #define VM_PHYSSEG_STRAT        VM_PSTRAT_BSEARCH
116 #define VM_PHYSSEG_NOADD                /* can't add RAM after vm_mem_init */
117 
118 #define __HAVE_VM_PAGE_MD
119 /*
120  * For each struct vm_page, there is a list of all currently valid virtual
121  * mappings of that page.  An entry is a pv_entry_t, the list is pv_table.
122  *
123  * XXX - this doesn't belong here, but for now we have to keep it here
124  *       because of include ordering issues.
125  */
126 typedef struct pv_entry {
127 	struct pv_entry	*pv_next;	/* next pv_entry */
128 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
129 	vaddr_t	pv_va;		/* virtual address for mapping */
130 } *pv_entry_t;
131 /* PV flags encoded in the low bits of the VA of the first pv_entry */
132 
133 struct vm_page_md {
134 	struct pv_entry pvent;
135 };
136 
137 #define VM_MDPAGE_INIT(pg) do {			\
138 	(pg)->mdpage.pvent.pv_next = NULL;	\
139 	(pg)->mdpage.pvent.pv_pmap = NULL;	\
140 	(pg)->mdpage.pvent.pv_va = 0;		\
141 } while (0)
142 
143 #if defined (_KERNEL) && !defined(_LOCORE)
144 struct vm_map;
145 vaddr_t		dvma_mapin(struct vm_map *, vaddr_t, int, int);
146 void		dvma_mapout(vaddr_t, vaddr_t, int);
147 #endif
148 #endif
149