uvm_extern.h revision 1.64 1 /* $NetBSD: uvm_extern.h,v 1.64 2001/05/26 21:27:21 chs Exp $ */
2
3 /*
4 *
5 * Copyright (c) 1997 Charles D. Cranor and Washington University.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Charles D. Cranor and
19 * Washington University.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * from: Id: uvm_extern.h,v 1.1.2.21 1998/02/07 01:16:53 chs Exp
35 */
36
37 /*-
38 * Copyright (c) 1991, 1992, 1993
39 * The Regents of the University of California. All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. All advertising materials mentioning features or use of this software
50 * must display the following acknowledgement:
51 * This product includes software developed by the University of
52 * California, Berkeley and its contributors.
53 * 4. Neither the name of the University nor the names of its contributors
54 * may be used to endorse or promote products derived from this software
55 * without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
58 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
61 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * SUCH DAMAGE.
68 *
69 * @(#)vm_extern.h 8.5 (Berkeley) 5/3/95
70 */
71
72 #ifndef _UVM_UVM_EXTERN_H_
73 #define _UVM_UVM_EXTERN_H_
74
75 /*
76 * uvm_extern.h: this file defines the external interface to the VM system.
77 *
78 * this should be the only file included by non-VM parts of the kernel
79 * which need access to VM services. if you want to know the interface
80 * to the MI VM layer without knowing the details, this is the file to
81 * learn.
82 *
83 * NOTE: vm system calls are prototyped in syscallargs.h
84 */
85
86 /*
87 * typedefs, necessary for standard UVM headers.
88 */
89
90 typedef unsigned int uvm_flag_t;
91 typedef int vm_fault_t;
92
93 typedef int vm_inherit_t; /* XXX: inheritance codes */
94 typedef off_t voff_t; /* XXX: offset within a uvm_object */
95
96 union vm_map_object;
97 typedef union vm_map_object vm_map_object_t;
98
99 struct vm_map_entry;
100 typedef struct vm_map_entry *vm_map_entry_t;
101
102 struct vm_map;
103 typedef struct vm_map *vm_map_t;
104
105 struct vm_page;
106
107 /*
108 * defines
109 */
110
111 /*
112 * the following defines are for uvm_map and functions which call it.
113 */
114
115 /* protections bits */
116 #define UVM_PROT_MASK 0x07 /* protection mask */
117 #define UVM_PROT_NONE 0x00 /* protection none */
118 #define UVM_PROT_ALL 0x07 /* everything */
119 #define UVM_PROT_READ 0x01 /* read */
120 #define UVM_PROT_WRITE 0x02 /* write */
121 #define UVM_PROT_EXEC 0x04 /* exec */
122
123 /* protection short codes */
124 #define UVM_PROT_R 0x01 /* read */
125 #define UVM_PROT_W 0x02 /* write */
126 #define UVM_PROT_RW 0x03 /* read-write */
127 #define UVM_PROT_X 0x04 /* exec */
128 #define UVM_PROT_RX 0x05 /* read-exec */
129 #define UVM_PROT_WX 0x06 /* write-exec */
130 #define UVM_PROT_RWX 0x07 /* read-write-exec */
131
132 /* 0x08: not used */
133
134 /* inherit codes */
135 #define UVM_INH_MASK 0x30 /* inherit mask */
136 #define UVM_INH_SHARE 0x00 /* "share" */
137 #define UVM_INH_COPY 0x10 /* "copy" */
138 #define UVM_INH_NONE 0x20 /* "none" */
139 #define UVM_INH_DONATE 0x30 /* "donate" << not used */
140
141 /* 0x40, 0x80: not used */
142
143 /* bits 0x700: max protection, 0x800: not used */
144
145 /* bits 0x7000: advice, 0x8000: not used */
146 /* advice: matches MADV_* from sys/mman.h */
147 #define UVM_ADV_NORMAL 0x0 /* 'normal' */
148 #define UVM_ADV_RANDOM 0x1 /* 'random' */
149 #define UVM_ADV_SEQUENTIAL 0x2 /* 'sequential' */
150 /* 0x3: will need, 0x4: dontneed */
151 #define UVM_ADV_MASK 0x7 /* mask */
152
153 /* mapping flags */
154 #define UVM_FLAG_FIXED 0x010000 /* find space */
155 #define UVM_FLAG_OVERLAY 0x020000 /* establish overlay */
156 #define UVM_FLAG_NOMERGE 0x040000 /* don't merge map entries */
157 #define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
158 #define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
159 #define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
160
161 /* macros to extract info */
162 #define UVM_PROTECTION(X) ((X) & UVM_PROT_MASK)
163 #define UVM_INHERIT(X) (((X) & UVM_INH_MASK) >> 4)
164 #define UVM_MAXPROTECTION(X) (((X) >> 8) & UVM_PROT_MASK)
165 #define UVM_ADVICE(X) (((X) >> 12) & UVM_ADV_MASK)
166
167 #define UVM_MAPFLAG(PROT,MAXPROT,INH,ADVICE,FLAGS) \
168 ((MAXPROT << 8)|(PROT)|(INH)|((ADVICE) << 12)|(FLAGS))
169
170 /* magic offset value */
171 #define UVM_UNKNOWN_OFFSET ((voff_t) -1)
172 /* offset not known(obj) or don't care(!obj) */
173
174 /*
175 * the following defines are for uvm_km_kmemalloc's flags
176 */
177 #define UVM_KMF_NOWAIT 0x1 /* matches M_NOWAIT */
178 #define UVM_KMF_VALLOC 0x2 /* allocate VA only */
179 #define UVM_KMF_TRYLOCK UVM_FLAG_TRYLOCK /* try locking only */
180
181 /*
182 * the following defines the strategies for uvm_pagealloc_strat()
183 */
184 #define UVM_PGA_STRAT_NORMAL 0 /* high -> low free list walk */
185 #define UVM_PGA_STRAT_ONLY 1 /* only specified free list */
186 #define UVM_PGA_STRAT_FALLBACK 2 /* ONLY falls back on NORMAL */
187
188 /*
189 * flags for uvm_pagealloc_strat()
190 */
191 #define UVM_PGA_USERESERVE 0x0001 /* ok to use reserve pages */
192 #define UVM_PGA_ZERO 0x0002 /* returned page must be zero'd */
193
194 /*
195 * the following defines are for ubc_alloc's flags
196 */
197 #define UBC_READ 0
198 #define UBC_WRITE 1
199
200 /*
201 * flags for uvn_findpages().
202 */
203 #define UFP_ALL 0x0
204 #define UFP_NOWAIT 0x1
205 #define UFP_NOALLOC 0x2
206 #define UFP_NOCACHE 0x4
207 #define UFP_NORDONLY 0x8
208
209 /*
210 * lockflags that control the locking behavior of various functions.
211 */
212 #define UVM_LK_ENTER 0x00000001 /* map locked on entry */
213 #define UVM_LK_EXIT 0x00000002 /* leave map locked on exit */
214
215 /*
216 * structures
217 */
218
219 struct core;
220 struct mount;
221 struct pglist;
222 struct proc;
223 struct ucred;
224 struct uio;
225 struct uvm_object;
226 struct vm_anon;
227 struct vmspace;
228 struct pmap;
229 struct vnode;
230 struct pool;
231 struct simplelock;
232
233 extern struct pool *uvm_aiobuf_pool;
234
235 /*
236 * uvmexp: global data structures that are exported to parts of the kernel
237 * other than the vm system.
238 */
239
240 struct uvmexp {
241 /* vm_page constants */
242 int pagesize; /* size of a page (PAGE_SIZE): must be power of 2 */
243 int pagemask; /* page mask */
244 int pageshift; /* page shift */
245
246 /* vm_page counters */
247 int npages; /* number of pages we manage */
248 int free; /* number of free pages */
249 int active; /* number of active pages */
250 int inactive; /* number of pages that we free'd but may want back */
251 int paging; /* number of pages in the process of being paged out */
252 int wired; /* number of wired pages */
253
254 int ncolors; /* number of page color buckets: must be p-o-2 */
255 int colormask; /* color bucket mask */
256
257 /*
258 * Adding anything before this line will break binary compatibility
259 * with top(1) on NetBSD 1.5.
260 */
261
262 int zeropages; /* number of zero'd pages */
263 int reserve_pagedaemon; /* number of pages reserved for pagedaemon */
264 int reserve_kernel; /* number of pages reserved for kernel */
265 int anonpages; /* number of pages used by anon pagers */
266 int vnodepages; /* number of pages used by vnode page cache */
267 int vtextpages; /* number of pages used by vtext vnodes */
268
269 /* pageout params */
270 int freemin; /* min number of free pages */
271 int freetarg; /* target number of free pages */
272 int inactarg; /* target number of inactive pages */
273 int wiredmax; /* max number of wired pages */
274 int anonmin; /* min threshold for anon pages */
275 int vtextmin; /* min threshold for vtext pages */
276 int vnodemin; /* min threshold for vnode pages */
277 int anonminpct; /* min percent anon pages */
278 int vtextminpct;/* min percent vtext pages */
279 int vnodeminpct;/* min percent vnode pages */
280
281 /* swap */
282 int nswapdev; /* number of configured swap devices in system */
283 int swpages; /* number of PAGE_SIZE'ed swap pages */
284 int swpginuse; /* number of swap pages in use */
285 int swpgonly; /* number of swap pages in use, not also in RAM */
286 int nswget; /* number of times fault calls uvm_swap_get() */
287 int nanon; /* number total of anon's in system */
288 int nanonneeded;/* number of anons currently needed */
289 int nfreeanon; /* number of free anon's */
290
291 /* stat counters */
292 int faults; /* page fault count */
293 int traps; /* trap count */
294 int intrs; /* interrupt count */
295 int swtch; /* context switch count */
296 int softs; /* software interrupt count */
297 int syscalls; /* system calls */
298 int pageins; /* pagein operation count */
299 /* pageouts are in pdpageouts below */
300 int swapins; /* swapins */
301 int swapouts; /* swapouts */
302 int pgswapin; /* pages swapped in */
303 int pgswapout; /* pages swapped out */
304 int forks; /* forks */
305 int forks_ppwait; /* forks where parent waits */
306 int forks_sharevm; /* forks where vmspace is shared */
307 int pga_zerohit; /* pagealloc where zero wanted and zero
308 was available */
309 int pga_zeromiss; /* pagealloc where zero wanted and zero
310 not available */
311 int zeroaborts; /* number of times page zeroing was
312 aborted */
313 int colorhit; /* pagealloc where we got optimal color */
314 int colormiss; /* pagealloc where we didn't */
315
316 /* fault subcounters */
317 int fltnoram; /* number of times fault was out of ram */
318 int fltnoanon; /* number of times fault was out of anons */
319 int fltpgwait; /* number of times fault had to wait on a page */
320 int fltpgrele; /* number of times fault found a released page */
321 int fltrelck; /* number of times fault relock called */
322 int fltrelckok; /* number of times fault relock is a success */
323 int fltanget; /* number of times fault gets anon page */
324 int fltanretry; /* number of times fault retrys an anon get */
325 int fltamcopy; /* number of times fault clears "needs copy" */
326 int fltnamap; /* number of times fault maps a neighbor anon page */
327 int fltnomap; /* number of times fault maps a neighbor obj page */
328 int fltlget; /* number of times fault does a locked pgo_get */
329 int fltget; /* number of times fault does an unlocked get */
330 int flt_anon; /* number of times fault anon (case 1a) */
331 int flt_acow; /* number of times fault anon cow (case 1b) */
332 int flt_obj; /* number of times fault is on object page (2a) */
333 int flt_prcopy; /* number of times fault promotes with copy (2b) */
334 int flt_przero; /* number of times fault promotes with zerofill (2b) */
335
336 /* daemon counters */
337 int pdwoke; /* number of times daemon woke up */
338 int pdrevs; /* number of times daemon rev'd clock hand */
339 int pdswout; /* number of times daemon called for swapout */
340 int pdfreed; /* number of pages daemon freed since boot */
341 int pdscans; /* number of pages daemon scaned since boot */
342 int pdanscan; /* number of anonymous pages scanned by daemon */
343 int pdobscan; /* number of object pages scanned by daemon */
344 int pdreact; /* number of pages daemon reactivated since boot */
345 int pdbusy; /* number of times daemon found a busy page */
346 int pdpageouts; /* number of times daemon started a pageout */
347 int pdpending; /* number of times daemon got a pending pagout */
348 int pddeact; /* number of pages daemon deactivates */
349 int pdreanon; /* anon pages reactivated due to min threshold */
350 int pdrevnode; /* vnode pages reactivated due to min threshold */
351 int pdrevtext; /* vtext pages reactivated due to min threshold */
352
353 /* kernel memory objects: managed by uvm_km_kmemalloc() only! */
354 struct uvm_object *kmem_object;
355 struct uvm_object *mb_object;
356 };
357
358 /*
359 * The following structure is 64-bit alignment safe. New elements
360 * should only be added to the end of this structure so binary
361 * compatibility can be preserved.
362 */
363 struct uvmexp_sysctl {
364 int64_t pagesize;
365 int64_t pagemask;
366 int64_t pageshift;
367 int64_t npages;
368 int64_t free;
369 int64_t active;
370 int64_t inactive;
371 int64_t paging;
372 int64_t wired;
373 int64_t zeropages;
374 int64_t reserve_pagedaemon;
375 int64_t reserve_kernel;
376 int64_t freemin;
377 int64_t freetarg;
378 int64_t inactarg;
379 int64_t wiredmax;
380 int64_t nswapdev;
381 int64_t swpages;
382 int64_t swpginuse;
383 int64_t swpgonly;
384 int64_t nswget;
385 int64_t nanon;
386 int64_t nanonneeded;
387 int64_t nfreeanon;
388 int64_t faults;
389 int64_t traps;
390 int64_t intrs;
391 int64_t swtch;
392 int64_t softs;
393 int64_t syscalls;
394 int64_t pageins;
395 int64_t swapins;
396 int64_t swapouts;
397 int64_t pgswapin;
398 int64_t pgswapout;
399 int64_t forks;
400 int64_t forks_ppwait;
401 int64_t forks_sharevm;
402 int64_t pga_zerohit;
403 int64_t pga_zeromiss;
404 int64_t zeroaborts;
405 int64_t fltnoram;
406 int64_t fltnoanon;
407 int64_t fltpgwait;
408 int64_t fltpgrele;
409 int64_t fltrelck;
410 int64_t fltrelckok;
411 int64_t fltanget;
412 int64_t fltanretry;
413 int64_t fltamcopy;
414 int64_t fltnamap;
415 int64_t fltnomap;
416 int64_t fltlget;
417 int64_t fltget;
418 int64_t flt_anon;
419 int64_t flt_acow;
420 int64_t flt_obj;
421 int64_t flt_prcopy;
422 int64_t flt_przero;
423 int64_t pdwoke;
424 int64_t pdrevs;
425 int64_t pdswout;
426 int64_t pdfreed;
427 int64_t pdscans;
428 int64_t pdanscan;
429 int64_t pdobscan;
430 int64_t pdreact;
431 int64_t pdbusy;
432 int64_t pdpageouts;
433 int64_t pdpending;
434 int64_t pddeact;
435 int64_t anonpages;
436 int64_t vnodepages;
437 int64_t vtextpages;
438 int64_t colorhit;
439 int64_t colormiss;
440 int64_t ncolors;
441 };
442
443 #ifdef _KERNEL
444 extern struct uvmexp uvmexp;
445 #endif
446
447 /*
448 * Finally, bring in standard UVM headers.
449 */
450 #include <sys/vmmeter.h>
451 #include <sys/queue.h>
452 #include <uvm/uvm_param.h>
453 #include <sys/lock.h>
454 #include <uvm/uvm_prot.h>
455 #include <uvm/uvm_page.h>
456 #include <uvm/uvm_pmap.h>
457 #include <uvm/uvm_map.h>
458 #include <uvm/uvm_fault.h>
459 #include <uvm/uvm_pager.h>
460
461 /*
462 * Shareable process virtual address space.
463 * May eventually be merged with vm_map.
464 * Several fields are temporary (text, data stuff).
465 */
466 struct vmspace {
467 struct vm_map vm_map; /* VM address map */
468 int vm_refcnt; /* number of references */
469 caddr_t vm_shm; /* SYS5 shared memory private data XXX */
470 /* we copy from vm_startcopy to the end of the structure on fork */
471 #define vm_startcopy vm_rssize
472 segsz_t vm_rssize; /* current resident set size in pages */
473 segsz_t vm_swrss; /* resident set size before last swap */
474 segsz_t vm_tsize; /* text size (pages) XXX */
475 segsz_t vm_dsize; /* data size (pages) XXX */
476 segsz_t vm_ssize; /* stack size (pages) */
477 caddr_t vm_taddr; /* user virtual address of text XXX */
478 caddr_t vm_daddr; /* user virtual address of data XXX */
479 caddr_t vm_maxsaddr; /* user VA at max stack growth */
480 caddr_t vm_minsaddr; /* user VA at top of stack */
481 };
482
483 #ifdef _KERNEL
484
485 /*
486 * the various kernel maps, owned by MD code
487 */
488 extern vm_map_t exec_map;
489 extern vm_map_t kernel_map;
490 extern vm_map_t kmem_map;
491 extern vm_map_t mb_map;
492 extern vm_map_t phys_map;
493
494 /*
495 * macros
496 */
497
498 /* zalloc zeros memory, alloc does not */
499 #define uvm_km_zalloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,TRUE)
500 #define uvm_km_alloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,FALSE)
501
502 #endif /* _KERNEL */
503
504 #define vm_resident_count(vm) (pmap_resident_count((vm)->vm_map.pmap))
505
506 /* XXX clean up later */
507 struct buf;
508 struct loadavg;
509 struct proc;
510 struct pmap;
511 struct vmspace;
512 struct vmtotal;
513 struct mount;
514 struct vnode;
515 struct core;
516
517 #ifdef _KERNEL
518
519 /* vm_machdep.c */
520 void vmapbuf __P((struct buf *, vsize_t));
521 void vunmapbuf __P((struct buf *, vsize_t));
522 void pagemove __P((caddr_t, caddr_t, size_t));
523 #ifndef cpu_swapin
524 void cpu_swapin __P((struct proc *));
525 #endif
526 #ifndef cpu_swapout
527 void cpu_swapout __P((struct proc *));
528 #endif
529
530 /* uvm_aobj.c */
531 struct uvm_object *uao_create __P((vsize_t, int));
532 void uao_detach __P((struct uvm_object *));
533 void uao_detach_locked __P((struct uvm_object *));
534 void uao_reference __P((struct uvm_object *));
535 void uao_reference_locked __P((struct uvm_object *));
536
537 /* uvm_bio.c */
538 void ubc_init __P((void));
539 void * ubc_alloc __P((struct uvm_object *, voff_t, vsize_t *,
540 int));
541 void ubc_release __P((void *, vsize_t));
542 void ubc_flush __P((struct uvm_object *, voff_t, voff_t));
543
544 /* uvm_fault.c */
545 int uvm_fault __P((vm_map_t, vaddr_t, vm_fault_t,
546 vm_prot_t));
547 /* handle a page fault */
548
549 /* uvm_glue.c */
550 #if defined(KGDB)
551 void uvm_chgkprot __P((caddr_t, size_t, int));
552 #endif
553 void uvm_fork __P((struct proc *, struct proc *, boolean_t,
554 void *, size_t, void (*)(void *), void *));
555 void uvm_exit __P((struct proc *));
556 void uvm_init_limits __P((struct proc *));
557 boolean_t uvm_kernacc __P((caddr_t, size_t, int));
558 __dead void uvm_scheduler __P((void)) __attribute__((noreturn));
559 void uvm_swapin __P((struct proc *));
560 boolean_t uvm_useracc __P((caddr_t, size_t, int));
561 int uvm_vslock __P((struct proc *, caddr_t, size_t,
562 vm_prot_t));
563 void uvm_vsunlock __P((struct proc *, caddr_t, size_t));
564
565
566 /* uvm_init.c */
567 void uvm_init __P((void));
568 /* init the uvm system */
569
570 /* uvm_io.c */
571 int uvm_io __P((vm_map_t, struct uio *));
572
573 /* uvm_km.c */
574 vaddr_t uvm_km_alloc1 __P((vm_map_t, vsize_t, boolean_t));
575 void uvm_km_free __P((vm_map_t, vaddr_t, vsize_t));
576 void uvm_km_free_wakeup __P((vm_map_t, vaddr_t,
577 vsize_t));
578 vaddr_t uvm_km_kmemalloc __P((vm_map_t, struct uvm_object *,
579 vsize_t, int));
580 struct vm_map *uvm_km_suballoc __P((vm_map_t, vaddr_t *,
581 vaddr_t *, vsize_t, int,
582 boolean_t, vm_map_t));
583 vaddr_t uvm_km_valloc __P((vm_map_t, vsize_t));
584 vaddr_t uvm_km_valloc_align __P((vm_map_t, vsize_t, vsize_t));
585 vaddr_t uvm_km_valloc_wait __P((vm_map_t, vsize_t));
586 vaddr_t uvm_km_valloc_prefer_wait __P((vm_map_t, vsize_t,
587 voff_t));
588 vaddr_t uvm_km_alloc_poolpage1 __P((vm_map_t,
589 struct uvm_object *, boolean_t));
590 void uvm_km_free_poolpage1 __P((vm_map_t, vaddr_t));
591
592 #define uvm_km_alloc_poolpage(waitok) uvm_km_alloc_poolpage1(kmem_map, \
593 uvmexp.kmem_object, (waitok))
594 #define uvm_km_free_poolpage(addr) uvm_km_free_poolpage1(kmem_map, (addr))
595
596 /* uvm_map.c */
597 int uvm_map __P((vm_map_t, vaddr_t *, vsize_t,
598 struct uvm_object *, voff_t, vsize_t,
599 uvm_flag_t));
600 int uvm_map_pageable __P((vm_map_t, vaddr_t,
601 vaddr_t, boolean_t, int));
602 int uvm_map_pageable_all __P((vm_map_t, int, vsize_t));
603 boolean_t uvm_map_checkprot __P((vm_map_t, vaddr_t,
604 vaddr_t, vm_prot_t));
605 int uvm_map_protect __P((vm_map_t, vaddr_t,
606 vaddr_t, vm_prot_t, boolean_t));
607 struct vmspace *uvmspace_alloc __P((vaddr_t, vaddr_t,
608 boolean_t));
609 void uvmspace_init __P((struct vmspace *, struct pmap *,
610 vaddr_t, vaddr_t, boolean_t));
611 void uvmspace_exec __P((struct proc *, vaddr_t, vaddr_t));
612 struct vmspace *uvmspace_fork __P((struct vmspace *));
613 void uvmspace_free __P((struct vmspace *));
614 void uvmspace_share __P((struct proc *, struct proc *));
615 void uvmspace_unshare __P((struct proc *));
616
617
618 /* uvm_meter.c */
619 void uvm_meter __P((void));
620 int uvm_sysctl __P((int *, u_int, void *, size_t *,
621 void *, size_t, struct proc *));
622
623 /* uvm_mmap.c */
624 int uvm_mmap __P((vm_map_t, vaddr_t *, vsize_t,
625 vm_prot_t, vm_prot_t, int,
626 void *, voff_t, vsize_t));
627
628 /* uvm_page.c */
629 struct vm_page *uvm_pagealloc_strat __P((struct uvm_object *,
630 voff_t, struct vm_anon *, int, int, int));
631 #define uvm_pagealloc(obj, off, anon, flags) \
632 uvm_pagealloc_strat((obj), (off), (anon), (flags), \
633 UVM_PGA_STRAT_NORMAL, 0)
634 void uvm_pagerealloc __P((struct vm_page *,
635 struct uvm_object *, voff_t));
636 /* Actually, uvm_page_physload takes PF#s which need their own type */
637 void uvm_page_physload __P((paddr_t, paddr_t,
638 paddr_t, paddr_t, int));
639 void uvm_setpagesize __P((void));
640
641 /* uvm_pager.c */
642 void uvm_aio_biodone1 __P((struct buf *));
643 void uvm_aio_biodone __P((struct buf *));
644 void uvm_aio_aiodone __P((struct buf *));
645
646 /* uvm_pdaemon.c */
647 void uvm_pageout __P((void *));
648 void uvm_aiodone_daemon __P((void *));
649
650 /* uvm_pglist.c */
651 int uvm_pglistalloc __P((psize_t, paddr_t,
652 paddr_t, paddr_t, paddr_t,
653 struct pglist *, int, int));
654 void uvm_pglistfree __P((struct pglist *));
655
656 /* uvm_swap.c */
657 void uvm_swap_init __P((void));
658
659 /* uvm_unix.c */
660 int uvm_coredump __P((struct proc *, struct vnode *,
661 struct ucred *, struct core *));
662 int uvm_grow __P((struct proc *, vaddr_t));
663 /* should only be needed if COMPAT_NETBSD32 is defined */
664 struct core32;
665 int uvm_coredump32 __P((struct proc *, struct vnode *,
666 struct ucred *, struct core32 *));
667
668 /* uvm_user.c */
669 void uvm_deallocate __P((vm_map_t, vaddr_t, vsize_t));
670
671 /* uvm_vnode.c */
672 void uvm_vnp_setsize __P((struct vnode *, voff_t));
673 void uvm_vnp_sync __P((struct mount *));
674 struct uvm_object *uvn_attach __P((void *, vm_prot_t));
675 void uvn_findpages __P((struct uvm_object *, voff_t,
676 int *, struct vm_page **, int));
677 void uvm_vnp_zerorange __P((struct vnode *, off_t, size_t));
678 void uvm_vnp_asyncget __P((struct vnode *, off_t, size_t));
679
680 /* kern_malloc.c */
681 void kmeminit_nkmempages __P((void));
682 void kmeminit __P((void));
683 extern int nkmempages;
684
685 #endif /* _KERNEL */
686
687 #endif /* _UVM_UVM_EXTERN_H_ */
688