xref: /csrg-svn/sys/tahoe/include/pte.h (revision 49429)
1*49429Sbostic /*-
2*49429Sbostic  * Copyright (c) 1988 The Regents of the University of California.
3*49429Sbostic  * All rights reserved.
434408Skarels  *
5*49429Sbostic  * This code is derived from software contributed to Berkeley by
6*49429Sbostic  * Computer Consoles Inc.
7*49429Sbostic  *
8*49429Sbostic  * %sccs.include.proprietary.c%
9*49429Sbostic  *
10*49429Sbostic  *	@(#)pte.h	7.4 (Berkeley) 05/08/91
1134408Skarels  */
1224005Ssam 
1324005Ssam /*
1424005Ssam  * Tahoe page table entry
1524005Ssam  *
1624005Ssam  * There are two major kinds of pte's: those which have ever existed (and are
1724005Ssam  * thus either now in core or on the swap device), and those which have
1824005Ssam  * never existed, but which will be filled on demand at first reference.
1924005Ssam  * There is a structure describing each.  There is also an ancillary
2024005Ssam  * structure used in page clustering.
2124005Ssam  */
2224005Ssam 
2324005Ssam #ifndef LOCORE
2424005Ssam struct pte
2524005Ssam {
2624005Ssam unsigned int
2724005Ssam 		pg_v:1,			/* valid bit */
2824005Ssam 		pg_prot:4,		/* access control */
2924005Ssam 		pg_fod:1,		/* is fill on demand (=0) */
3025678Ssam 		:1,			/* must write back to swap (unused) */
3124005Ssam 		pg_nc:1,		/* 'uncacheable page' bit */
3224005Ssam 		pg_m:1,			/* hardware maintained modified bit */
3325678Ssam 		pg_u:1,			/* hardware maintained 'used' bit */
3424005Ssam 		pg_pfnum:22;		/* core page frame number or 0 */
3524005Ssam };
3624005Ssam struct hpte
3724005Ssam {
3824005Ssam unsigned int
3924005Ssam 		pg_high:10,		/* special for clustering */
4024005Ssam 		pg_pfnum:22;
4124005Ssam };
4224005Ssam struct fpte
4324005Ssam {
4424005Ssam unsigned int
4524005Ssam 		pg_v:1,
4624005Ssam 		pg_prot:4,
4724005Ssam 		pg_fod:1,		/* is fill on demand (=1) */
4824005Ssam 		:1,
4925678Ssam 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
5025678Ssam 		pg_blkno:24;		/* file system block number */
5124005Ssam };
5224005Ssam #endif
5324005Ssam 
5424005Ssam #define	PG_V		0x80000000
5524005Ssam #define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
5624005Ssam #define	PG_FOD		0x04000000
5724005Ssam #define	PG_SWAPM	0x02000000
5824005Ssam #define PG_N		0x01000000 /* Non-cacheable */
5924005Ssam #define	PG_M		0x00800000
6034155Skarels #define PG_U		0x00400000
6124005Ssam #define	PG_PFNUM	0x003fffff
6224005Ssam 
6325678Ssam #define	PG_FZERO	0
6425678Ssam #define	PG_FTEXT	1
6524005Ssam #define	PG_FMAX		(PG_FTEXT)
6624005Ssam 
6724005Ssam #define	PG_NOACC	0
6824005Ssam #define	PG_KR		0x40000000
6924005Ssam #define	PG_KW		0x60000000
7024005Ssam #define	PG_URKR		0x50000000
7124005Ssam #define	PG_URKW		0x70000000
7224005Ssam #define	PG_UW		0x78000000
7324005Ssam 
7424005Ssam /*
7524005Ssam  * Pte related macros
7624005Ssam  */
7731835Skarels #define	dirty(pte)	((pte)->pg_m)
7824005Ssam 
7934155Skarels /*
8034155Skarels  * Kernel virtual address to page table entry and to physical address.
8134155Skarels  */
8234155Skarels #define	kvtopte(va) (&Sysmap[((int)(va) &~ KERNBASE) >> PGSHIFT])
8334155Skarels #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
8434155Skarels 
8524005Ssam #ifndef LOCORE
8624005Ssam #ifdef KERNEL
8724005Ssam /* utilities defined in locore.s */
8824005Ssam extern	struct pte Sysmap[];
8924005Ssam extern	struct pte Usrptmap[];
9024005Ssam extern	struct pte usrpt[];
9124005Ssam extern	struct pte Swapmap[];
9224005Ssam extern	struct pte Forkmap[];
9324005Ssam extern	struct pte Xswapmap[];
9424005Ssam extern	struct pte Xswap2map[];
9524005Ssam extern	struct pte Pushmap[];
9624005Ssam extern	struct pte Vfmap[];
9724005Ssam extern	struct pte mmap[];
9824005Ssam extern	struct pte msgbufmap[];
9931417Smckusick extern	struct pte kmempt[], ekmempt[];
10037749Smckusick #ifdef NFS
10137749Smckusick extern	struct pte Nfsiomap[];
10224005Ssam #endif
10338898Skarels #ifdef MFS
10438898Skarels extern	struct pte Mfsiomap[];
10524005Ssam #endif
10637749Smckusick #endif
10738898Skarels #endif
108