xref: /original-bsd/sys/tahoe/include/pte.h (revision 43bfbc1c)
1 /*	pte.h	1.3	86/01/17	*/
2 
3 /*
4  * Tahoe page table entry
5  *
6  * There are two major kinds of pte's: those which have ever existed (and are
7  * thus either now in core or on the swap device), and those which have
8  * never existed, but which will be filled on demand at first reference.
9  * There is a structure describing each.  There is also an ancillary
10  * structure used in page clustering.
11  */
12 
13 #ifndef LOCORE
14 struct pte
15 {
16 unsigned int
17 		pg_v:1,			/* valid bit */
18 		pg_prot:4,		/* access control */
19 		pg_fod:1,		/* is fill on demand (=0) */
20 		:1,			/* must write back to swap (unused) */
21 		pg_nc:1,		/* 'uncacheable page' bit */
22 		pg_m:1,			/* hardware maintained modified bit */
23 		pg_u:1,			/* hardware maintained 'used' bit */
24 		pg_pfnum:22;		/* core page frame number or 0 */
25 };
26 struct hpte
27 {
28 unsigned int
29 		pg_high:10,		/* special for clustering */
30 		pg_pfnum:22;
31 };
32 struct fpte
33 {
34 unsigned int
35 		pg_v:1,
36 		pg_prot:4,
37 		pg_fod:1,		/* is fill on demand (=1) */
38 		:1,
39 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
40 		pg_blkno:24;		/* file system block number */
41 };
42 #endif
43 
44 #define	PG_V		0x80000000
45 #define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
46 #define	PG_FOD		0x04000000
47 #define	PG_SWAPM	0x02000000
48 #define PG_N		0x01000000 /* Non-cacheable */
49 #define	PG_M		0x00800000
50 #define PG_U		0x00400000 /* not currently used */
51 #define	PG_PFNUM	0x003fffff
52 
53 #define	PG_FZERO	0
54 #define	PG_FTEXT	1
55 #define	PG_FMAX		(PG_FTEXT)
56 
57 #define	PG_NOACC	0
58 #define	PG_KR		0x40000000
59 #define	PG_KW		0x60000000
60 #define	PG_URKR		0x50000000
61 #define	PG_URKW		0x70000000
62 #define	PG_UW		0x78000000
63 
64 /*
65  * Pte related macros
66  */
67 #define	dirty(pte)	((pte)->pg_fod == 0 && (pte)->pg_pfnum && (pte)->pg_m)
68 
69 #ifndef LOCORE
70 #ifdef KERNEL
71 /* utilities defined in locore.s */
72 extern	struct pte Sysmap[];
73 extern	struct pte Usrptmap[];
74 extern	struct pte usrpt[];
75 extern	struct pte Swapmap[];
76 extern	struct pte Forkmap[];
77 extern	struct pte Xswapmap[];
78 extern	struct pte Xswap2map[];
79 extern	struct pte Pushmap[];
80 extern	struct pte Vfmap[];
81 extern	struct pte mmap[];
82 extern	struct pte msgbufmap[];
83 extern	struct pte camap[];
84 #endif
85 #endif
86