Home | History | Annotate | Line # | Download | only in include
pmap.h revision 1.3
      1 /*	$NetBSD: pmap.h,v 1.3 2002/09/22 07:53:42 chs Exp $	*/
      2 
      3 /*	$OpenBSD: pmap.h,v 1.14 2001/05/09 15:31:24 art Exp $	*/
      4 
      5 /*
      6  * Copyright (c) 1998,1999 Michael Shalayeff
      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 Michael Shalayeff.
     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.
     33  */
     34 /*
     35  * Copyright 1996 1995 by Open Software Foundation, Inc.
     36  *              All Rights Reserved
     37  *
     38  * Permission to use, copy, modify, and distribute this software and
     39  * its documentation for any purpose and without fee is hereby granted,
     40  * provided that the above copyright notice appears in all copies and
     41  * that both the copyright notice and this permission notice appear in
     42  * supporting documentation.
     43  *
     44  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
     45  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     46  * FOR A PARTICULAR PURPOSE.
     47  *
     48  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
     49  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     50  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
     51  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     52  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     53  */
     54 /*
     55  * Copyright (c) 1990,1993,1994 The University of Utah and
     56  * the Computer Systems Laboratory at the University of Utah (CSL).
     57  * All rights reserved.
     58  *
     59  * Permission to use, copy, modify and distribute this software is hereby
     60  * granted provided that (1) source code retains these copyright, permission,
     61  * and disclaimer notices, and (2) redistributions including binaries
     62  * reproduce the notices in supporting documentation, and (3) all advertising
     63  * materials mentioning features or use of this software display the following
     64  * acknowledgement: ``This product includes software developed by the
     65  * Computer Systems Laboratory at the University of Utah.''
     66  *
     67  * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
     68  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
     69  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     70  *
     71  * CSL requests users of this software to return to csl-dist (at) cs.utah.edu any
     72  * improvements that they make and grant CSL redistribution rights.
     73  *
     74  * 	Utah $Hdr: pmap.h 1.24 94/12/14$
     75  *	Author: Mike Hibler, Bob Wheeler, University of Utah CSL, 9/90
     76  */
     77 
     78 /*
     79  *	Pmap header for hppa.
     80  */
     81 
     82 #ifndef	_HPPA_PMAP_H_
     83 #define	_HPPA_PMAP_H_
     84 
     85 #include <machine/pte.h>
     86 
     87 typedef
     88 struct pmap {
     89 	TAILQ_ENTRY(pmap)	pmap_list;	/* pmap free list */
     90 	struct simplelock	pmap_lock;	/* lock on map */
     91 	int			pmap_refcnt;	/* reference count */
     92 	pa_space_t		pmap_space;	/* space for this pmap */
     93 	u_int			pmap_pid;	/* protection id for pmap */
     94 	struct pmap_statistics	pmap_stats;	/* statistics */
     95 } *pmap_t;
     96 extern pmap_t	kernel_pmap;			/* The kernel's map */
     97 
     98 #ifdef _KERNEL
     99 #define cache_align(x)	(((x) + dcache_line_mask) & ~(dcache_line_mask))
    100 extern int dcache_line_mask;
    101 
    102 #define	PMAP_STEAL_MEMORY	/* we have some memory to steal */
    103 
    104 /*
    105  * according to the parisc manual aliased va's should be
    106  * different by high 12 bits only.
    107  */
    108 #define	PMAP_PREFER(o,h)	do {					\
    109 	vaddr_t pmap_prefer_hint;					\
    110 	pmap_prefer_hint = (*(h) & HPPA_PGAMASK) | ((o) & HPPA_PGAOFF);	\
    111 	if (pmap_prefer_hint < *(h))					\
    112 		pmap_prefer_hint += HPPA_PGALIAS;			\
    113 	*(h) = pmap_prefer_hint;					\
    114 } while(0)
    115 
    116 #define pmap_kernel_va(VA)	\
    117 	(((VA) >= VM_MIN_KERNEL_ADDRESS) && ((VA) <= VM_MAX_KERNEL_ADDRESS))
    118 
    119 #define pmap_kernel()			(kernel_pmap)
    120 #define	pmap_resident_count(pmap)	((pmap)->pmap_stats.resident_count)
    121 #define pmap_wired_count(pmap)		((pmap)->pmap_stats.wired_count)
    122 #define pmap_reference(pmap) \
    123 do { if (pmap) { \
    124 	simple_lock(&pmap->pmap_lock); \
    125 	pmap->pmap_refcnt++; \
    126 	simple_unlock(&pmap->pmap_lock); \
    127 } } while (0)
    128 #define pmap_collect(pmap)
    129 #define pmap_release(pmap)
    130 #define pmap_copy(dpmap,spmap,da,len,sa)
    131 #define	pmap_update(p)
    132 void	pmap_activate __P((struct proc *));
    133 #define	pmap_deactivate(p)
    134 
    135 #define pmap_phys_address(x)	((x) << PGSHIFT)
    136 #define pmap_phys_to_frame(x)	((x) >> PGSHIFT)
    137 
    138 static __inline void
    139 pmap_remove_all(struct pmap *pmap)
    140 {
    141 	/* Nothing. */
    142 }
    143 
    144 static __inline int
    145 pmap_prot(struct pmap *pmap, int prot)
    146 {
    147 	extern u_int kern_prot[], user_prot[];
    148 	return (pmap == kernel_pmap? kern_prot: user_prot)[prot];
    149 }
    150 
    151 #endif /* _KERNEL */
    152 
    153 #endif /* _HPPA_PMAP_H_ */
    154