[BACK]Return to uvm_extern.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / uvm

Annotation of src/sys/uvm/uvm_extern.h, Revision 1.76

1.76    ! thorpej     1: /*     $NetBSD: uvm_extern.h,v 1.75 2002/12/11 07:10:20 thorpej Exp $  */
1.1       mrg         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.
1.4       mrg        33:  *
                     34:  * from: Id: uvm_extern.h,v 1.1.2.21 1998/02/07 01:16:53 chs Exp
1.1       mrg        35:  */
                     36:
1.44      mrg        37: /*-
1.45      mrg        38:  * Copyright (c) 1991, 1992, 1993
1.44      mrg        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:
1.8       perry      72: #ifndef _UVM_UVM_EXTERN_H_
                     73: #define _UVM_UVM_EXTERN_H_
1.1       mrg        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: /*
1.45      mrg        87:  * typedefs, necessary for standard UVM headers.
                     88:  */
                     89:
1.65      chs        90: typedef unsigned int uvm_flag_t;
1.45      mrg        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: /*
1.1       mrg        97:  * defines
                     98:  */
                     99:
                    100: /*
                    101:  * the following defines are for uvm_map and functions which call it.
                    102:  */
                    103:
                    104: /* protections bits */
                    105: #define UVM_PROT_MASK  0x07    /* protection mask */
                    106: #define UVM_PROT_NONE  0x00    /* protection none */
                    107: #define UVM_PROT_ALL   0x07    /* everything */
                    108: #define UVM_PROT_READ  0x01    /* read */
                    109: #define UVM_PROT_WRITE  0x02   /* write */
                    110: #define UVM_PROT_EXEC  0x04    /* exec */
                    111:
                    112: /* protection short codes */
                    113: #define UVM_PROT_R     0x01    /* read */
                    114: #define UVM_PROT_W     0x02    /* write */
                    115: #define UVM_PROT_RW    0x03    /* read-write */
                    116: #define UVM_PROT_X     0x04    /* exec */
                    117: #define UVM_PROT_RX    0x05    /* read-exec */
                    118: #define UVM_PROT_WX    0x06    /* write-exec */
                    119: #define UVM_PROT_RWX   0x07    /* read-write-exec */
                    120:
                    121: /* 0x08: not used */
                    122:
                    123: /* inherit codes */
                    124: #define UVM_INH_MASK   0x30    /* inherit mask */
                    125: #define UVM_INH_SHARE  0x00    /* "share" */
                    126: #define UVM_INH_COPY   0x10    /* "copy" */
                    127: #define UVM_INH_NONE   0x20    /* "none" */
                    128: #define UVM_INH_DONATE 0x30    /* "donate" << not used */
                    129:
                    130: /* 0x40, 0x80: not used */
                    131:
                    132: /* bits 0x700: max protection, 0x800: not used */
                    133:
                    134: /* bits 0x7000: advice, 0x8000: not used */
                    135: /* advice: matches MADV_* from sys/mman.h */
                    136: #define UVM_ADV_NORMAL 0x0     /* 'normal' */
                    137: #define UVM_ADV_RANDOM 0x1     /* 'random' */
                    138: #define UVM_ADV_SEQUENTIAL 0x2 /* 'sequential' */
                    139: /* 0x3: will need, 0x4: dontneed */
                    140: #define UVM_ADV_MASK   0x7     /* mask */
                    141:
                    142: /* mapping flags */
                    143: #define UVM_FLAG_FIXED   0x010000 /* find space */
                    144: #define UVM_FLAG_OVERLAY 0x020000 /* establish overlay */
                    145: #define UVM_FLAG_NOMERGE 0x040000 /* don't merge map entries */
                    146: #define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
                    147: #define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
                    148: #define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
1.75      thorpej   149: #define UVM_FLAG_NOWAIT  0x400000 /* not allowed to sleep */
1.1       mrg       150:
                    151: /* macros to extract info */
                    152: #define UVM_PROTECTION(X)      ((X) & UVM_PROT_MASK)
                    153: #define UVM_INHERIT(X)         (((X) & UVM_INH_MASK) >> 4)
                    154: #define UVM_MAXPROTECTION(X)   (((X) >> 8) & UVM_PROT_MASK)
                    155: #define UVM_ADVICE(X)          (((X) >> 12) & UVM_ADV_MASK)
                    156:
                    157: #define UVM_MAPFLAG(PROT,MAXPROT,INH,ADVICE,FLAGS) \
                    158:        ((MAXPROT << 8)|(PROT)|(INH)|((ADVICE) << 12)|(FLAGS))
                    159:
1.67      chs       160: /* magic offset value: offset not known(obj) or don't care(!obj) */
1.38      kleink    161: #define UVM_UNKNOWN_OFFSET ((voff_t) -1)
1.1       mrg       162:
                    163: /*
                    164:  * the following defines are for uvm_km_kmemalloc's flags
                    165:  */
1.75      thorpej   166: #define UVM_KMF_VALLOC 0x1                     /* allocate VA only */
                    167: #define UVM_KMF_CANFAIL        0x2                     /* caller handles failure */
1.1       mrg       168: #define UVM_KMF_TRYLOCK        UVM_FLAG_TRYLOCK        /* try locking only */
1.75      thorpej   169: #define UVM_KMF_NOWAIT UVM_FLAG_NOWAIT         /* not allowed to sleep */
1.1       mrg       170:
                    171: /*
1.15      thorpej   172:  * the following defines the strategies for uvm_pagealloc_strat()
                    173:  */
                    174: #define        UVM_PGA_STRAT_NORMAL    0       /* high -> low free list walk */
                    175: #define        UVM_PGA_STRAT_ONLY      1       /* only specified free list */
                    176: #define        UVM_PGA_STRAT_FALLBACK  2       /* ONLY falls back on NORMAL */
                    177:
                    178: /*
1.24      chs       179:  * flags for uvm_pagealloc_strat()
                    180:  */
1.39      thorpej   181: #define UVM_PGA_USERESERVE     0x0001  /* ok to use reserve pages */
                    182: #define        UVM_PGA_ZERO            0x0002  /* returned page must be zero'd */
1.24      chs       183:
                    184: /*
1.53      chs       185:  * the following defines are for ubc_alloc's flags
                    186:  */
1.67      chs       187: #define UBC_READ       0x01
                    188: #define UBC_WRITE      0x02
                    189: #define UBC_FAULTBUSY  0x04
1.53      chs       190:
                    191: /*
                    192:  * flags for uvn_findpages().
                    193:  */
1.67      chs       194: #define UFP_ALL                0x00
                    195: #define UFP_NOWAIT     0x01
                    196: #define UFP_NOALLOC    0x02
                    197: #define UFP_NOCACHE    0x04
                    198: #define UFP_NORDONLY   0x08
                    199: #define UFP_DIRTYONLY  0x10
                    200: #define UFP_BACKWARD   0x20
1.53      chs       201:
                    202: /*
1.33      thorpej   203:  * lockflags that control the locking behavior of various functions.
                    204:  */
                    205: #define        UVM_LK_ENTER    0x00000001      /* map locked on entry */
                    206: #define        UVM_LK_EXIT     0x00000002      /* leave map locked on exit */
                    207:
                    208: /*
1.1       mrg       209:  * structures
                    210:  */
                    211:
                    212: struct core;
                    213: struct mount;
                    214: struct pglist;
                    215: struct proc;
                    216: struct ucred;
                    217: struct uio;
                    218: struct uvm_object;
                    219: struct vm_anon;
                    220: struct vmspace;
1.10      thorpej   221: struct pmap;
1.1       mrg       222: struct vnode;
1.53      chs       223: struct pool;
1.34      thorpej   224: struct simplelock;
1.65      chs       225: struct vm_map_entry;
                    226: struct vm_map;
                    227: struct vm_page;
1.1       mrg       228:
1.53      chs       229: extern struct pool *uvm_aiobuf_pool;
                    230:
1.1       mrg       231: /*
                    232:  * uvmexp: global data structures that are exported to parts of the kernel
                    233:  * other than the vm system.
                    234:  */
                    235:
                    236: struct uvmexp {
1.9       mrg       237:        /* vm_page constants */
1.1       mrg       238:        int pagesize;   /* size of a page (PAGE_SIZE): must be power of 2 */
                    239:        int pagemask;   /* page mask */
                    240:        int pageshift;  /* page shift */
                    241:
1.9       mrg       242:        /* vm_page counters */
1.1       mrg       243:        int npages;     /* number of pages we manage */
                    244:        int free;       /* number of free pages */
                    245:        int active;     /* number of active pages */
                    246:        int inactive;   /* number of pages that we free'd but may want back */
1.3       chs       247:        int paging;     /* number of pages in the process of being paged out */
1.1       mrg       248:        int wired;      /* number of wired pages */
1.57      chs       249:
1.63      chs       250:        /*
1.57      chs       251:         * Adding anything before this line will break binary compatibility
                    252:         * with top(1) on NetBSD 1.5.
1.54      simonb    253:         */
1.57      chs       254:
1.67      chs       255:        int ncolors;    /* number of page color buckets: must be p-o-2 */
                    256:        int colormask;  /* color bucket mask */
                    257:
1.55      simonb    258:        int zeropages;          /* number of zero'd pages */
1.3       chs       259:        int reserve_pagedaemon; /* number of pages reserved for pagedaemon */
1.55      simonb    260:        int reserve_kernel;     /* number of pages reserved for kernel */
1.69      chs       261:        int anonpages;          /* number of pages used by anon mappings */
                    262:        int filepages;          /* number of pages used by cached file data */
                    263:        int execpages;          /* number of pages used by cached exec date */
1.1       mrg       264:
1.9       mrg       265:        /* pageout params */
                    266:        int freemin;    /* min number of free pages */
                    267:        int freetarg;   /* target number of free pages */
                    268:        int inactarg;   /* target number of inactive pages */
                    269:        int wiredmax;   /* max number of wired pages */
1.57      chs       270:        int anonmin;    /* min threshold for anon pages */
1.69      chs       271:        int execmin;    /* min threshold for executable pages */
                    272:        int filemin;    /* min threshold for file pages */
1.57      chs       273:        int anonminpct; /* min percent anon pages */
1.69      chs       274:        int execminpct; /* min percent executable pages */
                    275:        int fileminpct; /* min percent file pages */
                    276:        int anonmax;    /* max threshold for anon pages */
                    277:        int execmax;    /* max threshold for executable pages */
                    278:        int filemax;    /* max threshold for file pages */
                    279:        int anonmaxpct; /* max percent anon pages */
                    280:        int execmaxpct; /* max percent executable pages */
                    281:        int filemaxpct; /* max percent file pages */
1.1       mrg       282:
1.9       mrg       283:        /* swap */
1.1       mrg       284:        int nswapdev;   /* number of configured swap devices in system */
                    285:        int swpages;    /* number of PAGE_SIZE'ed swap pages */
1.3       chs       286:        int swpginuse;  /* number of swap pages in use */
1.23      chs       287:        int swpgonly;   /* number of swap pages in use, not also in RAM */
1.1       mrg       288:        int nswget;     /* number of times fault calls uvm_swap_get() */
                    289:        int nanon;      /* number total of anon's in system */
1.32      thorpej   290:        int nanonneeded;/* number of anons currently needed */
1.1       mrg       291:        int nfreeanon;  /* number of free anon's */
                    292:
1.9       mrg       293:        /* stat counters */
1.7       mrg       294:        int faults;             /* page fault count */
                    295:        int traps;              /* trap count */
                    296:        int intrs;              /* interrupt count */
                    297:        int swtch;              /* context switch count */
                    298:        int softs;              /* software interrupt count */
                    299:        int syscalls;           /* system calls */
                    300:        int pageins;            /* pagein operation count */
                    301:                                /* pageouts are in pdpageouts below */
                    302:        int swapins;            /* swapins */
                    303:        int swapouts;           /* swapouts */
                    304:        int pgswapin;           /* pages swapped in */
                    305:        int pgswapout;          /* pages swapped out */
                    306:        int forks;              /* forks */
1.1       mrg       307:        int forks_ppwait;       /* forks where parent waits */
                    308:        int forks_sharevm;      /* forks where vmspace is shared */
1.40      thorpej   309:        int pga_zerohit;        /* pagealloc where zero wanted and zero
                    310:                                   was available */
                    311:        int pga_zeromiss;       /* pagealloc where zero wanted and zero
                    312:                                   not available */
1.50      thorpej   313:        int zeroaborts;         /* number of times page zeroing was
                    314:                                   aborted */
1.60      thorpej   315:        int colorhit;           /* pagealloc where we got optimal color */
                    316:        int colormiss;          /* pagealloc where we didn't */
1.1       mrg       317:
1.9       mrg       318:        /* fault subcounters */
1.1       mrg       319:        int fltnoram;   /* number of times fault was out of ram */
                    320:        int fltnoanon;  /* number of times fault was out of anons */
                    321:        int fltpgwait;  /* number of times fault had to wait on a page */
                    322:        int fltpgrele;  /* number of times fault found a released page */
                    323:        int fltrelck;   /* number of times fault relock called */
                    324:        int fltrelckok; /* number of times fault relock is a success */
                    325:        int fltanget;   /* number of times fault gets anon page */
                    326:        int fltanretry; /* number of times fault retrys an anon get */
                    327:        int fltamcopy;  /* number of times fault clears "needs copy" */
                    328:        int fltnamap;   /* number of times fault maps a neighbor anon page */
                    329:        int fltnomap;   /* number of times fault maps a neighbor obj page */
                    330:        int fltlget;    /* number of times fault does a locked pgo_get */
                    331:        int fltget;     /* number of times fault does an unlocked get */
                    332:        int flt_anon;   /* number of times fault anon (case 1a) */
                    333:        int flt_acow;   /* number of times fault anon cow (case 1b) */
                    334:        int flt_obj;    /* number of times fault is on object page (2a) */
                    335:        int flt_prcopy; /* number of times fault promotes with copy (2b) */
                    336:        int flt_przero; /* number of times fault promotes with zerofill (2b) */
                    337:
1.9       mrg       338:        /* daemon counters */
1.1       mrg       339:        int pdwoke;     /* number of times daemon woke up */
                    340:        int pdrevs;     /* number of times daemon rev'd clock hand */
                    341:        int pdswout;    /* number of times daemon called for swapout */
                    342:        int pdfreed;    /* number of pages daemon freed since boot */
                    343:        int pdscans;    /* number of pages daemon scaned since boot */
                    344:        int pdanscan;   /* number of anonymous pages scanned by daemon */
                    345:        int pdobscan;   /* number of object pages scanned by daemon */
                    346:        int pdreact;    /* number of pages daemon reactivated since boot */
                    347:        int pdbusy;     /* number of times daemon found a busy page */
                    348:        int pdpageouts; /* number of times daemon started a pageout */
                    349:        int pdpending;  /* number of times daemon got a pending pagout */
                    350:        int pddeact;    /* number of pages daemon deactivates */
1.69      chs       351:        int pdreanon;   /* anon pages reactivated due to thresholds */
                    352:        int pdrefile;   /* file pages reactivated due to thresholds */
                    353:        int pdreexec;   /* executable pages reactivated due to thresholds */
1.54      simonb    354: };
                    355:
                    356: /*
                    357:  * The following structure is 64-bit alignment safe.  New elements
                    358:  * should only be added to the end of this structure so binary
                    359:  * compatibility can be preserved.
                    360:  */
                    361: struct uvmexp_sysctl {
                    362:        int64_t pagesize;
                    363:        int64_t pagemask;
                    364:        int64_t pageshift;
                    365:        int64_t npages;
                    366:        int64_t free;
                    367:        int64_t active;
                    368:        int64_t inactive;
                    369:        int64_t paging;
                    370:        int64_t wired;
                    371:        int64_t zeropages;
                    372:        int64_t reserve_pagedaemon;
                    373:        int64_t reserve_kernel;
                    374:        int64_t freemin;
                    375:        int64_t freetarg;
                    376:        int64_t inactarg;
                    377:        int64_t wiredmax;
                    378:        int64_t nswapdev;
                    379:        int64_t swpages;
                    380:        int64_t swpginuse;
                    381:        int64_t swpgonly;
                    382:        int64_t nswget;
                    383:        int64_t nanon;
                    384:        int64_t nanonneeded;
                    385:        int64_t nfreeanon;
                    386:        int64_t faults;
                    387:        int64_t traps;
                    388:        int64_t intrs;
                    389:        int64_t swtch;
                    390:        int64_t softs;
                    391:        int64_t syscalls;
                    392:        int64_t pageins;
                    393:        int64_t swapins;
                    394:        int64_t swapouts;
                    395:        int64_t pgswapin;
                    396:        int64_t pgswapout;
                    397:        int64_t forks;
                    398:        int64_t forks_ppwait;
                    399:        int64_t forks_sharevm;
                    400:        int64_t pga_zerohit;
                    401:        int64_t pga_zeromiss;
                    402:        int64_t zeroaborts;
                    403:        int64_t fltnoram;
                    404:        int64_t fltnoanon;
                    405:        int64_t fltpgwait;
                    406:        int64_t fltpgrele;
                    407:        int64_t fltrelck;
                    408:        int64_t fltrelckok;
                    409:        int64_t fltanget;
                    410:        int64_t fltanretry;
                    411:        int64_t fltamcopy;
                    412:        int64_t fltnamap;
                    413:        int64_t fltnomap;
                    414:        int64_t fltlget;
                    415:        int64_t fltget;
                    416:        int64_t flt_anon;
                    417:        int64_t flt_acow;
                    418:        int64_t flt_obj;
                    419:        int64_t flt_prcopy;
                    420:        int64_t flt_przero;
                    421:        int64_t pdwoke;
                    422:        int64_t pdrevs;
                    423:        int64_t pdswout;
                    424:        int64_t pdfreed;
                    425:        int64_t pdscans;
                    426:        int64_t pdanscan;
                    427:        int64_t pdobscan;
                    428:        int64_t pdreact;
                    429:        int64_t pdbusy;
                    430:        int64_t pdpageouts;
                    431:        int64_t pdpending;
                    432:        int64_t pddeact;
1.55      simonb    433:        int64_t anonpages;
1.69      chs       434:        int64_t filepages;
                    435:        int64_t execpages;
1.60      thorpej   436:        int64_t colorhit;
                    437:        int64_t colormiss;
1.61      thorpej   438:        int64_t ncolors;
1.1       mrg       439: };
                    440:
1.31      thorpej   441: #ifdef _KERNEL
1.45      mrg       442: extern struct uvmexp uvmexp;
                    443: #endif
1.1       mrg       444:
1.45      mrg       445: /*
                    446:  * Finally, bring in standard UVM headers.
                    447:  */
                    448: #include <sys/vmmeter.h>
                    449: #include <sys/queue.h>
                    450: #include <uvm/uvm_param.h>
                    451: #include <sys/lock.h>
                    452: #include <uvm/uvm_prot.h>
                    453: #include <uvm/uvm_page.h>
                    454: #include <uvm/uvm_pmap.h>
                    455: #include <uvm/uvm_map.h>
                    456: #include <uvm/uvm_fault.h>
                    457: #include <uvm/uvm_pager.h>
                    458:
                    459: /*
                    460:  * Shareable process virtual address space.
                    461:  * May eventually be merged with vm_map.
                    462:  * Several fields are temporary (text, data stuff).
                    463:  */
                    464: struct vmspace {
                    465:        struct  vm_map vm_map;  /* VM address map */
                    466:        int     vm_refcnt;      /* number of references */
                    467:        caddr_t vm_shm;         /* SYS5 shared memory private data XXX */
                    468: /* we copy from vm_startcopy to the end of the structure on fork */
                    469: #define vm_startcopy vm_rssize
1.59      thorpej   470:        segsz_t vm_rssize;      /* current resident set size in pages */
1.45      mrg       471:        segsz_t vm_swrss;       /* resident set size before last swap */
                    472:        segsz_t vm_tsize;       /* text size (pages) XXX */
                    473:        segsz_t vm_dsize;       /* data size (pages) XXX */
                    474:        segsz_t vm_ssize;       /* stack size (pages) */
                    475:        caddr_t vm_taddr;       /* user virtual address of text XXX */
                    476:        caddr_t vm_daddr;       /* user virtual address of data XXX */
                    477:        caddr_t vm_maxsaddr;    /* user VA at max stack growth */
1.51      eeh       478:        caddr_t vm_minsaddr;    /* user VA at top of stack */
1.45      mrg       479: };
                    480:
                    481: #ifdef _KERNEL
1.43      mrg       482:
                    483: /*
1.70      thorpej   484:  * used to keep state while iterating over the map for a core dump.
                    485:  */
                    486: struct uvm_coredump_state {
                    487:        void *cookie;           /* opaque for the caller */
                    488:        vaddr_t start;          /* start of region */
                    489:        vaddr_t end;            /* end of region */
                    490:        vm_prot_t prot;         /* protection of region */
                    491:        int flags;              /* flags; see below */
                    492: };
                    493:
                    494: #define        UVM_COREDUMP_STACK      0x01    /* region is user stack */
                    495: #define        UVM_COREDUMP_NODUMP     0x02    /* don't actually dump this region */
                    496:
                    497: /*
1.43      mrg       498:  * the various kernel maps, owned by MD code
                    499:  */
1.65      chs       500: extern struct vm_map *exec_map;
                    501: extern struct vm_map *kernel_map;
                    502: extern struct vm_map *kmem_map;
                    503: extern struct vm_map *mb_map;
                    504: extern struct vm_map *phys_map;
1.1       mrg       505:
                    506: /*
                    507:  * macros
                    508:  */
                    509:
                    510: /* zalloc zeros memory, alloc does not */
                    511: #define uvm_km_zalloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,TRUE)
                    512: #define uvm_km_alloc(MAP,SIZE)  uvm_km_alloc1(MAP,SIZE,FALSE)
                    513:
1.31      thorpej   514: #endif /* _KERNEL */
                    515:
1.45      mrg       516: #define vm_resident_count(vm) (pmap_resident_count((vm)->vm_map.pmap))
1.1       mrg       517:
1.44      mrg       518: struct buf;
                    519: struct loadavg;
                    520: struct proc;
                    521: struct pmap;
                    522: struct vmspace;
                    523: struct vmtotal;
                    524: struct mount;
                    525: struct vnode;
                    526: struct core;
                    527:
1.31      thorpej   528: #ifdef _KERNEL
1.44      mrg       529:
                    530: /* vm_machdep.c */
                    531: void           vmapbuf __P((struct buf *, vsize_t));
                    532: void           vunmapbuf __P((struct buf *, vsize_t));
                    533: void           pagemove __P((caddr_t, caddr_t, size_t));
                    534: #ifndef        cpu_swapin
1.76    ! thorpej   535: void           cpu_swapin __P((struct lwp *));
1.44      mrg       536: #endif
                    537: #ifndef        cpu_swapout
1.76    ! thorpej   538: void           cpu_swapout __P((struct lwp *));
1.44      mrg       539: #endif
1.31      thorpej   540:
1.1       mrg       541: /* uvm_aobj.c */
1.19      eeh       542: struct uvm_object      *uao_create __P((vsize_t, int));
1.1       mrg       543: void                   uao_detach __P((struct uvm_object *));
1.36      chs       544: void                   uao_detach_locked __P((struct uvm_object *));
1.1       mrg       545: void                   uao_reference __P((struct uvm_object *));
1.36      chs       546: void                   uao_reference_locked __P((struct uvm_object *));
1.1       mrg       547:
1.53      chs       548: /* uvm_bio.c */
                    549: void                   ubc_init __P((void));
                    550: void *                 ubc_alloc __P((struct uvm_object *, voff_t, vsize_t *,
                    551:                                       int));
1.67      chs       552: void                   ubc_release __P((void *, int));
1.53      chs       553: void                   ubc_flush __P((struct uvm_object *, voff_t, voff_t));
                    554:
1.1       mrg       555: /* uvm_fault.c */
1.65      chs       556: int                    uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t,
1.53      chs       557:                                       vm_prot_t));
1.1       mrg       558:                                /* handle a page fault */
                    559:
                    560: /* uvm_glue.c */
                    561: #if defined(KGDB)
1.13      kleink    562: void                   uvm_chgkprot __P((caddr_t, size_t, int));
1.1       mrg       563: #endif
1.76    ! thorpej   564: void                   uvm_proc_fork __P((struct proc *, struct proc *, boolean_t));
        !           565: void                   uvm_lwp_fork __P((struct lwp *, struct lwp *,
        !           566:                            void *, size_t, void (*)(void *), void *));
1.70      thorpej   567: int                    uvm_coredump_walkmap __P((struct proc *,
                    568:                            struct vnode *, struct ucred *,
                    569:                            int (*)(struct proc *, struct vnode *,
                    570:                                    struct ucred *,
                    571:                                    struct uvm_coredump_state *), void *));
1.76    ! thorpej   572: void                   uvm_proc_exit __P((struct proc *));
        !           573: void                   uvm_lwp_exit __P((struct lwp *));
1.1       mrg       574: void                   uvm_init_limits __P((struct proc *));
1.13      kleink    575: boolean_t              uvm_kernacc __P((caddr_t, size_t, int));
1.11      mycroft   576: __dead void            uvm_scheduler __P((void)) __attribute__((noreturn));
1.76    ! thorpej   577: void                   uvm_swapin __P((struct lwp *));
1.74      chs       578: boolean_t              uvm_uarea_alloc(vaddr_t *);
1.73      chs       579: void                   uvm_uarea_free(vaddr_t);
1.13      kleink    580: boolean_t              uvm_useracc __P((caddr_t, size_t, int));
1.29      thorpej   581: int                    uvm_vslock __P((struct proc *, caddr_t, size_t,
1.26      thorpej   582:                            vm_prot_t));
1.13      kleink    583: void                   uvm_vsunlock __P((struct proc *, caddr_t, size_t));
1.1       mrg       584:
                    585:
                    586: /* uvm_init.c */
1.63      chs       587: void                   uvm_init __P((void));
1.1       mrg       588:
                    589: /* uvm_io.c */
1.65      chs       590: int                    uvm_io __P((struct vm_map *, struct uio *));
1.1       mrg       591:
                    592: /* uvm_km.c */
1.65      chs       593: vaddr_t                        uvm_km_alloc1 __P((struct vm_map *, vsize_t,
                    594:                            boolean_t));
                    595: void                   uvm_km_free __P((struct vm_map *, vaddr_t, vsize_t));
                    596: void                   uvm_km_free_wakeup __P((struct vm_map *, vaddr_t,
                    597:                            vsize_t));
                    598: vaddr_t                        uvm_km_kmemalloc __P((struct vm_map *, struct
                    599:                            uvm_object *, vsize_t, int));
                    600: struct vm_map          *uvm_km_suballoc __P((struct vm_map *, vaddr_t *,
                    601:                            vaddr_t *, vsize_t, int, boolean_t,
                    602:                            struct vm_map *));
                    603: vaddr_t                        uvm_km_valloc __P((struct vm_map *, vsize_t));
                    604: vaddr_t                        uvm_km_valloc_align __P((struct vm_map *, vsize_t,
                    605:                            vsize_t));
                    606: vaddr_t                        uvm_km_valloc_wait __P((struct vm_map *, vsize_t));
                    607: vaddr_t                        uvm_km_valloc_prefer_wait __P((struct vm_map *, vsize_t,
                    608:                            voff_t));
                    609: vaddr_t                        uvm_km_alloc_poolpage1 __P((struct vm_map *,
                    610:                            struct uvm_object *, boolean_t));
                    611: void                   uvm_km_free_poolpage1 __P((struct vm_map *, vaddr_t));
                    612:
1.67      chs       613: #define        uvm_km_alloc_poolpage(waitok)                                   \
                    614:        uvm_km_alloc_poolpage1(kmem_map, NULL, (waitok))
                    615: #define        uvm_km_free_poolpage(addr)                                      \
1.65      chs       616:        uvm_km_free_poolpage1(kmem_map, (addr))
1.1       mrg       617:
                    618: /* uvm_map.c */
1.65      chs       619: int                    uvm_map __P((struct vm_map *, vaddr_t *, vsize_t,
1.49      thorpej   620:                                struct uvm_object *, voff_t, vsize_t,
                    621:                                uvm_flag_t));
1.65      chs       622: int                    uvm_map_pageable __P((struct vm_map *, vaddr_t,
1.33      thorpej   623:                                vaddr_t, boolean_t, int));
1.65      chs       624: int                    uvm_map_pageable_all __P((struct vm_map *, int,
                    625:                                vsize_t));
                    626: boolean_t              uvm_map_checkprot __P((struct vm_map *, vaddr_t,
1.19      eeh       627:                                vaddr_t, vm_prot_t));
1.65      chs       628: int                    uvm_map_protect __P((struct vm_map *, vaddr_t,
1.19      eeh       629:                                vaddr_t, vm_prot_t, boolean_t));
1.66      chs       630: struct vmspace         *uvmspace_alloc __P((vaddr_t, vaddr_t));
1.10      thorpej   631: void                   uvmspace_init __P((struct vmspace *, struct pmap *,
1.66      chs       632:                                vaddr_t, vaddr_t));
1.76    ! thorpej   633: void                   uvmspace_exec __P((struct lwp *, vaddr_t, vaddr_t));
1.1       mrg       634: struct vmspace         *uvmspace_fork __P((struct vmspace *));
                    635: void                   uvmspace_free __P((struct vmspace *));
                    636: void                   uvmspace_share __P((struct proc *, struct proc *));
1.76    ! thorpej   637: void                   uvmspace_unshare __P((struct lwp *));
1.1       mrg       638:
                    639:
                    640: /* uvm_meter.c */
                    641: void                   uvm_meter __P((void));
1.63      chs       642: int                    uvm_sysctl __P((int *, u_int, void *, size_t *,
1.1       mrg       643:                                void *, size_t, struct proc *));
                    644:
                    645: /* uvm_mmap.c */
1.65      chs       646: int                    uvm_mmap __P((struct vm_map *, vaddr_t *, vsize_t,
1.63      chs       647:                                vm_prot_t, vm_prot_t, int,
1.58      chs       648:                                void *, voff_t, vsize_t));
1.1       mrg       649:
                    650: /* uvm_page.c */
1.15      thorpej   651: struct vm_page         *uvm_pagealloc_strat __P((struct uvm_object *,
1.38      kleink    652:                                voff_t, struct vm_anon *, int, int, int));
1.24      chs       653: #define        uvm_pagealloc(obj, off, anon, flags) \
                    654:            uvm_pagealloc_strat((obj), (off), (anon), (flags), \
                    655:                                UVM_PGA_STRAT_NORMAL, 0)
1.63      chs       656: void                   uvm_pagerealloc __P((struct vm_page *,
1.38      kleink    657:                                             struct uvm_object *, voff_t));
1.19      eeh       658: /* Actually, uvm_page_physload takes PF#s which need their own type */
1.67      chs       659: void                   uvm_page_physload __P((paddr_t, paddr_t, paddr_t,
                    660:                            paddr_t, int));
1.1       mrg       661: void                   uvm_setpagesize __P((void));
                    662:
1.53      chs       663: /* uvm_pager.c */
                    664: void                   uvm_aio_biodone1 __P((struct buf *));
                    665: void                   uvm_aio_biodone __P((struct buf *));
                    666: void                   uvm_aio_aiodone __P((struct buf *));
                    667:
1.1       mrg       668: /* uvm_pdaemon.c */
1.48      thorpej   669: void                   uvm_pageout __P((void *));
1.53      chs       670: void                   uvm_aiodone_daemon __P((void *));
1.1       mrg       671:
                    672: /* uvm_pglist.c */
1.67      chs       673: int                    uvm_pglistalloc __P((psize_t, paddr_t, paddr_t,
                    674:                            paddr_t, paddr_t, struct pglist *, int, int));
1.1       mrg       675: void                   uvm_pglistfree __P((struct pglist *));
                    676:
                    677: /* uvm_swap.c */
                    678: void                   uvm_swap_init __P((void));
                    679:
                    680: /* uvm_unix.c */
1.19      eeh       681: int                    uvm_grow __P((struct proc *, vaddr_t));
1.1       mrg       682:
                    683: /* uvm_user.c */
1.65      chs       684: void                   uvm_deallocate __P((struct vm_map *, vaddr_t, vsize_t));
1.1       mrg       685:
                    686: /* uvm_vnode.c */
1.38      kleink    687: void                   uvm_vnp_setsize __P((struct vnode *, voff_t));
1.1       mrg       688: void                   uvm_vnp_sync __P((struct mount *));
                    689: struct uvm_object      *uvn_attach __P((void *, vm_prot_t));
1.71      enami     690: int                    uvn_findpages __P((struct uvm_object *, voff_t,
1.53      chs       691:                                           int *, struct vm_page **, int));
                    692: void                   uvm_vnp_zerorange __P((struct vnode *, off_t, size_t));
1.37      thorpej   693:
                    694: /* kern_malloc.c */
                    695: void                   kmeminit_nkmempages __P((void));
                    696: void                   kmeminit __P((void));
                    697: extern int             nkmempages;
1.1       mrg       698:
1.31      thorpej   699: #endif /* _KERNEL */
                    700:
1.8       perry     701: #endif /* _UVM_UVM_EXTERN_H_ */

CVSweb <webmaster@jp.NetBSD.org>