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