1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)pte.h 8.1 (Berkeley) 06/11/93 11 */ 12 13 /* 14 * 386 page table entry and page table directory 15 * W.Jolitz, 8/89 16 * 17 * There are two major kinds of pte's: those which have ever existed (and are 18 * thus either now in core or on the swap device), and those which have 19 * never existed, but which will be filled on demand at first reference. 20 * There is a structure describing each. There is also an ancillary 21 * structure used in page clustering. 22 */ 23 24 #ifndef LOCORE 25 struct pde 26 { 27 unsigned int 28 pd_v:1, /* valid bit */ 29 pd_prot:2, /* access control */ 30 pd_mbz1:2, /* reserved, must be zero */ 31 pd_u:1, /* hardware maintained 'used' bit */ 32 :1, /* not used */ 33 pd_mbz2:2, /* reserved, must be zero */ 34 :3, /* reserved for software */ 35 pd_pfnum:20; /* physical page frame number of pte's*/ 36 }; 37 struct pte 38 { 39 unsigned int 40 pg_v:1, /* valid bit */ 41 pg_prot:2, /* access control */ 42 pg_mbz1:2, /* reserved, must be zero */ 43 pg_u:1, /* hardware maintained 'used' bit */ 44 pg_m:1, /* hardware maintained modified bit */ 45 pg_mbz2:2, /* reserved, must be zero */ 46 pg_fod:1, /* is fill on demand (=0) */ 47 :1, /* must write back to swap (unused) */ 48 pg_nc:1, /* 'uncacheable page' bit */ 49 pg_pfnum:20; /* physical page frame number */ 50 }; 51 struct hpte 52 { 53 unsigned int 54 pg_high:12, /* special for clustering */ 55 pg_pfnum:20; 56 }; 57 struct fpte 58 { 59 unsigned int 60 pg_v:1, /* valid bit */ 61 pg_prot:2, /* access control */ 62 :5, 63 pg_fileno:1, /* file mapped from or TEXT or ZERO */ 64 pg_fod:1, /* is fill on demand (=1) */ 65 pg_blkno:22; /* file system block number */ 66 }; 67 #endif 68 69 #define PD_MASK 0xffc00000 /* page directory address bits */ 70 #define PD_SHIFT 22 /* page directory address bits */ 71 72 #define PG_V 0x00000001 73 #define PG_PROT 0x00000006 /* all protection bits . */ 74 #define PG_FOD 0x00000200 75 #define PG_SWAPM 0x00000400 76 #define PG_N 0x00000800 /* Non-cacheable */ 77 #define PG_M 0x00000040 78 #define PG_U 0x00000020 /* not currently used */ 79 #define PG_FRAME 0xfffff000 80 81 #define PG_FZERO 0 82 #define PG_FTEXT 1 83 #define PG_FMAX (PG_FTEXT) 84 85 #define PG_NOACC 0 86 #define PG_KR 0x00000000 87 #define PG_KW 0x00000002 88 #define PG_URKR 0x00000004 89 #define PG_URKW 0x00000004 90 #define PG_UW 0x00000006 91 92 /* 93 * Page Protection Exception bits 94 */ 95 96 #define PGEX_P 0x01 /* Protection violation vs. not present */ 97 #define PGEX_W 0x02 /* during a Write cycle */ 98 #define PGEX_U 0x04 /* access from User mode (UPL) */ 99 100 /* 101 * Pte related macros 102 */ 103 #define dirty(pte) ((pte)->pg_m) 104 105 #ifndef LOCORE 106 #ifdef KERNEL 107 /* utilities defined in pmap.c */ 108 extern struct pte *Sysmap; 109 #endif 110 #endif 111