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