root/uvm/uvm_object.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: uvm_object.h,v 1.10 2007/04/11 12:10:42 art Exp $     */
    2 /*      $NetBSD: uvm_object.h,v 1.11 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_object.h,v 1.1.2.2 1998/01/04 22:44:51 chuck Exp
   36  */
   37 
   38 #ifndef _UVM_UVM_OBJECT_H_
   39 #define _UVM_UVM_OBJECT_H_
   40 
   41 /*
   42  * uvm_object.h
   43  */
   44 
   45 /*
   46  * uvm_object: all that is left of mach objects.
   47  */
   48 
   49 struct uvm_object {
   50         simple_lock_data_t      vmobjlock;      /* lock on memq */
   51         struct uvm_pagerops     *pgops;         /* pager ops */
   52         struct pglist           memq;           /* pages in this object */
   53         int                     uo_npages;      /* # of pages in memq */
   54         int                     uo_refs;        /* reference count */
   55 };
   56 
   57 /*
   58  * UVM_OBJ_KERN is a 'special' uo_refs value which indicates that the
   59  * object is a kernel memory object rather than a normal one (kernel
   60  * memory objects don't have reference counts -- they never die).
   61  *
   62  * this value is used to detected kernel object mappings at uvm_unmap()
   63  * time.   normally when an object is unmapped its pages eventaully become
   64  * deactivated and then paged out and/or freed.    this is not useful
   65  * for kernel objects... when a kernel object is unmapped we always want
   66  * to free the resources associated with the mapping.   UVM_OBJ_KERN
   67  * allows us to decide which type of unmapping we want to do.
   68  *
   69  * in addition, we have kernel objects which may be used in an
   70  * interrupt context.  these objects get their mappings entered
   71  * with pmap_kenter*() and removed with pmap_kremove(), which
   72  * are safe to call in interrupt context, and must be used ONLY
   73  * for wired kernel mappings in these objects and their associated
   74  * maps.
   75  */
   76 #define UVM_OBJ_KERN            (-2)
   77 
   78 #define UVM_OBJ_IS_KERN_OBJECT(uobj)                                    \
   79         ((uobj)->uo_refs == UVM_OBJ_KERN)
   80 
   81 #ifdef _KERNEL
   82 
   83 extern struct uvm_pagerops uvm_vnodeops;
   84 extern struct uvm_pagerops uvm_deviceops;
   85 
   86 #define UVM_OBJ_IS_VNODE(uobj)                                          \
   87         ((uobj)->pgops == &uvm_vnodeops)
   88 
   89 #define UVM_OBJ_IS_DEVICE(uobj)                                         \
   90         ((uobj)->pgops == &uvm_deviceops)
   91 
   92 #define UVM_OBJ_IS_VTEXT(uobj)                                          \
   93         ((uobj)->pgops == &uvm_vnodeops &&                              \
   94          ((struct vnode *)uobj)->v_flag & VTEXT)
   95 
   96 
   97 #endif /* _KERNEL */
   98 
   99 #endif /* _UVM_UVM_OBJECT_H_ */

/* [<][>][^][v][top][bottom][index][help] */