Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * William Jolitz. | |
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 the University of | |
19 | * California, Berkeley and its contributors. | |
20 | * 4. Neither the name of the University nor the names of its contributors | |
21 | * may be used to endorse or promote products derived from this software | |
22 | * without specific prior written permission. | |
23 | * | |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | |
35 | * | |
db11a0e0 RG |
36 | * from: @(#)pte.h 5.5 (Berkeley) 5/9/91 |
37 | * $Id$ | |
15637ed4 RG |
38 | */ |
39 | ||
40 | /* | |
41 | * 386 page table entry and page table directory | |
42 | * W.Jolitz, 8/89 | |
43 | * | |
44 | * There are two major kinds of pte's: those which have ever existed (and are | |
45 | * thus either now in core or on the swap device), and those which have | |
46 | * never existed, but which will be filled on demand at first reference. | |
47 | * There is a structure describing each. There is also an ancillary | |
48 | * structure used in page clustering. | |
49 | */ | |
50 | ||
51 | #ifndef LOCORE | |
52 | struct pde | |
53 | { | |
54 | unsigned int | |
55 | pd_v:1, /* valid bit */ | |
56 | pd_prot:2, /* access control */ | |
57 | pd_mbz1:2, /* reserved, must be zero */ | |
58 | pd_u:1, /* hardware maintained 'used' bit */ | |
59 | :1, /* not used */ | |
60 | pd_mbz2:2, /* reserved, must be zero */ | |
61 | :3, /* reserved for software */ | |
62 | pd_pfnum:20; /* physical page frame number of pte's*/ | |
63 | }; | |
64 | struct pte | |
65 | { | |
66 | unsigned int | |
67 | pg_v:1, /* valid bit */ | |
68 | pg_prot:2, /* access control */ | |
69 | pg_mbz1:2, /* reserved, must be zero */ | |
70 | pg_u:1, /* hardware maintained 'used' bit */ | |
71 | pg_m:1, /* hardware maintained modified bit */ | |
72 | pg_mbz2:2, /* reserved, must be zero */ | |
73 | pg_fod:1, /* is fill on demand (=0) */ | |
74 | :1, /* must write back to swap (unused) */ | |
75 | pg_nc:1, /* 'uncacheable page' bit */ | |
76 | pg_pfnum:20; /* physical page frame number */ | |
77 | }; | |
78 | struct hpte | |
79 | { | |
80 | unsigned int | |
81 | pg_high:12, /* special for clustering */ | |
82 | pg_pfnum:20; | |
83 | }; | |
84 | struct fpte | |
85 | { | |
86 | unsigned int | |
87 | pg_v:1, /* valid bit */ | |
88 | pg_prot:2, /* access control */ | |
89 | :5, | |
90 | pg_fileno:1, /* file mapped from or TEXT or ZERO */ | |
91 | pg_fod:1, /* is fill on demand (=1) */ | |
92 | pg_blkno:22; /* file system block number */ | |
93 | }; | |
94 | #endif | |
95 | ||
96 | #define PD_MASK 0xffc00000 /* page directory address bits */ | |
97 | #define PD_SHIFT 22 /* page directory address bits */ | |
98 | ||
99 | #define PG_V 0x00000001 | |
100 | #define PG_PROT 0x00000006 /* all protection bits . */ | |
101 | #define PG_FOD 0x00000200 | |
102 | #define PG_SWAPM 0x00000400 | |
103 | #define PG_N 0x00000800 /* Non-cacheable */ | |
104 | #define PG_M 0x00000040 | |
105 | #define PG_U 0x00000020 /* not currently used */ | |
106 | #define PG_FRAME 0xfffff000 | |
107 | ||
108 | #define PG_FZERO 0 | |
109 | #define PG_FTEXT 1 | |
110 | #define PG_FMAX (PG_FTEXT) | |
111 | ||
112 | #define PG_NOACC 0 | |
113 | #define PG_KR 0x00000000 | |
114 | #define PG_KW 0x00000002 | |
115 | #define PG_URKR 0x00000004 | |
116 | #define PG_URKW 0x00000004 | |
117 | #define PG_UW 0x00000006 | |
118 | ||
119 | /* | |
120 | * Page Protection Exception bits | |
121 | */ | |
122 | ||
123 | #define PGEX_P 0x01 /* Protection violation vs. not present */ | |
124 | #define PGEX_W 0x02 /* during a Write cycle */ | |
125 | #define PGEX_U 0x04 /* access from User mode (UPL) */ | |
126 | ||
127 | /* | |
128 | * Pte related macros | |
129 | */ | |
130 | #define dirty(pte) ((pte)->pg_m) | |
131 | ||
132 | #ifndef LOCORE | |
133 | #ifdef KERNEL | |
134 | /* utilities defined in pmap.c */ | |
135 | extern struct pte *Sysmap; | |
136 | #endif | |
137 | #endif |