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