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