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