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