1*41058Swilliam /*- 2*41058Swilliam * Copyright (c) 1990 The Regents of the University of California. 3*41058Swilliam * All rights reserved. 4*41058Swilliam * 5*41058Swilliam * This code is derived from software contributed to Berkeley by 6*41058Swilliam * William Jolitz. 7*41058Swilliam * 8*41058Swilliam * %sccs.include.noredist.c% 9*41058Swilliam * 10*41058Swilliam * @(#)pte.h 5.1 (Berkeley) 04/24/90 11*41058Swilliam */ 12*41058Swilliam 1340465Sbill /* 14*41058Swilliam * 386 page table entry and page directory entry 1540465Sbill * W.Jolitz, 8/89 1640465Sbill * 1740465Sbill * There are two major kinds of pte's: those which have ever existed (and are 1840465Sbill * thus either now in core or on the swap device), and those which have 1940465Sbill * never existed, but which will be filled on demand at first reference. 2040465Sbill * There is a structure describing each. There is also an ancillary 2140465Sbill * structure used in page clustering. 2240465Sbill */ 2340465Sbill 2440465Sbill #ifndef LOCORE 25*41058Swilliam struct pde 2640465Sbill { 2740465Sbill unsigned int 28*41058Swilliam pd_v:1, /* valid bit */ 29*41058Swilliam pd_prot:2, /* access control */ 30*41058Swilliam pd_mbz1:2, /* reserved, must be zero */ 31*41058Swilliam pd_u:1, /* hardware maintained 'used' bit */ 3240465Sbill :1, /* not used */ 33*41058Swilliam pd_mbz2:2, /* reserved, must be zero */ 3440465Sbill :3, /* reserved for software */ 35*41058Swilliam pd_pfnum:20; /* physical page frame number of pte's*/ 3640465Sbill }; 37*41058Swilliam 3840465Sbill struct pte 3940465Sbill { 4040465Sbill unsigned int 4140465Sbill pg_v:1, /* valid bit */ 4240465Sbill pg_prot:2, /* access control */ 4340465Sbill pg_mbz1:2, /* reserved, must be zero */ 4440465Sbill pg_u:1, /* hardware maintained 'used' bit */ 4540465Sbill pg_m:1, /* hardware maintained modified bit */ 4640465Sbill pg_mbz2:2, /* reserved, must be zero */ 4740465Sbill pg_fod:1, /* is fill on demand (=0) */ 4840465Sbill :1, /* must write back to swap (unused) */ 4940465Sbill pg_nc:1, /* 'uncacheable page' bit */ 5040465Sbill pg_pfnum:20; /* physical page frame number */ 5140465Sbill }; 52*41058Swilliam 5340465Sbill struct hpte 5440465Sbill { 5540465Sbill unsigned int 5640465Sbill pg_high:12, /* special for clustering */ 5740465Sbill pg_pfnum:20; 5840465Sbill }; 59*41058Swilliam 6040465Sbill struct fpte 6140465Sbill { 6240465Sbill unsigned int 6340465Sbill pg_v:1, /* valid bit */ 6440465Sbill pg_prot:2, /* access control */ 6540465Sbill :5, 6640465Sbill pg_fileno:1, /* file mapped from or TEXT or ZERO */ 6740465Sbill pg_fod:1, /* is fill on demand (=1) */ 6840465Sbill pg_blkno:22; /* file system block number */ 6940465Sbill }; 7040465Sbill #endif 7140465Sbill 72*41058Swilliam #define PD_MASK 0xffc00000 /* page directory address bits */ 73*41058Swilliam #define PD_SHIFT 22 /* page directory address bits */ 74*41058Swilliam 7540465Sbill #define PG_V 0x00000001 7640465Sbill #define PG_PROT 0x00000006 /* all protection bits . */ 7740465Sbill #define PG_FOD 0x00000200 7840465Sbill #define PG_SWAPM 0x00000400 7940465Sbill #define PG_N 0x00000800 /* Non-cacheable */ 8040465Sbill #define PG_M 0x00000040 8140465Sbill #define PG_U 0x00000020 /* not currently used */ 82*41058Swilliam #define PG_FRAME 0xfffff000 8340465Sbill 8440465Sbill #define PG_FZERO 0 8540465Sbill #define PG_FTEXT 1 8640465Sbill #define PG_FMAX (PG_FTEXT) 8740465Sbill 8840465Sbill #define PG_NOACC 0 8940465Sbill #define PG_KR 0x00000000 9040465Sbill #define PG_KW 0x00000002 9140465Sbill #define PG_URKR 0x00000004 9240465Sbill #define PG_URKW 0x00000004 9340465Sbill #define PG_UW 0x00000006 9440465Sbill 9540465Sbill /* 9640465Sbill * Pte related macros 9740465Sbill */ 9840465Sbill #define dirty(pte) ((pte)->pg_m) 9940465Sbill 10040465Sbill #ifndef LOCORE 10140465Sbill #ifdef KERNEL 10240465Sbill /* utilities defined in locore.s */ 10340465Sbill extern struct pte Sysmap[]; 10440465Sbill extern struct pte Usrptmap[]; 10540465Sbill extern struct pte usrpt[]; 10640465Sbill extern struct pte Swapmap[]; 10740465Sbill extern struct pte Forkmap[]; 10840465Sbill extern struct pte Xswapmap[]; 10940465Sbill extern struct pte Xswap2map[]; 11040465Sbill extern struct pte Pushmap[]; 11140465Sbill extern struct pte Vfmap[]; 11240465Sbill extern struct pte mmap[]; 11340465Sbill extern struct pte msgbufmap[]; 11440465Sbill extern struct pte kmempt[], ekmempt[]; 11540465Sbill #endif 11640465Sbill #endif 117