1 /* $NetBSD: pmap.h,v 1.13 1995/04/10 12:42:29 mycroft Exp $ */ 2 3 /* 4 * Copyright (c) 1994 Gordon W. Ross 5 * Copyright (c) 1993 Adam Glass 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by Adam Glass. 19 * 4. The name of the Authors may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef _MACHINE_PMAP_ 35 #define _MACHINE_PMAP_ 36 37 /* 38 * Physical map structures exported to the VM code. 39 */ 40 41 struct pmap { 42 int pm_refcount; /* pmap reference count */ 43 simple_lock_data_t pm_lock; /* lock on pmap */ 44 struct pmap_statistics pm_stats; /* pmap statistics */ 45 int pm_version; 46 int pm_ctxnum; 47 unsigned char *pm_segmap; 48 }; 49 50 typedef struct pmap *pmap_t; 51 52 #ifdef _KERNEL 53 struct pmap kernel_pmap_store; 54 55 #define pmap_kernel() (&kernel_pmap_store) 56 57 #define PMAP_ACTIVATE(pmap, pcbp, iscurproc) \ 58 pmap_activate(pmap, pcbp) 59 #define PMAP_DEACTIVATE(pmap, pcbp) \ 60 pmap_deactivate(pmap, pcbp) 61 62 /* XXX - Need a (silly) #define get code in kern_sysctl.c */ 63 extern segsz_t pmap_resident_pages(pmap_t); 64 #define pmap_resident_count(pmap) pmap_resident_pages(pmap) 65 66 /* 67 * Since PTEs also contain type bits, we have to have some way 68 * to tell pmap_enter `this is an IO page' or `this is not to 69 * be cached'. Since physical addresses are always aligned, we 70 * can do this with the low order bits. 71 * 72 * The values below must agree with pte.h such that: 73 * (PMAP_OBIO << PG_MOD_SHIFT) == PGT_OBIO 74 */ 75 #define PMAP_OBIO 0x04 /* tells pmap_enter to use PG_OBIO */ 76 #define PMAP_VME16 0x08 /* etc */ 77 #define PMAP_VME32 0x0C /* etc */ 78 #define PMAP_NC 0x10 /* tells pmap_enter to set PG_NC */ 79 #define PMAP_SPEC 0x1C /* mask to get all above. */ 80 81 #endif /* _KERNEL */ 82 #endif /* _MACHINE_PMAP_ */ 83