xref: /original-bsd/sys/tahoe/include/pte.h (revision 703f6d5d)
1 /*-
2  * Copyright (c) 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Computer Consoles Inc.
7  *
8  * %sccs.include.proprietary.c%
9  *
10  *	@(#)pte.h	7.4 (Berkeley) 05/08/91
11  */
12 
13 /*
14  * Tahoe page table entry
15  *
16  * There are two major kinds of pte's: those which have ever existed (and are
17  * thus either now in core or on the swap device), and those which have
18  * never existed, but which will be filled on demand at first reference.
19  * There is a structure describing each.  There is also an ancillary
20  * structure used in page clustering.
21  */
22 
23 #ifndef LOCORE
24 struct pte
25 {
26 unsigned int
27 		pg_v:1,			/* valid bit */
28 		pg_prot:4,		/* access control */
29 		pg_fod:1,		/* is fill on demand (=0) */
30 		:1,			/* must write back to swap (unused) */
31 		pg_nc:1,		/* 'uncacheable page' bit */
32 		pg_m:1,			/* hardware maintained modified bit */
33 		pg_u:1,			/* hardware maintained 'used' bit */
34 		pg_pfnum:22;		/* core page frame number or 0 */
35 };
36 struct hpte
37 {
38 unsigned int
39 		pg_high:10,		/* special for clustering */
40 		pg_pfnum:22;
41 };
42 struct fpte
43 {
44 unsigned int
45 		pg_v:1,
46 		pg_prot:4,
47 		pg_fod:1,		/* is fill on demand (=1) */
48 		:1,
49 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
50 		pg_blkno:24;		/* file system block number */
51 };
52 #endif
53 
54 #define	PG_V		0x80000000
55 #define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
56 #define	PG_FOD		0x04000000
57 #define	PG_SWAPM	0x02000000
58 #define PG_N		0x01000000 /* Non-cacheable */
59 #define	PG_M		0x00800000
60 #define PG_U		0x00400000
61 #define	PG_PFNUM	0x003fffff
62 
63 #define	PG_FZERO	0
64 #define	PG_FTEXT	1
65 #define	PG_FMAX		(PG_FTEXT)
66 
67 #define	PG_NOACC	0
68 #define	PG_KR		0x40000000
69 #define	PG_KW		0x60000000
70 #define	PG_URKR		0x50000000
71 #define	PG_URKW		0x70000000
72 #define	PG_UW		0x78000000
73 
74 /*
75  * Pte related macros
76  */
77 #define	dirty(pte)	((pte)->pg_m)
78 
79 /*
80  * Kernel virtual address to page table entry and to physical address.
81  */
82 #define	kvtopte(va) (&Sysmap[((int)(va) &~ KERNBASE) >> PGSHIFT])
83 #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
84 
85 #ifndef LOCORE
86 #ifdef KERNEL
87 /* utilities defined in locore.s */
88 extern	struct pte Sysmap[];
89 extern	struct pte Usrptmap[];
90 extern	struct pte usrpt[];
91 extern	struct pte Swapmap[];
92 extern	struct pte Forkmap[];
93 extern	struct pte Xswapmap[];
94 extern	struct pte Xswap2map[];
95 extern	struct pte Pushmap[];
96 extern	struct pte Vfmap[];
97 extern	struct pte mmap[];
98 extern	struct pte msgbufmap[];
99 extern	struct pte kmempt[], ekmempt[];
100 #ifdef NFS
101 extern	struct pte Nfsiomap[];
102 #endif
103 #ifdef MFS
104 extern	struct pte Mfsiomap[];
105 #endif
106 #endif
107 #endif
108