xref: /csrg-svn/sys/tahoe/include/pte.h (revision 31417)
1*31417Smckusick /*	pte.h	1.4	87/06/06	*/
224005Ssam 
324005Ssam /*
424005Ssam  * Tahoe page table entry
524005Ssam  *
624005Ssam  * There are two major kinds of pte's: those which have ever existed (and are
724005Ssam  * thus either now in core or on the swap device), and those which have
824005Ssam  * never existed, but which will be filled on demand at first reference.
924005Ssam  * There is a structure describing each.  There is also an ancillary
1024005Ssam  * structure used in page clustering.
1124005Ssam  */
1224005Ssam 
1324005Ssam #ifndef LOCORE
1424005Ssam struct pte
1524005Ssam {
1624005Ssam unsigned int
1724005Ssam 		pg_v:1,			/* valid bit */
1824005Ssam 		pg_prot:4,		/* access control */
1924005Ssam 		pg_fod:1,		/* is fill on demand (=0) */
2025678Ssam 		:1,			/* must write back to swap (unused) */
2124005Ssam 		pg_nc:1,		/* 'uncacheable page' bit */
2224005Ssam 		pg_m:1,			/* hardware maintained modified bit */
2325678Ssam 		pg_u:1,			/* hardware maintained 'used' bit */
2424005Ssam 		pg_pfnum:22;		/* core page frame number or 0 */
2524005Ssam };
2624005Ssam struct hpte
2724005Ssam {
2824005Ssam unsigned int
2924005Ssam 		pg_high:10,		/* special for clustering */
3024005Ssam 		pg_pfnum:22;
3124005Ssam };
3224005Ssam struct fpte
3324005Ssam {
3424005Ssam unsigned int
3524005Ssam 		pg_v:1,
3624005Ssam 		pg_prot:4,
3724005Ssam 		pg_fod:1,		/* is fill on demand (=1) */
3824005Ssam 		:1,
3925678Ssam 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
4025678Ssam 		pg_blkno:24;		/* file system block number */
4124005Ssam };
4224005Ssam #endif
4324005Ssam 
4424005Ssam #define	PG_V		0x80000000
4524005Ssam #define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
4624005Ssam #define	PG_FOD		0x04000000
4724005Ssam #define	PG_SWAPM	0x02000000
4824005Ssam #define PG_N		0x01000000 /* Non-cacheable */
4924005Ssam #define	PG_M		0x00800000
5025678Ssam #define PG_U		0x00400000 /* not currently used */
5124005Ssam #define	PG_PFNUM	0x003fffff
5224005Ssam 
5325678Ssam #define	PG_FZERO	0
5425678Ssam #define	PG_FTEXT	1
5524005Ssam #define	PG_FMAX		(PG_FTEXT)
5624005Ssam 
5724005Ssam #define	PG_NOACC	0
5824005Ssam #define	PG_KR		0x40000000
5924005Ssam #define	PG_KW		0x60000000
6024005Ssam #define	PG_URKR		0x50000000
6124005Ssam #define	PG_URKW		0x70000000
6224005Ssam #define	PG_UW		0x78000000
6324005Ssam 
6424005Ssam /*
6524005Ssam  * Pte related macros
6624005Ssam  */
6725678Ssam #define	dirty(pte)	((pte)->pg_fod == 0 && (pte)->pg_pfnum && (pte)->pg_m)
6824005Ssam 
6924005Ssam #ifndef LOCORE
7024005Ssam #ifdef KERNEL
7124005Ssam /* utilities defined in locore.s */
7224005Ssam extern	struct pte Sysmap[];
7324005Ssam extern	struct pte Usrptmap[];
7424005Ssam extern	struct pte usrpt[];
7524005Ssam extern	struct pte Swapmap[];
7624005Ssam extern	struct pte Forkmap[];
7724005Ssam extern	struct pte Xswapmap[];
7824005Ssam extern	struct pte Xswap2map[];
7924005Ssam extern	struct pte Pushmap[];
8024005Ssam extern	struct pte Vfmap[];
8124005Ssam extern	struct pte mmap[];
8224005Ssam extern	struct pte msgbufmap[];
83*31417Smckusick extern	struct pte kmempt[], ekmempt[];
8424005Ssam #endif
8524005Ssam #endif
86