xref: /csrg-svn/sys/tahoe/include/pte.h (revision 34155)
1*34155Skarels /*	pte.h	1.6	88/05/02	*/
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
50*34155Skarels #define PG_U		0x00400000
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  */
6731835Skarels #define	dirty(pte)	((pte)->pg_m)
6824005Ssam 
69*34155Skarels /*
70*34155Skarels  * Kernel virtual address to page table entry and to physical address.
71*34155Skarels  */
72*34155Skarels #define	kvtopte(va) (&Sysmap[((int)(va) &~ KERNBASE) >> PGSHIFT])
73*34155Skarels #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
74*34155Skarels 
7524005Ssam #ifndef LOCORE
7624005Ssam #ifdef KERNEL
7724005Ssam /* utilities defined in locore.s */
7824005Ssam extern	struct pte Sysmap[];
7924005Ssam extern	struct pte Usrptmap[];
8024005Ssam extern	struct pte usrpt[];
8124005Ssam extern	struct pte Swapmap[];
8224005Ssam extern	struct pte Forkmap[];
8324005Ssam extern	struct pte Xswapmap[];
8424005Ssam extern	struct pte Xswap2map[];
8524005Ssam extern	struct pte Pushmap[];
8624005Ssam extern	struct pte Vfmap[];
8724005Ssam extern	struct pte mmap[];
8824005Ssam extern	struct pte msgbufmap[];
8931417Smckusick extern	struct pte kmempt[], ekmempt[];
9024005Ssam #endif
9124005Ssam #endif
92