xref: /netbsd-src/sys/arch/sh3/include/vmparam.h (revision b8c616269f5ebf18ab2e35cb8099d683130a177c)
1 /*	$NetBSD: vmparam.h,v 1.14 2002/12/10 05:14:33 thorpej Exp $	*/
2 
3 /*-
4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by UCHIYAMA Yasushi.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _SH3_VMPARAM_H_
40 #define	_SH3_VMPARAM_H_
41 #include <sys/queue.h>
42 
43 /* Virtual address map. */
44 #define	VM_MIN_ADDRESS		((vaddr_t)0)
45 #define	VM_MAXUSER_ADDRESS	((vaddr_t)0x7ffff000)
46 #define	VM_MAX_ADDRESS		((vaddr_t)0x7ffff000)
47 #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xc0000000)
48 #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xe0000000)
49 
50 /* top of stack */
51 #define	USRSTACK		VM_MAXUSER_ADDRESS
52 
53 /* Virtual memory resoruce limit. */
54 #define	MAXTSIZ			(64 * 1024 * 1024)	/* max text size */
55 #ifndef MAXDSIZ
56 #define	MAXDSIZ			(512 * 1024 * 1024)	/* max data size */
57 #endif
58 #ifndef	MAXSSIZ
59 #define	MAXSSIZ			(32 * 1024 * 1024)	/* max stack size */
60 #endif
61 
62 /* initial data size limit */
63 #ifndef DFLDSIZ
64 #define	DFLDSIZ			(128 * 1024 * 1024)
65 #endif
66 /* initial stack size limit */
67 #ifndef	DFLSSIZ
68 #define	DFLSSIZ			(2 * 1024 * 1024)
69 #endif
70 
71 /*
72  * Size of shared memory map
73  */
74 #ifndef SHMMAXPGS
75 #define	SHMMAXPGS		1024
76 #endif
77 
78 /* Size of user raw I/O map */
79 #ifndef USRIOSIZE
80 #define	USRIOSIZE		(MAXBSIZE / NBPG * 8)
81 #endif
82 
83 #define	VM_PHYS_SIZE		(USRIOSIZE * NBPG)
84 
85 /* Physical memory segments */
86 #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
87 #define	VM_PHYSSEG_NOADD
88 
89 #define	sh3_round_page(x)	((((u_int32_t)(x)) + PGOFSET) & ~PGOFSET)
90 #define	sh3_trunc_page(x)	((u_int32_t)(x) & ~PGOFSET)
91 #define	sh3_btop(x)		((u_int32_t)(x) >> PGSHIFT)
92 #define	sh3_ptob(x)		((u_int32_t)(x) << PGSHIFT)
93 
94 /* pmap-specific data store in the vm_page structure. */
95 #define	__HAVE_VM_PAGE_MD
96 #define	PVH_REFERENCED		1
97 #define	PVH_MODIFIED		2
98 
99 #ifndef _LOCORE
100 struct pv_entry;
101 struct vm_page_md {
102 	SLIST_HEAD(, pv_entry) pvh_head;
103 	int pvh_flags;
104 };
105 
106 #define	VM_MDPAGE_INIT(pg)						\
107 do {									\
108 	struct vm_page_md *pvh = &(pg)->mdpage;				\
109 	SLIST_INIT(&pvh->pvh_head);					\
110 	pvh->pvh_flags = 0;						\
111 } while (/*CONSTCOND*/0)
112 #endif /* _LOCORE */
113 #endif /* !_SH3_VMPARAM_H_ */
114