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