Commit | Line | Data |
---|---|---|
88a7e859 KM |
1 | /* |
2 | * Copyright (c) 1988 University of Utah. | |
3 | * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. | |
4 | * All rights reserved. | |
5 | * | |
6 | * This code is derived from software contributed to Berkeley by | |
7 | * the Systems Programming Group of the University of Utah Computer | |
8 | * Science Department. | |
9 | * | |
1c15e888 C |
10 | * Redistribution is only permitted until one year after the first shipment |
11 | * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and | |
12 | * binary forms are permitted provided that: (1) source distributions retain | |
13 | * this entire copyright notice and comment, and (2) distributions including | |
14 | * binaries display the following acknowledgement: This product includes | |
15 | * software developed by the University of California, Berkeley and its | |
16 | * contributors'' in the documentation or other materials provided with the | |
17 | * distribution and in all advertising materials mentioning features or use | |
18 | * of this software. Neither the name of the University nor the names of | |
19 | * its contributors may be used to endorse or promote products derived from | |
20 | * this software without specific prior written permission. | |
21 | * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
22 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
88a7e859 KM |
24 | * |
25 | * from: Utah $Hdr: pte.h 1.11 89/09/03$ | |
26 | * | |
1c15e888 | 27 | * @(#)pte.h 7.1 (Berkeley) 5/8/90 |
88a7e859 KM |
28 | */ |
29 | ||
30 | /* | |
31 | * HP300 page table entry | |
32 | * | |
33 | * There are two major kinds of pte's: those which have ever existed (and are | |
34 | * thus either now in core or on the swap device), and those which have | |
35 | * never existed, but which will be filled on demand at first reference. | |
36 | * There is a structure describing each. There is also an ancillary | |
37 | * structure used in page clustering. | |
38 | */ | |
39 | ||
40 | #ifndef LOCORE | |
41 | struct ste | |
42 | { | |
43 | unsigned int sg_pfnum:20, /* page table frame number */ | |
44 | :8, /* reserved at 0 */ | |
45 | :1, /* reserved at 1 */ | |
46 | sg_prot:1, /* write protect bit */ | |
47 | sg_v:2; /* valid bits */ | |
48 | }; | |
49 | ||
50 | struct pte | |
51 | { | |
52 | unsigned int pg_pfnum:20, /* page frame number or 0 */ | |
53 | :3, | |
54 | pg_fod:1, /* is fill on demand (=0) */ | |
55 | :1, /* reserved at zero */ | |
56 | pg_ci:1, /* cache inhibit bit */ | |
57 | :1, /* reserved at zero */ | |
58 | pg_m:1, /* hardware modified (dirty) bit */ | |
59 | pg_u:1, /* hardware used (reference) bit */ | |
60 | pg_prot:1, /* write protect bit */ | |
61 | pg_v:2; /* valid bit */ | |
62 | }; | |
63 | ||
64 | /* not used */ | |
65 | struct hpte | |
66 | { | |
67 | unsigned int pg_pfnum:20, | |
68 | pg_high:12; /* special for clustering */ | |
69 | }; | |
70 | ||
71 | struct fpte | |
72 | { | |
73 | unsigned int pg_blkno:22, /* file system block number */ | |
74 | pg_fileno:1, /* file mapped from or TEXT or ZERO */ | |
75 | pg_fod:1, /* is fill on demand (=1) */ | |
76 | :6, | |
77 | pg_v:2; | |
78 | }; | |
79 | #endif | |
80 | ||
81 | #define SG_V 0x00000002 | |
82 | #define SG_NV 0x00000000 | |
83 | #define SG_PROT 0x00000004 | |
84 | #define SG_RO 0x00000004 | |
85 | #define SG_RW 0x00000000 | |
86 | #define SG_FRAME 0xfffff000 | |
87 | #define SG_IMASK 0xffc00000 | |
88 | #define SG_PMASK 0x003ff000 | |
89 | #define SG_ISHIFT 22 | |
90 | #define SG_PSHIFT 12 | |
91 | ||
92 | #define PG_V 0x00000001 | |
93 | #define PG_NV 0x00000000 | |
94 | #define PG_PROT 0x00000004 | |
95 | #define PG_U 0x00000008 | |
96 | #define PG_M 0x00000010 | |
97 | #define PG_FOD 0x00000100 | |
98 | #define PG_RO 0x00000004 | |
99 | #define PG_RW 0x00000000 | |
100 | #define PG_FRAME 0xfffff000 | |
101 | #define PG_CI 0x00000040 | |
102 | #define PG_PFNUM(x) (((x) & PG_FRAME) >> PGSHIFT) | |
103 | ||
104 | /* | |
105 | * Pseudo protections. | |
106 | * Note that PG_URKW is not defined intuitively, but it is currently only | |
107 | * used in vgetu() to initialize the u-area PTEs in the process address | |
108 | * space. Since the kernel never accesses the u-area thru these we are ok. | |
109 | */ | |
110 | #define PG_KW PG_RW | |
111 | #define PG_URKR PG_RO | |
112 | #define PG_URKW PG_RO | |
113 | #define PG_UW PG_RW | |
114 | ||
115 | #define PG_FZERO 0 | |
116 | #define PG_FTEXT 1 | |
117 | #define PG_FMAX (PG_FTEXT) | |
118 | ||
119 | /* | |
120 | * Pte related macros | |
121 | */ | |
122 | #define dirty(pte) ((pte)->pg_m) | |
123 | ||
124 | /* | |
125 | * Kernel virtual address to page table entry and to physical address. | |
126 | */ | |
127 | #define kvtopte(va) (&Sysmap[((unsigned)(va) &~ KERNBASE) >> PGSHIFT]) | |
128 | #define ptetokv(pt) ((((struct pte *)(pt) - Sysmap) << PGSHIFT) | KERNBASE) | |
129 | #define kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET)) | |
130 | ||
131 | #if defined(KERNEL) && !defined(LOCORE) | |
1c15e888 C |
132 | /* utilities defined in locore.s */ |
133 | extern struct pte Sysmap[]; | |
134 | extern struct pte Usrptmap[]; | |
135 | extern struct pte usrpt[]; | |
136 | extern struct pte Swapmap[]; | |
137 | extern struct pte Forkmap[]; | |
138 | extern struct pte Xswapmap[]; | |
139 | extern struct pte Xswap2map[]; | |
140 | extern struct pte Pushmap[]; | |
141 | extern struct pte Vfmap[]; | |
142 | extern struct pte mmap[]; | |
143 | extern struct pte msgbufmap[]; | |
144 | extern struct pte kmempt[], ekmempt[]; | |
145 | extern struct ste Sysseg[]; | |
88a7e859 | 146 | #endif /* defined(KERNEL) && !defined(LOCORE) */ |