xref: /csrg-svn/sys/vax/include/pte.h (revision 49436)
1*49436Sbostic /*-
2*49436Sbostic  * Copyright (c) 1982, 1986 The Regents of the University of California.
3*49436Sbostic  * All rights reserved.
423270Smckusick  *
5*49436Sbostic  * %sccs.include.proprietary.c%
6*49436Sbostic  *
7*49436Sbostic  *	@(#)pte.h	7.7 (Berkeley) 05/08/91
823270Smckusick  */
969Sbill 
1069Sbill /*
1169Sbill  * VAX page table entry
1269Sbill  *
1369Sbill  * There are two major kinds of pte's: those which have ever existed (and are
1469Sbill  * thus either now in core or on the swap device), and those which have
1569Sbill  * never existed, but which will be filled on demand at first reference.
1669Sbill  * There is a structure describing each.  There is also an ancillary
1769Sbill  * structure used in page clustering.
1869Sbill  */
1969Sbill 
202642Swnj #ifndef LOCORE
2169Sbill struct pte
2269Sbill {
2369Sbill unsigned int	pg_pfnum:21,		/* core page frame number or 0 */
2469Sbill 		:2,
2569Sbill 		pg_vreadm:1,		/* modified since vread (or with _m) */
2631834Skarels 		:1,
2769Sbill 		pg_fod:1,		/* is fill on demand (=0) */
2869Sbill 		pg_m:1,			/* hardware maintained modified bit */
2969Sbill 		pg_prot:4,		/* access control */
3069Sbill 		pg_v:1;			/* valid bit */
3169Sbill };
3269Sbill struct hpte
3369Sbill {
3469Sbill unsigned int	pg_pfnum:21,
3569Sbill 		:2,
3669Sbill 		pg_high:9;		/* special for clustering */
3769Sbill };
3869Sbill struct fpte
3969Sbill {
4018657Smckusick unsigned int	pg_blkno:24,		/* file system block number */
4118657Smckusick 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
4269Sbill 		pg_fod:1,		/* is fill on demand (=1) */
4369Sbill 		:1,
4469Sbill 		pg_prot:4,
4569Sbill 		pg_v:1;
4669Sbill };
472642Swnj #endif
4869Sbill 
4969Sbill #define	PG_V		0x80000000
5069Sbill #define	PG_PROT		0x78000000
5169Sbill #define	PG_M		0x04000000
523774Sroot #define	PG_FOD		0x02000000
5369Sbill #define	PG_VREADM	0x00800000
5469Sbill #define	PG_PFNUM	0x001fffff
5569Sbill 
5617547Skarels #define	PG_FZERO	0
5717547Skarels #define	PG_FTEXT	1
5869Sbill #define	PG_FMAX		(PG_FTEXT)
5969Sbill 
6069Sbill #define	PG_NOACC	0
6169Sbill #define	PG_KW		0x10000000
6269Sbill #define	PG_KR		0x18000000
6369Sbill #define	PG_UW		0x20000000
6469Sbill #define	PG_URKW		0x70000000
6569Sbill #define	PG_URKR		0x78000000
6669Sbill 
6769Sbill /*
6869Sbill  * Pte related macros
6969Sbill  */
7031834Skarels #define	dirty(pte)	((pte)->pg_m)
7169Sbill 
7234156Skarels /*
7334156Skarels  * Kernel virtual address to page table entry and to physical address.
7434156Skarels  */
7534156Skarels #define	kvtopte(va) (&Sysmap[((unsigned)(va) &~ KERNBASE) >> PGSHIFT])
7634156Skarels #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
7769Sbill 
7834156Skarels #if defined(KERNEL) && !defined(LOCORE)
7969Sbill /* utilities defined in locore.s */
8069Sbill extern	struct pte Sysmap[];
8169Sbill extern	struct pte Usrptmap[];
8269Sbill extern	struct pte usrpt[];
8369Sbill extern	struct pte Swapmap[];
8469Sbill extern	struct pte Forkmap[];
8569Sbill extern	struct pte Xswapmap[];
8669Sbill extern	struct pte Xswap2map[];
8769Sbill extern	struct pte Pushmap[];
8869Sbill extern	struct pte Vfmap[];
8969Sbill extern	struct pte mmap[];
902174Swnj extern	struct pte msgbufmap[];
9134156Skarels extern	struct pte kmempt[], ekmempt[];
922748Swnj extern	struct pte Nexmap[][16];
9334156Skarels #if VAX8600
9424180Sbloom extern	struct pte Ioamap[][1];
9569Sbill #endif
9637758Smckusick #ifdef NFS
9737758Smckusick extern	struct pte Nfsiomap[];
9837758Smckusick #endif
9938899Skarels #ifdef MFS
10038899Skarels extern	struct pte Mfsiomap[];
10138899Skarels #endif
10234156Skarels #endif /* defined(KERNEL) && !defined(LOCORE) */
103