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