pmap.h revision 1.7 1 1.5 glass /*
2 1.5 glass * Copyright (c) 1993 Adam Glass
3 1.5 glass * All rights reserved.
4 1.5 glass *
5 1.5 glass * Redistribution and use in source and binary forms, with or without
6 1.5 glass * modification, are permitted provided that the following conditions
7 1.5 glass * are met:
8 1.5 glass * 1. Redistributions of source code must retain the above copyright
9 1.5 glass * notice, this list of conditions and the following disclaimer.
10 1.5 glass * 2. Redistributions in binary form must reproduce the above copyright
11 1.5 glass * notice, this list of conditions and the following disclaimer in the
12 1.5 glass * documentation and/or other materials provided with the distribution.
13 1.5 glass * 3. All advertising materials mentioning features or use of this software
14 1.5 glass * must display the following acknowledgement:
15 1.5 glass * This product includes software developed by Adam Glass.
16 1.5 glass * 4. The name of the Author may not be used to endorse or promote products
17 1.5 glass * derived from this software without specific prior written permission.
18 1.5 glass *
19 1.5 glass * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
20 1.5 glass * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.5 glass * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.5 glass * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.5 glass * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.5 glass * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.5 glass * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.5 glass * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.5 glass * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.5 glass * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.5 glass * SUCH DAMAGE.
30 1.5 glass *
31 1.7 glass * $Header: /tank/opengrok/rsync2/NetBSD/src/sys/arch/sun3/include/pmap.h,v 1.7 1994/04/24 20:10:18 glass Exp $
32 1.5 glass */
33 1.5 glass
34 1.1 glass #ifndef _PMAP_MACHINE_
35 1.1 glass #define _PMAP_MACHINE_
36 1.1 glass
37 1.7 glass #include <sys/queue.h>
38 1.7 glass
39 1.1 glass /*
40 1.1 glass * Pmap stuff
41 1.1 glass * [some ideas borrowed from torek, but no code]
42 1.1 glass */
43 1.1 glass
44 1.1 glass struct context_state {
45 1.7 glass TAILQ_ENTRY(context_state) context_link;
46 1.7 glass int context_num;
47 1.7 glass struct pmap *context_upmap;
48 1.1 glass };
49 1.2 glass
50 1.2 glass typedef struct context_state *context_t;
51 1.1 glass
52 1.1 glass struct pmap {
53 1.7 glass int pm_refcount; /* pmap reference count */
54 1.7 glass simple_lock_data_t pm_lock; /* lock on pmap */
55 1.7 glass struct pmap_statistics pm_stats; /* pmap statistics */
56 1.7 glass context_t pm_context; /* context if any */
57 1.7 glass int pm_version;
58 1.7 glass unsigned char *pm_segmap;
59 1.1 glass };
60 1.1 glass
61 1.1 glass typedef struct pmap *pmap_t;
62 1.1 glass
63 1.1 glass extern pmap_t kernel_pmap;
64 1.1 glass
65 1.7 glass #define PMEGQ_FREE 0
66 1.7 glass #define PMEGQ_INACTIVE 1
67 1.7 glass #define PMEGQ_ACTIVE 2
68 1.7 glass #define PMEGQ_NONE 3
69 1.7 glass
70 1.1 glass struct pmeg_state {
71 1.7 glass TAILQ_ENTRY(pmeg_state) pmeg_link;
72 1.7 glass int pmeg_index;
73 1.7 glass pmap_t pmeg_owner;
74 1.7 glass int pmeg_owner_version;
75 1.7 glass vm_offset_t pmeg_va;
76 1.7 glass int pmeg_wired_count;
77 1.7 glass int pmeg_reserved;
78 1.7 glass int pmeg_vpages;
79 1.7 glass int pmeg_qstate;
80 1.1 glass };
81 1.1 glass
82 1.1 glass typedef struct pmeg_state *pmeg_t;
83 1.1 glass
84 1.1 glass #define PMAP_ACTIVATE(pmap, pcbp, iscurproc) \
85 1.4 glass pmap_activate(pmap, pcbp)
86 1.1 glass #define PMAP_DEACTIVATE(pmap, pcbp) \
87 1.1 glass pmap_deactivate(pmap, pcbp)
88 1.1 glass
89 1.1 glass #define pmap_kernel() (kernel_pmap)
90 1.1 glass
91 1.1 glass /* like the sparc port, use the lower bits of a pa which must be page
92 1.1 glass * aligned anyway to pass memtype, caching information.
93 1.1 glass */
94 1.1 glass #define PMAP_MMEM 0x0
95 1.1 glass #define PMAP_OBIO 0x1
96 1.1 glass #define PMAP_VME16D 0x2
97 1.1 glass #define PMAP_VME32D 0x3
98 1.1 glass #define PMAP_MEMMASK 0x3
99 1.1 glass #define PMAP_NC 0x4
100 1.1 glass #define PMAP_SPECMASK 0x7
101 1.1 glass
102 1.3 glass extern vm_offset_t virtual_avail, virtual_end;
103 1.3 glass extern vm_offset_t avail_start, avail_end;
104 1.3 glass
105 1.1 glass #endif _PMAP_MACHINE_
106