xref: /csrg-svn/sys/vax/include/pte.h (revision 34156)
123270Smckusick /*
229194Smckusick  * Copyright (c) 1982, 1986 Regents of the University of California.
323270Smckusick  * All rights reserved.  The Berkeley software License Agreement
423270Smckusick  * specifies the terms and conditions for redistribution.
523270Smckusick  *
6*34156Skarels  *	@(#)pte.h	7.4 (Berkeley) 05/02/88
723270Smckusick  */
869Sbill 
969Sbill /*
1069Sbill  * VAX page table entry
1169Sbill  *
1269Sbill  * There are two major kinds of pte's: those which have ever existed (and are
1369Sbill  * thus either now in core or on the swap device), and those which have
1469Sbill  * never existed, but which will be filled on demand at first reference.
1569Sbill  * There is a structure describing each.  There is also an ancillary
1669Sbill  * structure used in page clustering.
1769Sbill  */
1869Sbill 
192642Swnj #ifndef LOCORE
2069Sbill struct pte
2169Sbill {
2269Sbill unsigned int	pg_pfnum:21,		/* core page frame number or 0 */
2369Sbill 		:2,
2469Sbill 		pg_vreadm:1,		/* modified since vread (or with _m) */
2531834Skarels 		:1,
2669Sbill 		pg_fod:1,		/* is fill on demand (=0) */
2769Sbill 		pg_m:1,			/* hardware maintained modified bit */
2869Sbill 		pg_prot:4,		/* access control */
2969Sbill 		pg_v:1;			/* valid bit */
3069Sbill };
3169Sbill struct hpte
3269Sbill {
3369Sbill unsigned int	pg_pfnum:21,
3469Sbill 		:2,
3569Sbill 		pg_high:9;		/* special for clustering */
3669Sbill };
3769Sbill struct fpte
3869Sbill {
3918657Smckusick unsigned int	pg_blkno:24,		/* file system block number */
4018657Smckusick 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
4169Sbill 		pg_fod:1,		/* is fill on demand (=1) */
4269Sbill 		:1,
4369Sbill 		pg_prot:4,
4469Sbill 		pg_v:1;
4569Sbill };
462642Swnj #endif
4769Sbill 
4869Sbill #define	PG_V		0x80000000
4969Sbill #define	PG_PROT		0x78000000
5069Sbill #define	PG_M		0x04000000
513774Sroot #define	PG_FOD		0x02000000
5269Sbill #define	PG_VREADM	0x00800000
5369Sbill #define	PG_PFNUM	0x001fffff
5469Sbill 
5517547Skarels #define	PG_FZERO	0
5617547Skarels #define	PG_FTEXT	1
5769Sbill #define	PG_FMAX		(PG_FTEXT)
5869Sbill 
5969Sbill #define	PG_NOACC	0
6069Sbill #define	PG_KW		0x10000000
6169Sbill #define	PG_KR		0x18000000
6269Sbill #define	PG_UW		0x20000000
6369Sbill #define	PG_URKW		0x70000000
6469Sbill #define	PG_URKR		0x78000000
6569Sbill 
6669Sbill /*
6769Sbill  * Pte related macros
6869Sbill  */
6931834Skarels #define	dirty(pte)	((pte)->pg_m)
7069Sbill 
71*34156Skarels /*
72*34156Skarels  * Kernel virtual address to page table entry and to physical address.
73*34156Skarels  */
74*34156Skarels #define	kvtopte(va) (&Sysmap[((unsigned)(va) &~ KERNBASE) >> PGSHIFT])
75*34156Skarels #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
7669Sbill 
77*34156Skarels #if defined(KERNEL) && !defined(LOCORE)
7869Sbill /* utilities defined in locore.s */
7969Sbill extern	struct pte Sysmap[];
8069Sbill extern	struct pte Usrptmap[];
8169Sbill extern	struct pte usrpt[];
8269Sbill extern	struct pte Swapmap[];
8369Sbill extern	struct pte Forkmap[];
8469Sbill extern	struct pte Xswapmap[];
8569Sbill extern	struct pte Xswap2map[];
8669Sbill extern	struct pte Pushmap[];
8769Sbill extern	struct pte Vfmap[];
8869Sbill extern	struct pte mmap[];
892174Swnj extern	struct pte msgbufmap[];
90*34156Skarels extern	struct pte kmempt[], ekmempt[];
912748Swnj extern	struct pte Nexmap[][16];
92*34156Skarels #if VAX8600
9324180Sbloom extern	struct pte Ioamap[][1];
9469Sbill #endif
95*34156Skarels #endif /* defined(KERNEL) && !defined(LOCORE) */
96