xref: /original-bsd/sys/tahoe/include/pte.h (revision 5bfa3c83)
1 /*
2  * Copyright (c) 1988 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.3 (Berkeley) 08/31/89
7  */
8 
9 /*
10  * Tahoe 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
23 		pg_v:1,			/* valid bit */
24 		pg_prot:4,		/* access control */
25 		pg_fod:1,		/* is fill on demand (=0) */
26 		:1,			/* must write back to swap (unused) */
27 		pg_nc:1,		/* 'uncacheable page' bit */
28 		pg_m:1,			/* hardware maintained modified bit */
29 		pg_u:1,			/* hardware maintained 'used' bit */
30 		pg_pfnum:22;		/* core page frame number or 0 */
31 };
32 struct hpte
33 {
34 unsigned int
35 		pg_high:10,		/* special for clustering */
36 		pg_pfnum:22;
37 };
38 struct fpte
39 {
40 unsigned int
41 		pg_v:1,
42 		pg_prot:4,
43 		pg_fod:1,		/* is fill on demand (=1) */
44 		:1,
45 		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
46 		pg_blkno:24;		/* file system block number */
47 };
48 #endif
49 
50 #define	PG_V		0x80000000
51 #define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
52 #define	PG_FOD		0x04000000
53 #define	PG_SWAPM	0x02000000
54 #define PG_N		0x01000000 /* Non-cacheable */
55 #define	PG_M		0x00800000
56 #define PG_U		0x00400000
57 #define	PG_PFNUM	0x003fffff
58 
59 #define	PG_FZERO	0
60 #define	PG_FTEXT	1
61 #define	PG_FMAX		(PG_FTEXT)
62 
63 #define	PG_NOACC	0
64 #define	PG_KR		0x40000000
65 #define	PG_KW		0x60000000
66 #define	PG_URKR		0x50000000
67 #define	PG_URKW		0x70000000
68 #define	PG_UW		0x78000000
69 
70 /*
71  * Pte related macros
72  */
73 #define	dirty(pte)	((pte)->pg_m)
74 
75 /*
76  * Kernel virtual address to page table entry and to physical address.
77  */
78 #define	kvtopte(va) (&Sysmap[((int)(va) &~ KERNBASE) >> PGSHIFT])
79 #define	kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
80 
81 #ifndef LOCORE
82 #ifdef KERNEL
83 /* utilities defined in locore.s */
84 extern	struct pte Sysmap[];
85 extern	struct pte Usrptmap[];
86 extern	struct pte usrpt[];
87 extern	struct pte Swapmap[];
88 extern	struct pte Forkmap[];
89 extern	struct pte Xswapmap[];
90 extern	struct pte Xswap2map[];
91 extern	struct pte Pushmap[];
92 extern	struct pte Vfmap[];
93 extern	struct pte mmap[];
94 extern	struct pte msgbufmap[];
95 extern	struct pte kmempt[], ekmempt[];
96 #ifdef NFS
97 extern	struct pte Nfsiomap[];
98 #endif
99 #ifdef MFS
100 extern	struct pte Mfsiomap[];
101 #endif
102 #endif
103 #endif
104