Annotation of src/sys/uvm/uvm.h, Revision 1.1.1.1
1.1 mrg 1: /* $Id: uvm.h,v 1.1.2.14 1998/02/02 20:07:19 chuck Exp $ */
2:
3: /*
4: * XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
5: * >>>USE AT YOUR OWN RISK, WORK IS NOT FINISHED<<<
6: */
7: /*
8: *
9: * Copyright (c) 1997 Charles D. Cranor and Washington University.
10: * All rights reserved.
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
20: * 3. All advertising materials mentioning features or use of this software
21: * must display the following acknowledgement:
22: * This product includes software developed by Charles D. Cranor and
23: * Washington University.
24: * 4. The name of the author may not be used to endorse or promote products
25: * derived from this software without specific prior written permission.
26: *
27: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37: */
38:
39: #include <uvm/uvm_extern.h>
40:
41: #include <uvm/uvm_stat.h>
42:
43: /*
44: * pull in prototypes
45: */
46:
47: #include <uvm/uvm_amap.h>
48: #include <uvm/uvm_aobj.h>
49: #include <uvm/uvm_fault.h>
50: #include <uvm/uvm_glue.h>
51: #include <uvm/uvm_km.h>
52: #include <uvm/uvm_loan.h>
53: #include <uvm/uvm_map.h>
54: #include <uvm/uvm_object.h>
55: #include <uvm/uvm_page.h>
56: #include <uvm/uvm_pager.h>
57: #include <uvm/uvm_pdaemon.h>
58: #include <uvm/uvm_swap.h>
59:
60: /*
61: * uvm structure (vm global state: collected in one structure for ease
62: * of reference...)
63: */
64:
65: struct uvm {
66: /* vm_page related parameters */
67: /* vm_page queues */
68: struct pglist page_free; /* unallocated pages */
69: struct pglist page_active; /* allocated pages, in use */
70: struct pglist page_inactive_swp;/* pages inactive (reclaim or free) */
71: struct pglist page_inactive_obj;/* pages inactive (reclaim or free) */
72: #if NCPU > 1
73: simple_lock_data_t pageqlock; /* lock for active/inactive page q */
74: simple_lock_data_t fpageqlock; /* lock for free page q */
75: #endif /* NCPU > 1 */
76: /* page daemon trigger */
77: int pagedaemon; /* daemon sleeps on this */
78: struct proc *pagedaemon_proc; /* daemon's pid */
79: simple_lock_data_t pagedaemon_lock;
80: /* page hash */
81: struct pglist *page_hash; /* page hash table (vp/off->page) */
82: int page_nhash; /* number of buckets */
83: int page_hashmask; /* hash mask */
84: #if NCPU > 1
85: simple_lock_data_t hashlock; /* lock on page_hash array */
86: #endif
87: /* anon stuff */
88: struct vm_anon *afree; /* anon free list */
89: #if NCPU > 1
90: simple_lock_data_t afreelock; /* lock on anon free list */
91: #endif /* NCPU > 1 */
92:
93: /* static kernel map entry pool */
94: vm_map_entry_t kentry_free; /* free page pool */
95: #if NCPU > 1
96: simple_lock_data_t kentry_lock;
97: #endif
98:
99: /* aio_done is locked by uvm.pagedaemon_lock and splbio! */
100: struct uvm_aiohead aio_done; /* done async i/o reqs */
101:
102: /* pager VM area bounds */
103: vm_offset_t pager_sva; /* start of pager VA area */
104: vm_offset_t pager_eva; /* end of pager VA area */
105:
106: /* kernel object: to support anonymous pageable kernel memory */
107: struct uvm_object *kernel_object;
108: };
109:
110: extern struct uvm uvm;
111:
112: /*
113: * vm_map_entry etype bits:
114: */
115:
116: #define UVM_ET_OBJ 0x01 /* it is a uvm_object */
117: #define UVM_ET_MAP 0x02 /* it is a vm_map */
118: #define UVM_ET_SUBMAP 0x04 /* it is a submap (MAP must be 1 too) */
119: #define UVM_ET_COPYONWRITE 0x08 /* copy_on_write */
120: #define UVM_ET_NEEDSCOPY 0x10 /* needs_copy */
121:
122: #define UVM_ET_ISOBJ(E) (((E)->etype & UVM_ET_OBJ) != 0)
123: #define UVM_ET_ISMAP(E) (((E)->etype & UVM_ET_MAP) != 0)
124: #define UVM_ET_ISSUBMAP(E) (((E)->etype & UVM_ET_SUBMAP) != 0)
125: #define UVM_ET_ISCOPYONWRITE(E) (((E)->etype & UVM_ET_COPYONWRITE) != 0)
126: #define UVM_ET_ISNEEDSCOPY(E) (((E)->etype & UVM_ET_NEEDSCOPY) != 0)
127:
128: /*
129: * macros
130: */
131:
132: /*
133: * UVM_UNLOCK_AND_WAIT: atomic unlock+wait... front end for the
134: * (poorly named) thread_sleep_msg function.
135: */
136:
137: #if NCPU > 1
138:
139: #define UVM_UNLOCK_AND_WAIT(event,lock,intr,msg, timo) \
140: thread_sleep_msg(event,lock,intr,msg, timo)
141:
142: #else
143:
144: #define UVM_UNLOCK_AND_WAIT(event,lock,intr,msg, timo) \
145: thread_sleep_msg(event,NULL,intr,msg, timo)
146:
147: #endif
148:
149: /*
150: * UVM_PAGE_OWN: track page ownership (only if UVM_PAGE_TRKOWN)
151: */
152:
153: #if defined(UVM_PAGE_TRKOWN)
154:
155: #define UVM_PAGE_OWN(PG, TAG) uvm_page_own(PG, TAG)
156:
157: #else /* UVM_PAGE_TRKOWN */
158:
159: #define UVM_PAGE_OWN(PG, TAG) /* nothing */
160:
161: #endif /* UVM_PAGE_TRKOWN */
162:
163: /*
164: * pull in inlines
165: */
166:
167: #include <uvm/uvm_amap_i.h>
168: #include <uvm/uvm_fault_i.h>
169: #include <uvm/uvm_map_i.h>
170: #include <uvm/uvm_page_i.h>
171: #include <uvm/uvm_pager_i.h>
CVSweb <webmaster@jp.NetBSD.org>