vmparam.h revision 1.16 1 /* $NetBSD: vmparam.h,v 1.16 2003/04/02 07:36:03 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 /*
44 * We use 4K pages on the sh3/sh4. Override the PAGE_* definitions
45 * to be compile-time constants.
46 */
47 #define PAGE_SHIFT 12
48 #define PAGE_SIZE (1 << PAGE_SHIFT)
49 #define PAGE_MASK (PAGE_SIZE - 1)
50
51 /* Virtual address map. */
52 #define VM_MIN_ADDRESS ((vaddr_t)0)
53 #define VM_MAXUSER_ADDRESS ((vaddr_t)0x7ffff000)
54 #define VM_MAX_ADDRESS ((vaddr_t)0x7ffff000)
55 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc0000000)
56 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xe0000000)
57
58 /* top of stack */
59 #define USRSTACK VM_MAXUSER_ADDRESS
60
61 /* Virtual memory resoruce limit. */
62 #define MAXTSIZ (64 * 1024 * 1024) /* max text size */
63 #ifndef MAXDSIZ
64 #define MAXDSIZ (512 * 1024 * 1024) /* max data size */
65 #endif
66 #ifndef MAXSSIZ
67 #define MAXSSIZ (32 * 1024 * 1024) /* max stack size */
68 #endif
69
70 /* initial data size limit */
71 #ifndef DFLDSIZ
72 #define DFLDSIZ (128 * 1024 * 1024)
73 #endif
74 /* initial stack size limit */
75 #ifndef DFLSSIZ
76 #define DFLSSIZ (2 * 1024 * 1024)
77 #endif
78
79 /*
80 * Size of shared memory map
81 */
82 #ifndef SHMMAXPGS
83 #define SHMMAXPGS 1024
84 #endif
85
86 /* Size of user raw I/O map */
87 #ifndef USRIOSIZE
88 #define USRIOSIZE (MAXBSIZE / PAGE_SIZE * 8)
89 #endif
90
91 #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
92
93 /* Physical memory segments */
94 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
95 #define VM_PHYSSEG_NOADD
96
97 #define sh3_round_page(x) ((((u_int32_t)(x)) + PGOFSET) & ~PGOFSET)
98 #define sh3_trunc_page(x) ((u_int32_t)(x) & ~PGOFSET)
99 #define sh3_btop(x) ((u_int32_t)(x) >> PGSHIFT)
100 #define sh3_ptob(x) ((u_int32_t)(x) << PGSHIFT)
101
102 /* pmap-specific data store in the vm_page structure. */
103 #define __HAVE_VM_PAGE_MD
104 #define PVH_REFERENCED 1
105 #define PVH_MODIFIED 2
106
107 #ifndef _LOCORE
108 struct pv_entry;
109 struct vm_page_md {
110 SLIST_HEAD(, pv_entry) pvh_head;
111 int pvh_flags;
112 };
113
114 #define VM_MDPAGE_INIT(pg) \
115 do { \
116 struct vm_page_md *pvh = &(pg)->mdpage; \
117 SLIST_INIT(&pvh->pvh_head); \
118 pvh->pvh_flags = 0; \
119 } while (/*CONSTCOND*/0)
120 #endif /* _LOCORE */
121 #endif /* !_SH3_VMPARAM_H_ */
122