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