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