Home | History | Annotate | Line # | Download | only in uvm
uvm_pager.h revision 1.37
      1  1.37      yamt /*	$NetBSD: uvm_pager.h,v 1.37 2007/10/25 13:03:06 yamt Exp $	*/
      2   1.1       mrg 
      3   1.1       mrg /*
      4   1.1       mrg  *
      5   1.1       mrg  * Copyright (c) 1997 Charles D. Cranor and Washington University.
      6   1.1       mrg  * All rights reserved.
      7   1.1       mrg  *
      8   1.1       mrg  * Redistribution and use in source and binary forms, with or without
      9   1.1       mrg  * modification, are permitted provided that the following conditions
     10   1.1       mrg  * are met:
     11   1.1       mrg  * 1. Redistributions of source code must retain the above copyright
     12   1.1       mrg  *    notice, this list of conditions and the following disclaimer.
     13   1.1       mrg  * 2. Redistributions in binary form must reproduce the above copyright
     14   1.1       mrg  *    notice, this list of conditions and the following disclaimer in the
     15   1.1       mrg  *    documentation and/or other materials provided with the distribution.
     16   1.1       mrg  * 3. All advertising materials mentioning features or use of this software
     17   1.1       mrg  *    must display the following acknowledgement:
     18   1.1       mrg  *      This product includes software developed by Charles D. Cranor and
     19   1.1       mrg  *      Washington University.
     20   1.1       mrg  * 4. The name of the author may not be used to endorse or promote products
     21   1.1       mrg  *    derived from this software without specific prior written permission.
     22   1.1       mrg  *
     23   1.1       mrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24   1.1       mrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25   1.1       mrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26   1.1       mrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27   1.1       mrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28   1.1       mrg  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29   1.1       mrg  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30   1.1       mrg  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31   1.1       mrg  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32   1.1       mrg  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33   1.3       mrg  *
     34   1.3       mrg  * from: Id: uvm_pager.h,v 1.1.2.14 1998/01/13 19:00:50 chuck Exp
     35   1.1       mrg  */
     36   1.1       mrg 
     37  1.16       mrg /*
     38  1.16       mrg  * Copyright (c) 1991, 1993
     39  1.16       mrg  *	The Regents of the University of California.  All rights reserved.
     40  1.27       agc  *
     41  1.27       agc  * This code is derived from software contributed to Berkeley by
     42  1.27       agc  * the Systems Programming Group of the University of Utah Computer
     43  1.27       agc  * Science Department.
     44  1.27       agc  *
     45  1.27       agc  * Redistribution and use in source and binary forms, with or without
     46  1.27       agc  * modification, are permitted provided that the following conditions
     47  1.27       agc  * are met:
     48  1.27       agc  * 1. Redistributions of source code must retain the above copyright
     49  1.27       agc  *    notice, this list of conditions and the following disclaimer.
     50  1.27       agc  * 2. Redistributions in binary form must reproduce the above copyright
     51  1.27       agc  *    notice, this list of conditions and the following disclaimer in the
     52  1.27       agc  *    documentation and/or other materials provided with the distribution.
     53  1.27       agc  * 3. Neither the name of the University nor the names of its contributors
     54  1.27       agc  *    may be used to endorse or promote products derived from this software
     55  1.27       agc  *    without specific prior written permission.
     56  1.27       agc  *
     57  1.27       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     58  1.27       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     59  1.27       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     60  1.27       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     61  1.27       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     62  1.27       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     63  1.27       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     64  1.27       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     65  1.27       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     66  1.27       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     67  1.27       agc  * SUCH DAMAGE.
     68  1.27       agc  *
     69  1.27       agc  *	@(#)vm_pager.h	8.5 (Berkeley) 7/7/94
     70  1.27       agc  */
     71  1.27       agc 
     72  1.27       agc /*
     73  1.27       agc  * Copyright (c) 1990 University of Utah.
     74  1.16       mrg  *
     75  1.16       mrg  * This code is derived from software contributed to Berkeley by
     76  1.16       mrg  * the Systems Programming Group of the University of Utah Computer
     77  1.16       mrg  * Science Department.
     78  1.16       mrg  *
     79  1.16       mrg  * Redistribution and use in source and binary forms, with or without
     80  1.16       mrg  * modification, are permitted provided that the following conditions
     81  1.16       mrg  * are met:
     82  1.16       mrg  * 1. Redistributions of source code must retain the above copyright
     83  1.16       mrg  *    notice, this list of conditions and the following disclaimer.
     84  1.16       mrg  * 2. Redistributions in binary form must reproduce the above copyright
     85  1.16       mrg  *    notice, this list of conditions and the following disclaimer in the
     86  1.16       mrg  *    documentation and/or other materials provided with the distribution.
     87  1.16       mrg  * 3. All advertising materials mentioning features or use of this software
     88  1.16       mrg  *    must display the following acknowledgement:
     89  1.16       mrg  *	This product includes software developed by the University of
     90  1.16       mrg  *	California, Berkeley and its contributors.
     91  1.16       mrg  * 4. Neither the name of the University nor the names of its contributors
     92  1.16       mrg  *    may be used to endorse or promote products derived from this software
     93  1.16       mrg  *    without specific prior written permission.
     94  1.16       mrg  *
     95  1.16       mrg  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     96  1.16       mrg  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     97  1.16       mrg  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     98  1.16       mrg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     99  1.16       mrg  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    100  1.16       mrg  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    101  1.16       mrg  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    102  1.16       mrg  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    103  1.16       mrg  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    104  1.16       mrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    105  1.16       mrg  * SUCH DAMAGE.
    106  1.16       mrg  *
    107  1.16       mrg  *	@(#)vm_pager.h	8.5 (Berkeley) 7/7/94
    108  1.16       mrg  */
    109  1.16       mrg 
    110   1.4     perry #ifndef _UVM_UVM_PAGER_H_
    111   1.4     perry #define _UVM_UVM_PAGER_H_
    112   1.4     perry 
    113   1.1       mrg /*
    114   1.1       mrg  * uvm_pager.h
    115   1.1       mrg  */
    116   1.1       mrg 
    117   1.1       mrg /*
    118  1.24       chs  * forward structure declarations
    119  1.24       chs  */
    120  1.24       chs 
    121  1.24       chs struct uvm_faultinfo;
    122  1.24       chs 
    123  1.24       chs /*
    124   1.1       mrg  * pager ops
    125   1.1       mrg  */
    126   1.1       mrg 
    127   1.1       mrg struct uvm_pagerops {
    128  1.24       chs 
    129  1.24       chs 	/* init pager */
    130  1.28  junyoung 	void	(*pgo_init)(void);
    131  1.24       chs 
    132  1.24       chs 	/* add reference to obj */
    133  1.24       chs 	void	(*pgo_reference)(struct uvm_object *);
    134  1.24       chs 
    135  1.24       chs 	/* drop reference to obj */
    136  1.24       chs 	void	(*pgo_detach)(struct uvm_object *);
    137  1.24       chs 
    138  1.24       chs 	/* special non-standard fault processing */
    139  1.24       chs 	int	(*pgo_fault)(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
    140  1.34  drochner 			     int, int, vm_prot_t, int);
    141  1.24       chs 
    142  1.24       chs 	/* get/read pages */
    143  1.24       chs 	int	(*pgo_get)(struct uvm_object *, voff_t, struct vm_page **,
    144  1.24       chs 			   int *, int, vm_prot_t, int, int);
    145  1.24       chs 
    146  1.24       chs 	/* put/write pages */
    147  1.24       chs 	int	(*pgo_put)(struct uvm_object *, voff_t, voff_t, int);
    148   1.1       mrg };
    149   1.1       mrg 
    150   1.1       mrg /* pager flags [mostly for flush] */
    151   1.1       mrg 
    152   1.1       mrg #define PGO_CLEANIT	0x001	/* write dirty pages to backing store */
    153  1.36     pooka #define PGO_SYNCIO	0x002	/* use sync I/O */
    154   1.1       mrg #define PGO_DEACTIVATE	0x004	/* deactivate flushed pages */
    155   1.1       mrg #define PGO_FREE	0x008	/* free flushed pages */
    156  1.20       chs /* if PGO_FREE is not set then the pages stay where they are. */
    157   1.1       mrg 
    158   1.1       mrg #define PGO_ALLPAGES	0x010	/* flush whole object/get all pages */
    159   1.1       mrg #define PGO_LOCKED	0x040	/* fault data structures are locked [get] */
    160  1.26  perseant #define PGO_BUSYFAIL	0x080	/* fail if a page is busy [put] */
    161  1.20       chs #define PGO_OVERWRITE	0x200	/* pages will be overwritten before unlocked */
    162  1.25       chs #define PGO_PASTEOF	0x400	/* allow allocation of pages past EOF */
    163  1.29      yamt #define PGO_NOBLOCKALLOC 0x800	/* backing block allocation is not needed */
    164  1.30      yamt #define PGO_NOTIMESTAMP 0x1000	/* don't mark object accessed/modified */
    165  1.35       chs #define PGO_RECLAIM	0x2000	/* object is being reclaimed */
    166   1.1       mrg 
    167   1.1       mrg /* page we are not interested in getting */
    168  1.20       chs #define PGO_DONTCARE ((struct vm_page *) -1L)	/* [get only] */
    169   1.1       mrg 
    170  1.10   thorpej #ifdef _KERNEL
    171  1.10   thorpej 
    172   1.1       mrg /*
    173   1.1       mrg  * prototypes
    174   1.1       mrg  */
    175   1.1       mrg 
    176  1.28  junyoung void	uvm_pager_init(void);
    177  1.33      yamt struct vm_page *uvm_pageratop(vaddr_t);
    178  1.28  junyoung vaddr_t	uvm_pagermapin(struct vm_page **, int, int);
    179  1.28  junyoung void	uvm_pagermapout(vaddr_t, int);
    180  1.15   thorpej 
    181  1.37      yamt extern size_t pager_map_size;
    182  1.37      yamt 
    183  1.15   thorpej /* Flags to uvm_pagermapin() */
    184  1.15   thorpej #define	UVMPAGER_MAPIN_WAITOK	0x01	/* it's okay to wait */
    185  1.24       chs #define	UVMPAGER_MAPIN_READ	0x02	/* device -> host */
    186  1.24       chs #define	UVMPAGER_MAPIN_WRITE	0x00	/* host -> device (pseudo flag) */
    187  1.18       chs 
    188  1.10   thorpej #endif /* _KERNEL */
    189   1.4     perry 
    190   1.4     perry #endif /* _UVM_UVM_PAGER_H_ */
    191