xref: /original-bsd/sys/vax/include/pte.h (revision 2ce9ec30)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)pte.h	7.4 (Berkeley) 05/02/88
7  */
8 
9 /*
10  * VAX page table entry
11  *
12  * There are two major kinds of pte's: those which have ever existed (and are
13  * thus either now in core or on the swap device), and those which have
14  * never existed, but which will be filled on demand at first reference.
15  * There is a structure describing each.  There is also an ancillary
16  * structure used in page clustering.
17  */
18 
19 #ifndef LOCORE
20 struct pte
21 {
22 unsigned int	pg_pfnum:21,		/* core page frame number or 0 */
23 		:2,
24 		pg_vreadm:1,		/* modified since vread (or with _m) */
25 		:1,
26 		pg_fod:1,		/* is fill on demand (=0) */
27 		pg_m:1,			/* hardware maintained modified bit */
28 		pg_prot:4,		/* access control */
29 		pg_v:1;			/* valid bit */
30 };
31 struct hpte
32 {
33 unsigned int	pg_pfnum:21,
34 		:2,
35 		pg_high:9;		/* special for clustering */
36 };
37 struct fpte
38 {
39 unsigned int	pg_blkno:24,		/* file system block number */
40 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
41 		pg_fod:1,		/* is fill on demand (=1) */
42 		:1,
43 		pg_prot:4,
44 		pg_v:1;
45 };
46 #endif
47 
48 #define	PG_V		0x80000000
49 #define	PG_PROT		0x78000000
50 #define	PG_M		0x04000000
51 #define	PG_FOD		0x02000000
52 #define	PG_VREADM	0x00800000
53 #define	PG_PFNUM	0x001fffff
54 
55 #define	PG_FZERO	0
56 #define	PG_FTEXT	1
57 #define	PG_FMAX		(PG_FTEXT)
58 
59 #define	PG_NOACC	0
60 #define	PG_KW		0x10000000
61 #define	PG_KR		0x18000000
62 #define	PG_UW		0x20000000
63 #define	PG_URKW		0x70000000
64 #define	PG_URKR		0x78000000
65 
66 /*
67  * Pte related macros
68  */
69 #define	dirty(pte)	((pte)->pg_m)
70 
71 /*
72  * Kernel virtual address to page table entry and to physical address.
73  */
74 #define	kvtopte(va) (&Sysmap[((unsigned)(va) &~ KERNBASE) >> PGSHIFT])
75 #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
76 
77 #if defined(KERNEL) && !defined(LOCORE)
78 /* utilities defined in locore.s */
79 extern	struct pte Sysmap[];
80 extern	struct pte Usrptmap[];
81 extern	struct pte usrpt[];
82 extern	struct pte Swapmap[];
83 extern	struct pte Forkmap[];
84 extern	struct pte Xswapmap[];
85 extern	struct pte Xswap2map[];
86 extern	struct pte Pushmap[];
87 extern	struct pte Vfmap[];
88 extern	struct pte mmap[];
89 extern	struct pte msgbufmap[];
90 extern	struct pte kmempt[], ekmempt[];
91 extern	struct pte Nexmap[][16];
92 #if VAX8600
93 extern	struct pte Ioamap[][1];
94 #endif
95 #endif /* defined(KERNEL) && !defined(LOCORE) */
96