Home | History | Annotate | Line # | Download | only in include
pmap.h revision 1.7
      1 /*	$NetBSD: pmap.h,v 1.7 2004/07/18 23:21:35 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 
    100 #define PMAP_NC		0x100
    101 
    102 #define cache_align(x)	(((x) + dcache_line_mask) & ~(dcache_line_mask))
    103 extern int dcache_line_mask;
    104 
    105 #define	PMAP_STEAL_MEMORY	/* we have some memory to steal */
    106 
    107 /*
    108  * according to the parisc manual aliased va's should be
    109  * different by high 12 bits only.
    110  */
    111 #define	PMAP_PREFER(o,h)	do {					\
    112 	vaddr_t pmap_prefer_hint;					\
    113 	pmap_prefer_hint = (*(h) & HPPA_PGAMASK) | ((o) & HPPA_PGAOFF);	\
    114 	if (pmap_prefer_hint < *(h))					\
    115 		pmap_prefer_hint += HPPA_PGALIAS;			\
    116 	*(h) = pmap_prefer_hint;					\
    117 } while(0)
    118 
    119 #define pmap_kernel_va(VA)	\
    120 	(((VA) >= VM_MIN_KERNEL_ADDRESS) && ((VA) <= VM_MAX_KERNEL_ADDRESS))
    121 
    122 #define pmap_kernel()			(kernel_pmap)
    123 #define	pmap_resident_count(pmap)	((pmap)->pmap_stats.resident_count)
    124 #define pmap_wired_count(pmap)		((pmap)->pmap_stats.wired_count)
    125 #define pmap_reference(pmap) \
    126 do { if (pmap) { \
    127 	simple_lock(&pmap->pmap_lock); \
    128 	pmap->pmap_refcnt++; \
    129 	simple_unlock(&pmap->pmap_lock); \
    130 } } while (0)
    131 #define pmap_collect(pmap)
    132 #define pmap_release(pmap)
    133 #define pmap_copy(dpmap,spmap,da,len,sa)
    134 #define	pmap_update(p)
    135 void	pmap_activate __P((struct lwp *));
    136 
    137 static __inline void
    138 pmap_deactivate(struct lwp *lwp)
    139 {
    140 }
    141 
    142 #define pmap_phys_address(x)	((x) << PGSHIFT)
    143 #define pmap_phys_to_frame(x)	((x) >> PGSHIFT)
    144 
    145 static __inline void
    146 pmap_remove_all(struct pmap *pmap)
    147 {
    148 	/* Nothing. */
    149 }
    150 
    151 static __inline int
    152 pmap_prot(struct pmap *pmap, vm_prot_t prot)
    153 {
    154 	extern u_int kern_prot[], user_prot[];
    155 
    156 	return (pmap == kernel_pmap ? kern_prot : user_prot)[prot];
    157 }
    158 
    159 #define	pmap_sid(pmap, va) \
    160 	((((va) & 0xc0000000) != 0xc0000000) ? \
    161 	 (pmap)->pmap_space : HPPA_SID_KERNEL)
    162 
    163 #endif /* _KERNEL */
    164 
    165 #endif /* _HPPA_PMAP_H_ */
    166