vmparam.h revision 1.1.4.2 1 1.1.4.2 elad /* $NetBSD: vmparam.h,v 1.1.4.2 2006/04/19 02:33:00 elad Exp $ */
2 1.1.4.2 elad
3 1.1.4.2 elad /*-
4 1.1.4.2 elad * Copyright (c) 1990 The Regents of the University of California.
5 1.1.4.2 elad * All rights reserved.
6 1.1.4.2 elad *
7 1.1.4.2 elad * This code is derived from software contributed to Berkeley by
8 1.1.4.2 elad * William Jolitz.
9 1.1.4.2 elad *
10 1.1.4.2 elad * Redistribution and use in source and binary forms, with or without
11 1.1.4.2 elad * modification, are permitted provided that the following conditions
12 1.1.4.2 elad * are met:
13 1.1.4.2 elad * 1. Redistributions of source code must retain the above copyright
14 1.1.4.2 elad * notice, this list of conditions and the following disclaimer.
15 1.1.4.2 elad * 2. Redistributions in binary form must reproduce the above copyright
16 1.1.4.2 elad * notice, this list of conditions and the following disclaimer in the
17 1.1.4.2 elad * documentation and/or other materials provided with the distribution.
18 1.1.4.2 elad * 3. Neither the name of the University nor the names of its contributors
19 1.1.4.2 elad * may be used to endorse or promote products derived from this software
20 1.1.4.2 elad * without specific prior written permission.
21 1.1.4.2 elad *
22 1.1.4.2 elad * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 1.1.4.2 elad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.1.4.2 elad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.1.4.2 elad * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 1.1.4.2 elad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.1.4.2 elad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.1.4.2 elad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.1.4.2 elad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.1.4.2 elad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.1.4.2 elad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1.4.2 elad * SUCH DAMAGE.
33 1.1.4.2 elad *
34 1.1.4.2 elad * @(#)vmparam.h 5.9 (Berkeley) 5/12/91
35 1.1.4.2 elad */
36 1.1.4.2 elad
37 1.1.4.2 elad #ifndef _VMPARAM_H_
38 1.1.4.2 elad #define _VMPARAM_H_
39 1.1.4.2 elad
40 1.1.4.2 elad #include <sys/tree.h>
41 1.1.4.2 elad
42 1.1.4.2 elad #define USRSTACK VM_MAX_ADDRESS /* XXX: Revisit vm address space. */
43 1.1.4.2 elad
44 1.1.4.2 elad /*
45 1.1.4.2 elad * Virtual memory related constants, all in bytes
46 1.1.4.2 elad */
47 1.1.4.2 elad #ifndef MAXTSIZ
48 1.1.4.2 elad #define MAXTSIZ (1<<30) /* max text size (1G) */
49 1.1.4.2 elad #endif
50 1.1.4.2 elad #ifndef DFLDSIZ
51 1.1.4.2 elad #define DFLDSIZ (1<<27) /* initial data size (128M) */
52 1.1.4.2 elad #endif
53 1.1.4.2 elad #ifndef MAXDSIZ
54 1.1.4.2 elad #define MAXDSIZ (1<<30) /* max data size (1G) */
55 1.1.4.2 elad #endif
56 1.1.4.2 elad #ifndef DFLSSIZ
57 1.1.4.2 elad #define DFLSSIZ (1<<21) /* initial stack size (2M) */
58 1.1.4.2 elad #endif
59 1.1.4.2 elad #ifndef MAXSSIZ
60 1.1.4.2 elad #define MAXSSIZ (1<<28) /* max stack size (256M) */
61 1.1.4.2 elad #endif
62 1.1.4.2 elad #ifndef SGROWSIZ
63 1.1.4.2 elad #define SGROWSIZ (128UL*1024) /* amount to grow stack */
64 1.1.4.2 elad #endif
65 1.1.4.2 elad
66 1.1.4.2 elad
67 1.1.4.2 elad
68 1.1.4.2 elad /*
69 1.1.4.2 elad * PTEs for mapping user space into the kernel for phyio operations.
70 1.1.4.2 elad * 64 pte's are enough to cover 8 disks * MAXBSIZE.
71 1.1.4.2 elad */
72 1.1.4.2 elad #ifndef USRIOSIZE
73 1.1.4.2 elad #define USRIOSIZE 64
74 1.1.4.2 elad #endif
75 1.1.4.2 elad
76 1.1.4.2 elad /*
77 1.1.4.2 elad * Manipulating region bits of an address.
78 1.1.4.2 elad */
79 1.1.4.2 elad #define IA64_RR_BASE(n) (((u_int64_t) (n)) << 61)
80 1.1.4.2 elad #define IA64_RR_MASK(x) ((x) & ((1L << 61) - 1))
81 1.1.4.2 elad
82 1.1.4.2 elad #define IA64_PHYS_TO_RR6(x) ((x) | IA64_RR_BASE(6))
83 1.1.4.2 elad #define IA64_PHYS_TO_RR7(x) ((x) | IA64_RR_BASE(7))
84 1.1.4.2 elad
85 1.1.4.2 elad #define IA64_ID_PAGE_SHIFT 28 /* 256M */
86 1.1.4.2 elad #define IA64_ID_PAGE_SIZE (1 << IA64_ID_PAGE_SHIFT)
87 1.1.4.2 elad #define IA64_ID_PAGE_MASK (IA64_ID_PAGE_SIZE-1)
88 1.1.4.2 elad
89 1.1.4.2 elad #define PAGE_SHIFT 14 /* 16K pages by default. */
90 1.1.4.2 elad #define PAGE_SIZE (1 << PAGE_SHIFT)
91 1.1.4.2 elad #define PAGE_MASK (PAGE_SIZE - 1)
92 1.1.4.2 elad
93 1.1.4.2 elad /* user/kernel map constants */
94 1.1.4.2 elad #define VM_MIN_ADDRESS ((vaddr_t)0)
95 1.1.4.2 elad #define VM_MAX_ADDRESS ((vaddr_t) IA64_RR_BASE(5))
96 1.1.4.2 elad #define VM_GATEWAY_SIZE PAGE_SIZE
97 1.1.4.2 elad #define VM_MAXUSER_ADDRESS (VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
98 1.1.4.2 elad #define VM_MIN_KERNEL_ADDRESS VM_MAXUSER_ADDRESS
99 1.1.4.2 elad #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) (IA64_RR_BASE(6) - 1))
100 1.1.4.2 elad
101 1.1.4.2 elad #define VM_PHYSSEG_MAX 16 /* XXX: */
102 1.1.4.2 elad #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
103 1.1.4.2 elad #define VM_PHYSSEG_NOADD /* no more after vm_mem_init */
104 1.1.4.2 elad
105 1.1.4.2 elad #define VM_NFREELIST 1 /* XXX: */
106 1.1.4.2 elad #define VM_FREELIST_DEFAULT 0 /* XXX: */
107 1.1.4.2 elad
108 1.1.4.2 elad /* virtual sizes (bytes) for various kernel submaps */
109 1.1.4.2 elad #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
110 1.1.4.2 elad
111 1.1.4.2 elad #ifndef _LOCORE
112 1.1.4.2 elad /*
113 1.1.4.2 elad * pmap-specific data store in the vm_page structure.
114 1.1.4.2 elad */
115 1.1.4.2 elad #define __HAVE_VM_PAGE_MD
116 1.1.4.2 elad struct vm_page_md {
117 1.1.4.2 elad TAILQ_HEAD(,pv_entry) pv_list; /* pv_entry list */
118 1.1.4.2 elad int pv_list_count;
119 1.1.4.2 elad struct simplelock pv_slock; /* lock on this head */
120 1.1.4.2 elad int pvh_attrs; /* page attributes */
121 1.1.4.2 elad };
122 1.1.4.2 elad
123 1.1.4.2 elad #define VM_MDPAGE_INIT(pg) \
124 1.1.4.2 elad do { \
125 1.1.4.2 elad TAILQ_INIT(&(pg)->mdpage.pv_list); \
126 1.1.4.2 elad simple_lock_init(&(pg)->mdpage.pv_slock); \
127 1.1.4.2 elad } while (/*CONSTCOND*/0)
128 1.1.4.2 elad #endif /*_LOCORE*/
129 1.1.4.2 elad
130 1.1.4.2 elad #endif /* _VMPARAM_H_ */
131